/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { foreach (var node in Nodes) { node.Format(outer); } }
private static void InitEventContent(IHtmlOutput source) { if (source.Items.ContainsKey(AppEvent.Load)) { return; } if (source.Items.ContainsKey(AppEvent.Active)) { return; } if (source.Items.ContainsKey(AppEvent.Inactive)) { return; } if (source.Items.ContainsKey(AppEvent.Unload)) { return; } source.OnCompleted += (outer) => { outer.Append("<script>"); outer.Append("$app.event()"); AddAppEventContent(outer, AppEvent.Load); AddAppEventContent(outer, AppEvent.Active); AddAppEventContent(outer, AppEvent.Inactive); AddAppEventContent(outer, AppEvent.Unload); outer.Append(";</script>"); }; }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { outer.Append(HtmlChar.SingleLeftAngleQuotation); outer.Append(Tag); Attributes.Format(outer); Classes.Format(outer); Csses.Format(outer); Scripts.Format(outer); if (NodesIsEmpty() && IsSelfClosed(Tag)) { outer.Append(HtmlChar.Slashes); outer.Append(HtmlChar.SingleRightAngleQuotation); return; } outer.Append(HtmlChar.SingleRightAngleQuotation); foreach (var node in Children()) { node.Format(outer); } if (HtmlOutput.DebugFormat && Children().Count() > 0) { outer.Append("\r\n"); } outer.Append(HtmlChar.SingleLeftAngleQuotation); outer.Append(HtmlChar.Slashes); outer.Append(Tag); outer.Append(HtmlChar.SingleRightAngleQuotation); }
void IHtmlNode.Format(IHtmlOutput outer) { foreach (var item in Nodes) { item.Format(outer); } }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> /// <param name="routeValues"></param> public void Format(IHtmlOutput outer, object routeValues) { if (routeValues == null) { return; } Format(outer, routeValues.ConvertToKeyValues()); }
void IHtmlNode.Format(IHtmlOutput outer) { if (outer == null) { throw new ArgumentNullException("outer"); } Format(outer); }
/// <summary> /// 设置快速搜索栏 /// </summary> /// <param name="source">输出组件</param> /// <param name="location">位置</param> /// <param name="key">参数键</param> /// <param name="placeholder">占位符</param> public static void SetQuickSearch(this IHtmlOutput source, ILocation location, string key = "key", string placeholder = null) { var script = string.Format( "oldmansoft.webman.search.on({{ action: '{0}', target: '{1}', name: '{2}', placeholder: '{3}' }})", location.Path.JavaScriptEncode(), location.Behave.GetTarget(), key.JavaScriptEncode(), string.IsNullOrEmpty(placeholder) ? location.Display.JavaScriptEncode() : placeholder.JavaScriptEncode() ); source.AddEvent(AppEvent.Active, script); }
public void Format(IHtmlOutput outer) { foreach (var item in Store) { outer.Append(HtmlChar.Spaces); outer.Append(item.Key.HtmlEncode()); outer.Append(HtmlChar.Equals); outer.Append(HtmlChar.DoubleQuotes); outer.Append(item.Value.HtmlEncode()); outer.Append(HtmlChar.DoubleQuotes); } }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { var name = outer.Generator.GetGeneratorName(); SetTableAction(outer, name); foreach (var item in FrontNodes) { item.Format(outer); } var table = new HtmlElement(HtmlTag.Table); table.AddClass(name); table.AddClass("dataTable"); table.AddClass("hover"); table.Data("parameter", GetSelectedParameterName()); var header = new HtmlElement(HtmlTag.THead); table.Append(header); var tbody = new HtmlElement(HtmlTag.TBody); var count = SetBody(tbody); table.Append(tbody); var footer = new HtmlElement(HtmlTag.TFoot); table.Append(footer); header.Append(CreateDefinitionColumns()); footer.Append(CreateDefinitionColumns()); base.Append(table); if (IsDisplayTableInfo) { base.Append(GetBodyTableInfo(count)); } base.Format(outer); foreach (var item in AfterNodes) { item.Format(outer); } outer.AddEvent(AppEvent.Load, string.Format( "oldmansoft.webman.setStaticTable(view, '{0}', {1});", name, GetOptionScript() ) ); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { var a = Location.CreateElement(); a.AddClass("badge-container"); Append(a); if (Leafs.HasChild()) { AddClass("branch"); Append(Leafs); } base.Format(outer); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { Header.Prepend(Icon.CreateElement()); HeaderCaption.Text(Caption); if (HeaderSearchForm != null) { Header.Append(HeaderSearchForm); } if (!string.IsNullOrWhiteSpace(Description)) { var span = new HtmlElement(HtmlTag.Span); span.Text(Description); HeaderCaption.After(span); } AddClass("webman-panel"); base.Format(outer); }
private static void AddAppEventContent(IHtmlOutput outer, AppEvent e) { if (!outer.Items.ContainsKey(e)) { return; } outer.Append(".on"); outer.Append(e.ToString()); outer.Append("(function (view) {"); outer.Append("\r\n"); foreach (var item in outer.Items[e] as List <string> ) { outer.Append(item); outer.Append("\r\n"); } outer.Append("})"); }
/// <summary> /// 添加事件脚本 /// </summary> /// <param name="source"></param> /// <param name="e"></param> /// <param name="script"></param> public static void AddEvent(this IHtmlOutput source, AppEvent e, Element.Script script) { if (script == null) { return; } if (!script.HasContent()) { return; } InitEventContent(source); if (!source.Items.ContainsKey(e)) { source.Items.Add(e, new List <string>()); } var list = source.Items[e] as List <string>; script.SetListFromContent(list); }
public void Format(IHtmlOutput outer) { if (Store.Count == 0) { return; } outer.Append(HtmlChar.Spaces); outer.Append(HtmlAttribute.Style); outer.Append(HtmlChar.Equals); outer.Append(HtmlChar.DoubleQuotes); foreach (var item in Store) { outer.Append(item.Key); outer.Append(HtmlChar.Colons); outer.Append(item.Value.HtmlEncode()); outer.Append(HtmlChar.Semicolons); } outer.Append(HtmlChar.DoubleQuotes); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> /// <param name="args"></param> public void Format(IHtmlOutput outer, IDictionary <string, Action> args) { if (outer == null) { throw new ArgumentNullException("outer"); } if (args == null) { throw new ArgumentNullException("args"); } for (var i = 0; i < Content.Count; i++) { outer.Append(Content[i]); if (Position.Count > i && args.ContainsKey(Position[i])) { args[Position[i]](); } } }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { var name = outer.Generator.GetGeneratorName(); SetTableAction(outer, name); foreach (var item in FrontNodes) { item.Format(outer); } AddClass(name); AddClass("dataTable"); AddClass("hover"); Data("parameter", GetSelectedParameterName()); var header = new HtmlElement(HtmlTag.THead); base.Append(header); base.Append(new HtmlElement(HtmlTag.TBody)); var footer = new HtmlElement(HtmlTag.TFoot); base.Append(footer); header.Append(CreateDefinitionColumns()); footer.Append(CreateDefinitionColumns()); base.Format(outer); foreach (var item in AfterNodes) { item.Format(outer); } outer.AddEvent(AppEvent.Load, string.Format( "oldmansoft.webman.setDataTable(view, '{0}', '{1}', {2});", name, DataSourceLoation, GetOptionScript() ) ); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { if (!HasContent()) { return; } var list = new List <string>(); SetListFromContent(list); var content = new StringBuilder(); content.AppendLine(); foreach (var item in list) { content.AppendLine(item); } Append(new HtmlRaw(content.ToString())); base.Format(outer); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { var name = outer.Generator.GetGeneratorName(); AddClass(name); if (ViewMode) { AddClass("view-mode"); } AddButtonGroup(); base.Format(outer); if (ViewMode) { outer.AddEvent(AppEvent.Load, Script.ToString()); } else { outer.AddEvent(AppEvent.Load, string.Format("oldmansoft.webman.setFormValidate(view, '{0}', {1});{2}", name, Validator.Create(), Script.ToString())); } }
/// <summary> /// 添加事件脚本 /// </summary> /// <param name="source"></param> /// <param name="e"></param> /// <param name="script"></param> public static void AddEvent(this IHtmlOutput source, AppEvent e, string script) { if (string.IsNullOrWhiteSpace(script)) { return; } InitEventContent(source); if (!source.Items.ContainsKey(e)) { source.Items.Add(e, new List <string>()); } var list = source.Items[e] as List <string>; if (script.Last() == ';') { list.Add(script); } else { list.Add(string.Format("{0};", script)); } }
public void Format(IHtmlOutput outer) { if (Store.Count == 0) { return; } outer.Append(HtmlChar.Spaces); outer.Append(HtmlAttribute.Class); outer.Append(HtmlChar.Equals); outer.Append(HtmlChar.DoubleQuotes); var i = 0; foreach (var item in Store) { if (i > 0) { outer.Append(HtmlChar.Spaces); } outer.Append(item.HtmlEncode()); i++; } outer.Append(HtmlChar.DoubleQuotes); }
private void SetTableAction(IHtmlOutput outer, string name) { if (TableActions.Count == 0) { return; } var tableAction = new HtmlElement(HtmlTag.Div); tableAction.AddClass("dataTable-action btn-group"); tableAction.Data("target", name); for (var i = 0; i < TableActions.Count; i++) { var item = TableActions[i]; var a = new HtmlElement(HtmlTag.A); tableAction.Append(a); a.AddClass("btn"); a.Data("index", i.ToString()); a.Data("path", item.Location); a.Data("behave", ((int)item.Behave).ToString()); a.Data("other", ((item.IsSupportParameter ? 1 : 0) + (item.IsNeedSelected ? 2 : 0)).ToString()); if (!string.IsNullOrEmpty(item.ConfirmContent)) { a.Data("tips", item.ConfirmContent); } var span = new HtmlElement(HtmlTag.Span); a.Append(span); span.Text(item.Text); if (item.IsSupportParameter) { IsDisplayCheckboxColumn = true; } } ((IHtmlElement)tableAction).Format(outer); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { outer.Append(Content.HtmlEncode()); }
/// <summary> /// Gets the string that represents the report. /// </summary> /// <returns>the report</returns> /// <remarks>not yet implemented.</remarks> public override string GetReportString() { StringBuilder sb = new StringBuilder(); //wpisujemy nag³owek sb.AppendLine(this.getHeader()); //najpierw robimy nag³owek sb.AppendLine(@"<tr><td width='782'><h1>CAS - DataPorter " + "</h1></td><tr>"); sb.AppendLine(@"<tr><td bgcolor='#021376' width='782' height='1'></td></tr>"); sb.AppendLine(@"<tr><td width='782'>"); // //Miejsce na wlasciwe dane sb.AppendLine(@"<table border='0' align='center' width='700' class='t1'>"); sb.AppendLine(@"<tr><td class='k1'>Report time </td><td>" + System.DateTime.Now.ToString() + "</td></tr>"); sb.AppendLine(@"<tr><td class='k1'>Run Time [s] </td><td>" + Main.RunTime.ToString() + "</td></tr>"); sb.AppendLine(@"<tr><td class='k1'>Program Name </td><td>" + System.Windows.Forms.Application.ProductName + "</td></tr>"); sb.AppendLine(@"<tr><td class='k1'>Release </td><td>" + System.Windows.Forms.Application.ProductVersion + "</td></tr>"); sb.AppendLine(@"</table>"); sb.AppendLine(@"<Table border='0' width='100'> <TBody> <TR> <TD class='kk'><t>.......................................................................................</TD> </TR></TBODY></Table> "); // // pierwszy obiekt - by wziac naglowek tabeli IHtmlOutput firstobj; //clienci opc: if (OPCClientStatistics.ServersList.Count > 0) { sb.AppendLine(@"<h2>OPC Clients</h2><table border='1'>"); firstobj = OPCClientStatistics.ServersList.Values[0]; sb.AppendLine(firstobj.GetHtmlTableRowDescription()); foreach (var kvp in OPCClientStatistics.ServersList) { IHtmlOutput obj = kvp.Value as IHtmlOutput; if (obj != null) { sb.AppendLine(obj.ToHtmlTableRow()); } } sb.AppendLine(@"</table>"); } //grupy opc: if (OPCGroup.GroupList.Count > 0) { sb.AppendLine(@"<h2>OPC Groups</h2><table border='1'>"); firstobj = (IHtmlOutput)OPCGroup.GroupList.Values[0]; sb.AppendLine(firstobj.GetHtmlTableRowDescription()); foreach (var kvp in OPCGroup.GroupList) { IHtmlOutput obj = kvp.Value as IHtmlOutput; if (obj != null) { sb.AppendLine(obj.ToHtmlTableRow()); } } sb.AppendLine(@"</table>"); } //items opc: if (OPCTag.AllTags.Count > 0) { sb.AppendLine(@"<h2>OPC Items</h2><table border='1'>"); firstobj = (IHtmlOutput)OPCTag.AllTags.Values[0]; sb.AppendLine(firstobj.GetHtmlTableRowDescription()); foreach (var kvp in OPCTag.AllTags) { IHtmlOutput obj = kvp.Value as IHtmlOutput; if (obj != null) { sb.AppendLine(obj.ToHtmlTableRow()); } } sb.AppendLine(@"</table>"); } if (TransactionStatistics.TransactionList.Count > 0) { //transaction opc: sb.AppendLine(@"<h2>Transaction</h2><table border='1'>"); firstobj = (IHtmlOutput) TransactionStatistics.TransactionList.Values[0]; sb.AppendLine(firstobj.GetHtmlTableRowDescription()); foreach (var kvp in TransactionStatistics.TransactionList) { IHtmlOutput obj = kvp.Value as IHtmlOutput; if (obj != null) { sb.AppendLine(obj.ToHtmlTableRow()); } } sb.AppendLine(@"</table>"); } // //stopka: sb.AppendLine(this.getFooter()); return(sb.ToString()); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected abstract void Format(IHtmlOutput outer);
void IHtmlNode.Format(IHtmlOutput outer) { (Element as IHtmlNode).Format(outer); }
/// <summary> /// 格式化 /// </summary> /// <param name="outer"></param> protected override void Format(IHtmlOutput outer) { BeforeFormat(); outer.Append("<!DOCTYPE html>"); base.Format(outer); }