private int find_key <T>(T key, List <Node> path) { INodeHelper <T> nodeHelper = (INodeHelper <T>)hlp; int num = 0; Node node = null; Node node2 = root; path?.Add(root); while (node2 != null) { num = nodeHelper.Compare(key, node2); if (num == 0) { return(num); } if (num < 0) { node = node2.right; node2 = node2.left; } else { node = node2.left; node2 = node2.right; } if (path != null) { path.Add(node); path.Add(node2); } } return(num); }
public Node Lookup <T>(T key) { INodeHelper <T> nodeHelper = (INodeHelper <T>)hlp; Node node; int num; for (node = root; node != null; node = ((num >= 0) ? node.right : node.left)) { num = nodeHelper.Compare(key, node); if (num == 0) { break; } } return(node); }
public Node Lookup <T>(T key) { INodeHelper <T> hlp = (INodeHelper <T>) this.hlp; Node current = root; while (current != null) { int c = hlp.Compare(key, current); if (c == 0) { break; } current = c < 0 ? current.left : current.right; } return(current); }
// Get an enumerator that starts at 'key' or the next higher element in the tree public NodeEnumerator GetSuffixEnumerator <T>(T key) { var pennants = new Stack <Node>(); INodeHelper <T> hlp = (INodeHelper <T>) this.hlp; Node current = root; while (current != null) { int c = hlp.Compare(key, current); if (c <= 0) { pennants.Push(current); } if (c == 0) { break; } current = c < 0 ? current.left : current.right; } return(new NodeEnumerator(this, pennants)); }
// Pre-condition: root != null int find_key <T>(T key, List <Node> path) { INodeHelper <T> hlp = (INodeHelper <T>) this.hlp; int c = 0; Node sibling = null; Node current = root; if (path != null) { path.Add(root); } while (current != null) { c = hlp.Compare(key, current); if (c == 0) { return(c); } if (c < 0) { sibling = current.right; current = current.left; } else { sibling = current.left; current = current.right; } if (path != null) { path.Add(sibling); path.Add(current); } } return(c); }
public void Bound <T>(T key, ref Node lower, ref Node upper) { INodeHelper <T> hlp = (INodeHelper <T>) this.hlp; Node current = root; while (current != null) { int c = hlp.Compare(key, current); if (c <= 0) { upper = current; } if (c >= 0) { lower = current; } if (c == 0) { break; } current = c < 0 ? current.left : current.right; } }
public CarouselBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public RssController(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public ArticleController(ISectionsProvider sectionsProvider, IPageModelExtender pageModelExtender, INodeHelper nodeHelper) { _pageModelExtender = pageModelExtender; _nodeHelper = nodeHelper; _sectionsProvider = sectionsProvider; }
public static ImageWraper GetImage(this IPublishedContent model, string imagePropertyAlias, INodeHelper umbracoHelper) { var mediaContentId = model.GetPropertyValue <int>(imagePropertyAlias); var image = umbracoHelper.GetMedia(mediaContentId); var imageAlias = image.GetPropertyValue <string>("imageAlias"); return(new ImageWraper(image.Url, imageAlias)); }
public SitemapController(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public PageModelExtender(INodeHelper nodeHelper, IBuildersFactory buildersFactory) { _nodeHelper = nodeHelper; _buildersFactory = buildersFactory; }
public TagController(IPageModelExtender pageModelExtender, INodeHelper nodeHelper, IBuildersFactory buildersFactory) { _pageModelExtender = pageModelExtender; _nodeHelper = nodeHelper; _buildersFactory = buildersFactory; }
public ParagraphNode(IHtmlParagraphElement content) { Content = content; Children = INodeHelper.TryCreateNodes(content.Children).ToList(); }
protected override void OnLoad(EventArgs e) { if (this._nodeHelper == null) { _nodeHelper = new NodeHelper(Table); } TreeStore.Config config = new TreeStore.Config { NodeParam = "parentId" }; this._treeStore = new TreeStore(config); this._treeStore.ID = "_treeStore"; Model model = new Model { Fields = { new ModelField("Id", ModelFieldType.String), new ModelField("Name", ModelFieldType.String), new ModelField("ParentId", ModelFieldType.String) } }; model.Fields.AddRange(this._nodeHelper.CustomFields); this._treeStore.Model.Add(model); this._treeStore.Proxy.Add(new PageProxy()); this.Store.Add(this._treeStore); this._treeStore.ReadData += new TreeStoreBase.ReadDataEventHandler(this.treeStore_ReadData); base.RemoteRemove += new TreePanel.RemoteRemoveEventHandler(this.TreePanelEx_RemoteRemove); base.RemoteEdit += new TreePanel.RemoteEditEventHandler(this.TreePanelEx_RemoteEdit); base.RemoteMove += new TreePanel.RemoteMoveEventHandler(this.TreePanelEx_RemoteMove); Ext.Net.Button button = new Ext.Net.Button { Text = "刷新", Handler = "App." + this.ID + ".getStore().load();" }; Toolbar toolbar = new Toolbar(); toolbar.Items.Add(button); this.TopBar.Add(toolbar); if (!Ext.Net.X.IsAjaxRequest) { //base.Listeners.NodeDragOver.Handler = "var recs = dragData.records;var prev=-1;for(var i=0;i<recs.length;i++){var recData=recs[i].data;if(prev==-1){prev=recData.Level;}else{if(prev!=recData.Level){return false;}}}if(targetNode.data.Level>=" + this.Level + ")return false;return true;"; Parameter parameters = new Parameter { Name = "parentId", Value = "arguments[1].data.parentId", Mode = ParameterMode.Raw }; this.RemoteExtraParams.Add(parameters); this.On("beforeRemoteAction", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); JFunction fn = new JFunction("Ext.net.Mask.hide();"); this.On("remoteActionRefusal", fn); this.On("remoteActionException", fn); this.On("remoteActionSuccess", fn); this.On("remoteEditRefusal", new JFunction("Ext.Msg.alert('失败了')")); this._treeStore.On("beforeload", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); this._treeStore.On("load", new JFunction("Ext.net.Mask.hide();")); Ext.Net.Node node = new Ext.Net.Node(); node.CustomAttributes.Add(new ConfigItem("Id", "")); node.CustomAttributes.Add(new ConfigItem("Name", "根")); node.NodeID = "0"; node.Expanded = true; node.Text = "根"; this.Root.Add(node); Column column = new Column(); this.ColumnModel.Columns.Add(column); TreeColumn column2 = new TreeColumn(); this.ColumnModel.Columns.Add(column2); ActionColumn column3 = new ActionColumn(); if (this.EnableRemove) { ActionItem item2 = new ActionItem(); column3.Items.Add(item2); item2.Icon = Ext.Net.Icon.PageWhiteDelete; item2.Handler = "var record=arguments[5];var tree = App." + this.ID + ";var node = tree.getStore().getNodeById(record.data.Id) || tree.getStore().getNewRecords()[0];Ext.Msg.confirm(\"提示\", \"会删除相关的数据,无法恢复,确认删除?\", function (r) {if (r == \"yes\") {tree.removeNode(node);return;App.direct.RemoveNode(record.data.Id, {success: function (result) {if (result.Success) {node.remove();node.commit();} else {Ext.Msg.alert(\"错误\", result.Message);}},eventMask: {showMask: true,msg: \"正在删除\"}});}});"; item2.Tooltip = "删除"; } this.ColumnModel.Columns.Add(column3); column.ID = "col1"; column.DataIndex = "Id"; column.Width = 50; column.Text = "编号"; column2.ID = "col2"; column2.DataIndex = "Name"; column2.Width = 300; column2.Text = "名称"; column3.ID = "col3"; column3.Text = "操作"; column3.Width = 60; column3.Align = Alignment.Center; if (EnableEdit) { ActionItem item = new ActionItem(); column3.Items.Add(item); item.Icon = Ext.Net.Icon.PageWhiteAdd; item.Handler = "var record=arguments[5]; var tree = App." + this.ID + ";var ep = tree.editingPlugin;var node,store = tree.getStore();if (record.data.Id) {node = store.getNodeById(record.data.Id);}else{node = store.getRootNode();}node.expand(false, function () {node = node.appendChild({Name:'新节点'});setTimeout(function () {ep.startEdit(node, tree.columns[1]);}, 200);});"; item.Tooltip = "添加子节点"; CellEditing editing = new CellEditing(); editing.Listeners.CancelEdit.Handler = " if (e.record.data.Id) {e.record.reject();} else {e.record.remove(true);}"; this.Plugins.Add(editing); this.Editor.Add(new TextField()); TreeView view = new TreeView(); this.View.Add(view); TreeViewDragDrop drop = new TreeViewDragDrop { DragText = "移动到", AppendOnly = true }; view.Plugins.Add(drop); } this.Mode = TreePanelMode.Remote; } base.OnLoad(e); }
public LatestArticlesBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public ArticleListBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public HeaderBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public OtherNode(IElement content) { Content = content; Children = INodeHelper.TryCreateNodes(content.Children).ToList(); }
public FooterBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public ImageSectionBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public AllArticlesController(INodeHelper nodeHelper, IPageModelExtender pageModelExtender) { _nodeHelper = nodeHelper; _pageModelExtender = pageModelExtender; }
public ArticlesCarouselBuilder(INodeHelper nodeHelper) { _nodeHelper = nodeHelper; }
public BodyNode(IHtmlBodyElement content) { Content = content; Children = INodeHelper.TryCreateNodes(content.Children).ToList(); }