public ISPNode FindDefaultNode(ISPNode node) { ISPNode result = null; if (node.SPObjectType != null) { Type spType = null; var attr = node.SPObjectType.GetAttribute<ClientCallableTypeAttribute>(true); if (attr != null) { spType = attr.CollectionChildItemType; } if (spType == null) { Type[] argTypes = node.SPObjectType.GetBaseGenericArguments(); if (argTypes != null && argTypes.Length == 1) { spType = argTypes[0]; } } if (spType != null && node.NodeTypes.ContainsKey(spType)) { result = node.NodeTypes[spType]; } } return result; }
public SPTreeNode Load(ISPNode spNode) { var root = SPTreeNode.Create(this, spNode); LoadTreeNodes(root); return root; }
public override void Setup(ISPNode parent) { base.Setup(parent); try { if (this.Definition != null) { this.Text = this.Definition.GetTitle(CultureInfo.CurrentUICulture); this.ToolTipText = this.Definition.GetDescription(CultureInfo.CurrentUICulture); UpdateIconUri(); if (this.Definition.Hidden) { this.Text += " (Hidden)"; this.State = "Gray"; } } else { this.IconUri = SharePointContext.GetImagePath("ERRSM.GIF"); this.Text = string.Format("(Error: Missing definition {0})", this.Feature.DefinitionId); } } catch (Exception ex) { this.IconUri = SharePointContext.GetImagePath("error16by16.gif"); this.Text = "(Error: Feature missing)"; this.ToolTipText = ex.Message; } }
public ISPNode FindDefaultNode(ISPNode node) { ISPNode result = null; if (node.SPObjectType != null) { Type spType = null; var attr = node.SPObjectType.GetAttribute <ClientCallableTypeAttribute>(true); if (attr != null) { spType = attr.CollectionChildItemType; } if (spType == null) { Type[] argTypes = node.SPObjectType.GetBaseGenericArguments(); if (argTypes != null && argTypes.Length == 1) { spType = argTypes[0]; } } if (spType != null && node.NodeTypes.ContainsKey(spType)) { result = node.NodeTypes[spType]; } } return(result); }
public IEnumerable <ISPNode> LoadUnorderedChildren(ISPNode sourceNode) { var list = new List <ISPNode>(); PropertyDescriptorCollection propertyDescriptors = TypeDescriptor.GetProperties(sourceNode.SPObjectType); try { // ReSharper disable LoopCanBeConvertedToQuery foreach (PropertyDescriptor info in propertyDescriptors) { if (sourceNode.NodeTypes.ContainsKey(info.PropertyType)) { ISPNode node = sourceNode.NodeTypes[info.PropertyType]; //Ensure that the child node instance is unique in the TreeView node = Create(info.DisplayName, node.GetType(), sourceNode.SPObject); list.Add(node); //yield return node; } } // ReSharper restore LoopCanBeConvertedToQuery } catch (Exception ex) { MessageBox.Show(ex.Message); } return(list); }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Text = "ContentTypeUsages"; ToolTipText = this.GetType().Name; }
public static SPTreeNode Create(ITreeViewNodeProvider provider, ISPNode spNode) { var node = new SPMoreNode(spNode); node.NodeProvider = provider; return node; }
public override void Setup(ISPNode parent) { base.Setup(parent); if(SPObject != null) Text += String.Format(" ({0})", FileCollection.Count); }
public SPTreeNode Load(ISPNode spNode) { var root = SPTreeNode.Create(this, spNode); LoadTreeNodes(root); return(root); }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Text = this.Form.Url.Substring(this.Form.Url.LastIndexOf("/") + 1); this.ToolTipText = this.Form.Url; this.Url = this.Form.ParentList.ParentWeb.Url + "/" + this.Form.Url; }
public static SPTreeNode Create(ITreeViewNodeProvider provider, ISPNode spNode) { var node = new SPMoreNode(spNode); node.NodeProvider = provider; return(node); }
public override void Setup(ISPNode parent) { base.Setup(parent); if (this.SPObject != null) { this.Text = this.Web.Title; this.Url = this.Web.Url; } }
public override void Setup(ISPNode parent) { base.Setup(parent); if (SPObject != null) { Text += String.Format(" ({0})", FileCollection.Count); } }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Text = this.Entry.Key.ToString(); // Remove the "Expand" icon from the Property, because the will never be children to this object. //this.IsExpanded = true; }
private ISPNode CreateCollectionNode(ISPNodeCollection parentNode, Type spObejctType) { ISPNode node = CreateNodeOrDefault(spObejctType.FullName); if (node == null) { node = FindDefaultNode(parentNode, spObejctType); } return(node); }
public override void Setup(ISPNode parent) { base.Setup(parent); if (FieldTypeDefinition != null) { Text = FieldTypeDefinition.TypeDisplayName; ToolTipText = FieldTypeDefinition.TypeShortDescription; } }
public override void Setup(ISPNode parent) { base.Setup(parent); if (this.ContentType.Hidden) { this.Text = this.Text + " (Hidden)"; this.State = "Gray"; } }
public override void Setup(ISPNode parent) { base.Setup(parent); var val = this.SPObject as string; if (!String.IsNullOrEmpty(val)) { Text += " ("+val+")"; } }
public override void Setup(ISPNode parent) { base.Setup(parent); Text = this.SPObject as string; if (String.IsNullOrEmpty(Text)) { Text = "(Empty)"; } }
public static IItemNode Create(ITreeViewNodeProvider provider, ISPNode spNode) { var node = new ItemNode { NodeProvider = provider, SPNode = spNode }; return(node); }
public override void Setup(ISPNode parent) { base.Setup(parent); var val = this.SPObject as string; if (!String.IsNullOrEmpty(val)) { Text += " (" + val + ")"; } }
public override void Setup(ISPNode parent) { base.Setup(parent); if (String.IsNullOrEmpty(this.Url)) { var webapp = SPAdministrationWebApplication.Local; if (webapp.Sites.Count > 0) { this.Url = webapp.Sites["/"].Url; } } }
private void SelectObject(object obj) { FirstTextBlock.Text = string.Empty; if (obj != null && obj is ISPNode) { ISPNode node = (ISPNode)obj; string name = node.SPObjectType.Name; if (FirstTextBlock.Text != name) { FirstTextBlock.Text = node.SPObjectType.Name; } } }
public override void Setup(ISPNode parent) { base.Setup(parent); if (File != null) { if (this.File.Url.EndsWith(".aspx", StringComparison.OrdinalIgnoreCase)) { this.Url = SPUrlUtility.CombineUrl(this.File.ParentFolder.ParentWeb.Url, this.File.Url); } this.IconUri = SharePointContext.GetImagePath(this.File.IconUrl); this.Text = this.File.Name; } }
public override void Setup(ISPNode parent) { base.Setup(parent); string title = this.ASPWebPart.Title; if (title.Length == 0) { title = this.ASPWebPart.GetType().Name; } this.Text = title; this.ToolTipText = this.ASPWebPart.Description; this.IconUri = SharePointContext.TemplatePath + ASPWebPart.CatalogIconImageUrl; }
public static void Initialize(this ISPNode node, PropertyDescriptor descriptor, ISPNode parent, object spObject, int index) { if (descriptor == null) throw new ArgumentNullException("descriptor"); node.Parent = parent; node.NodeProvider = parent.NodeProvider; //node.ID = (spObject != null) ? GetCollectionItemID(spObject, index) : descriptor.GetHashCode().ToString(); node.ParentPropertyDescriptor = descriptor; node.Index = index; node.SPObject = spObject; //node.Setup(parent); }
public override void Setup(ISPNode parent) { base.Setup(parent); string title = (String.IsNullOrEmpty(this.List.Title)) ? this.List.ID.ToString() : this.List.Title; this.Text = String.Format("{0} ({1})", title, this.List.ItemCount); if (this.List.Hidden) { this.State = "Gray"; } this.Url = SPUtility.GetFullUrl(List.ParentWeb.Site, List.DefaultViewUrl); this.IconUri = GetIconUri(this.List.ImageUrl); }
public Dictionary<Type, ISPNode> GetChildrenTypes(ISPNode parentNode) { IEnumerable<Lazy<SPNode>> importedNodes = CompositionProvider.GetExports<SPNode>(parentNode.Descriptor.ClassType); var types = new Dictionary<Type, ISPNode>(); foreach (var lazyItem in importedNodes) { SPNode node = lazyItem.Value; node.NodeProvider = parentNode.NodeProvider; if (node.Descriptor.AdapterItemType != null) { types.AddOrReplace(node.Descriptor.AdapterItemType, node); } } return types; }
public IEnumerable <ISPNode> LoadUnorderedChildren(ISPNode sourceNode) { var list = new List <ISPNode>(); if (sourceNode.SPObject == null) { return(list); } ISPNode node = null; var propertyDescriptors = TypeDescriptor.GetProperties(sourceNode.SPObjectType); try { foreach (PropertyDescriptor descriptor in propertyDescriptors) { node = CreateNodeOrDefault(descriptor.PropertyType.FullName); if (node == null) { continue; } node.Initialize(descriptor, sourceNode, null, list.Count); if (node.SPObject == null) { continue; } node.Setup(sourceNode); // Exclude the node if it do not match the correct view if (!RunIncludeRules(node)) { continue; } list.Add(node); } } catch (Exception ex) { MessageBox.Show(ex.Message + " : " + node.GetType().FullName + " : " + ex.StackTrace); } return(list); }
public Dictionary <Type, ISPNode> GetChildrenTypes(ISPNode parentNode) { IEnumerable <Lazy <SPNode> > importedNodes = CompositionProvider.GetExports <SPNode>(parentNode.Descriptor.ClassType); var types = new Dictionary <Type, ISPNode>(); foreach (var lazyItem in importedNodes) { SPNode node = lazyItem.Value; node.NodeProvider = parentNode.NodeProvider; if (node.Descriptor.AdapterItemType != null) { types.AddOrReplace(node.Descriptor.AdapterItemType, node); } } return(types); }
public override void Setup(ISPNode parent) { base.Setup(parent); if (this.SPObject == null) return; string title = (String.IsNullOrEmpty(this.DocumentLibrary.Title)) ? this.DocumentLibrary.ID.ToString() : this.DocumentLibrary.Title; this.Text = String.Format("{0} ({1})", title, this.DocumentLibrary.ItemCount); if (this.DocumentLibrary.Hidden) { this.State = "Gray"; } this.Url = SPUtility.GetFullUrl(this.DocumentLibrary.ParentWeb.Site, this.DocumentLibrary.DefaultViewUrl); this.IconUri = SPListNode.GetIconUri(this.DocumentLibrary.ImageUrl); }
private SPSite GetSite(SPNode node) { SPSite result = null; ISPNode temp = node; if (temp.SPObjectType == typeof(SPSite)) { result = temp.SPObject as SPSite; } else { if (temp.Parent != null) { result = GetSite(temp.Parent as SPNode); } } return(result); }
public virtual void Setup(ISPNode parent) { if (parent == null) { return; } Parent = parent; NodeProvider = parent.NodeProvider; if (ParentPropertyDescriptor == null) { ParentPropertyDescriptor = new NullPropertyDescriptor(parent); } if (String.IsNullOrEmpty(ID)) { if (parent is ISPNodeCollection && SPObject != null) { ID = GetCollectionItemID(SPObject, Index); } else { ID = ParentPropertyDescriptor.GetHashCode().ToString(); } } var tempText = GetTitle(); Text = tempText; //ToolTipText = tempText; // Make sure to update all children if exist! foreach (var item in Children) { item.Setup(this); if (item.Children.Count > 0) { item.LoadChildren(); } } }
public SPTreeNode(ISPNode modelNode) { Model = modelNode; this._spObject = () => Model.SPObject; this.DefaultExpand = false; int index = Program.Window.Explorer.AddImage(Model.IconUri); this.ImageIndex = index; this.SelectedImageIndex = index; this.DataBindings.Add("Text", Model, "Text"); this.DataBindings.Add("ToolTipText", Model, "ToolTipText"); this.DataBindings.Add("BrowserUrl", Model, "Url"); this.Name = (Model.SPObjectType != null) ? Model.SPObjectType.FullName : Model.GetType().FullName; if (Model.HasChildren()) { this.Nodes.Add(new ExplorerNodeBase("Dummy")); } }
private void SetObject() { if (this.IsWindowVisible) { ISPNode node = (ISPNode)this.SelectedObject; if (node != null) { Uri nodeUrl = null; if (!String.IsNullOrEmpty(node.Url)) { nodeUrl = new Uri(node.Url); } if ((nodeUrl == null && this.LastSelectedUri != null) || nodeUrl != this.LastSelectedUri) { this.LastSelectedUri = nodeUrl; this.BrowserContainer.Browser.Url = nodeUrl; } } } }
public override void Setup(ISPNode parent) { base.Setup(parent); if (this.SPObject == null) { return; } string title = (String.IsNullOrEmpty(this.DocumentLibrary.Title)) ? this.DocumentLibrary.ID.ToString() : this.DocumentLibrary.Title; this.Text = String.Format("{0} ({1})", title, this.DocumentLibrary.ItemCount); if (this.DocumentLibrary.Hidden) { this.State = "Gray"; } this.Url = SPUtility.GetFullUrl(this.DocumentLibrary.ParentWeb.Site, this.DocumentLibrary.DefaultViewUrl); this.IconUri = SPListNode.GetIconUri(this.DocumentLibrary.ImageUrl); }
public override void LoadChildren() { if (SPObject == null) { return; } if (Children.Count > 0) { // Ensure that the last node is the "MoreNode". int nodeIndex = Children.Count - 1; ISPNode node = Children[nodeIndex]; if (node is MoreNode) { // Remove the "MoreNode" from this.Children. Children.RemoveAt(nodeIndex); } } else { ClearChildren(); EnsureNodeTypes(); } #if DEBUG var watch = new Stopwatch(); watch.Start(); #endif // Load the next batch! Children.AddRange(NodeProvider.LoadCollectionChildren(this)); #if DEBUG watch.Stop(); Trace.WriteLine(String.Format("Load Properties: Type:{0} - Time {1} milliseconds.", SPObjectType.Name, watch.ElapsedMilliseconds)); #endif }
public SPMoreNode(ISPNode modelNode) : base(modelNode) { this.Text = "More..."; }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Text = ContentTypeUsage.Url; }
public NullPropertyDescriptor(ISPNode parent) : this(parent.Text) { }
public static IItemNode Create(ITreeViewNodeProvider provider, ISPNode spNode) { var node = new ItemNode { NodeProvider = provider, SPNode = spNode }; return node; }
public override void Setup(ISPNode parent) { base.Setup(parent); }
public override void Setup(ISPNode parent) { base.Setup(parent); Text = "IisSettings"; }
public override void Setup(ISPNode parent) { base.Setup(parent); try { if(this.Definition != null) { this.Text = this.Definition.GetTitle(CultureInfo.CurrentUICulture); this.ToolTipText = this.Definition.GetDescription(CultureInfo.CurrentUICulture); UpdateIconUri(); if (this.Definition.Hidden) { this.Text += " (Hidden)"; this.State = "Gray"; } } else { this.IconUri = SharePointContext.GetImagePath("ERRSM.GIF"); this.Text = string.Format("(Error: Missing definition {0})", this.Feature.DefinitionId); } } catch (Exception ex) { this.IconUri = SharePointContext.GetImagePath("error16by16.gif"); this.Text = "(Error: Feature missing)"; this.ToolTipText = ex.Message; } }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Url = SPUrlUtility.CombineUrl( this.ListCollection.Web.Url, "_layouts/15/viewlsts.aspx"); }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Url = SPUrlUtility.CombineUrl(View.ParentList.ParentWeb.Url, View.Url); }
public override void Setup(ISPNode parent) { base.Setup(parent); this.Text = "WebParts"; this.IconUri = SharePointContext.GetImagePath("itgen.GIF"); }