Exemple #1
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="options">Information what to replace.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter options)
 {
     foreach (var s in this)
     {
         s.VisitDocumentReferences(options);
     }
 }
Exemple #2
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     for (int i = 0; i < _rowSelections.Count; ++i)
     {
         _rowSelections[i].VisitDocumentReferences(Report);
     }
 }
Exemple #3
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public virtual void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     foreach (var item in this)
     {
         item.VisitDocumentReferences(Report);
     }
 }
Exemple #4
0
        /// <summary>
        /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
        /// to change a plot so that the plot items refer to another table.
        /// </summary>
        /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
        public void VisitDocumentReferences(DocNodeProxyReporter Report)
        {
            Report(_dataTable, this, "DataTable");
            Report(_xColumn, this, "XColumn");
            Report(_yColumn, this, "YColumn");
            Report(_zColumn, this, "ZColumn");

            _dataRowSelection.VisitDocumentReferences(Report);
        }
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     if (null != _columnX)
     {
         Report(_columnX, this, nameof(ColumnX));
     }
     if (null != _columnY)
     {
         Report(_columnY, this, nameof(ColumnY));
     }
 }
Exemple #6
0
        /// <summary>
        /// Sorts the project items by dependencies. On return, the item with which has no dependencies is located at the beginning of the list. The item with the most dependencies on other items in the list is the last item in the list.
        /// </summary>
        /// <param name="list">The list to sort.</param>
        public void SortItemsByDependencies(List <IProjectItem> list)
        {
            var dependencies = new Dictionary <IProjectItem, HashSet <IProjectItem> >(); // key is the project item, value is the set of items this project item is dependent on

            foreach (var item in list)
            {
                dependencies.Add(item, new HashSet <IProjectItem>());
                DocNodeProxyReporter reporter = (proxy, owner, propertyName) => SortItemsByDependencyProxyReporter(proxy, owner, propertyName, dependencies[item]);
                item.VisitDocumentReferences(reporter);
            }

            list.Sort((item1, item2) => SortItemsByDependencyComparison(item1, item2, dependencies));
        }
Exemple #7
0
        /// <summary>
        /// Copyies one item to another folder by cloning the item.
        /// </summary>
        /// <param name="item">Item to copy. Has to be either a <see cref="ProjectFolder"/>, or a project item (<see cref="IProjectItem"/>).</param>
        /// <param name="destinationFolderName">Destination folder name.</param>
        /// <param name="ReportProxies">If not null, this argument is used to relocate references to other items (e.g. columns) to point to the destination folder.</param>
        /// <param name="overwriteExistingItemsOfSameType">If true, any item with the same name and same type will be replaced by the copied item. (if false, a new name is found for the copied item which not conflicts with the existing items).</param>
        public void CopyItemToFolder(object item, string destinationFolderName, DocNodeProxyReporter ReportProxies, bool overwriteExistingItemsOfSameType)
        {
            ProjectFolder.ThrowExceptionOnInvalidFullFolderPath(destinationFolderName);

            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (item is ProjectFolder projFolder)
            {
                var    orgName  = projFolder.Name;
                string destName = ProjectFolder.Combine(destinationFolderName, ProjectFolder.GetFoldersLastFolderPart(orgName));
                foreach (var subitem in GetItemsInFolderAndSubfolders(orgName))
                {
                    var oldItemFolder = ProjectFolder.GetFolderPart(subitem.Name);
                    var newItemFolder = oldItemFolder.Replace(orgName, destName);
                    CopyItemToFolder(subitem, newItemFolder, ReportProxies, overwriteExistingItemsOfSameType);
                }
            }
            else if (item is IProjectItem projectItem)
            {
                var orgName    = projectItem.Name;
                var clonedItem = (IProjectItem)projectItem.Clone();
                clonedItem.Name = ProjectFolder.Combine(destinationFolderName, ProjectFolder.GetNamePart(orgName));

                if (overwriteExistingItemsOfSameType)
                {
                    var existingItem = AltaxoDocument.TryGetExistingItemWithSameTypeAndName(clonedItem);
                    if (null != existingItem)
                    {
                        Current.ProjectService.DeleteDocument(existingItem, true);
                    }
                }

                AltaxoDocument.AddItem(clonedItem);

                if (null != ReportProxies)
                {
                    clonedItem.VisitDocumentReferences(ReportProxies);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("The item of type {0} can not be copied", item.GetType()));
            }
        }
Exemple #8
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     _matrixProxy.VisitDocumentReferences(Report);
 }
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			for (int i = 0; i < _rowSelections.Count; ++i)
			{
				_rowSelections[i].VisitDocumentReferences(Report);
			}
		}
 /// <summary>
 /// Has to enumerate all references to other items in the project (<see cref="DocNodeProxy" />) which are used in this project item and in all childs of this project item. The references
 /// has to be reported to the <paramref name="ProxyProcessing" /> function. This function is responsible for processing of the proxies, for instance to relocated the path.
 /// </summary>
 /// <param name="ProxyProcessing">Function that processes  the found <see cref="DocNodeProxy" /> instances.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter ProxyProcessing)
 {
     // currently there is nothing to do here
 }
Exemple #11
0
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public override void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			_plotData.VisitDocumentReferences(Report);
			base.VisitDocumentReferences(Report);
		}
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			_matrixProxy.VisitDocumentReferences(Report);
		}
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			Report(this._columnProxy, this, nameof(Column));
		}
Exemple #14
0
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			if (null != _commonErrorColumn)
				Report(_commonErrorColumn, this, nameof(CommonErrorColumn));
			if (null != _positiveErrorColumn)
				Report(_positiveErrorColumn, this, nameof(PositiveErrorColumn));
			if (null != _negativeErrorColumn)
				Report(_negativeErrorColumn, this, nameof(NegativeErrorColumn));
		}
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     Report(_dataColumnProxy, this, "DataColumn");
 }
Exemple #16
0
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			Report(_dataTable, this, "DataTable");
			Report(_xColumn, this, "XColumn");
			Report(_yColumn, this, "YColumn");

			_dataRowSelection.VisitDocumentReferences(Report);
		}
Exemple #17
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public abstract void VisitDocumentReferences(DocNodeProxyReporter Report);
Exemple #18
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public override void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     _plotData.VisitDocumentReferences(Report);
     base.VisitDocumentReferences(Report);
 }
Exemple #19
0
        /// <summary>
        /// Copies the items given in the list (tables, graphs and folders) to another folder, which is given by newFolderName. The copying
        /// is done by cloning the items.
        /// </summary>
        /// <param name="list">List of items to copy.</param>
        /// <param name="destinationFolderName">Destination folder name.</param>
        /// <param name="ReportProxies">If not null, this argument is used to relocate references to other items (e.g. columns) to point to the destination folder.</param>
        /// <param name="overwriteExistingItemsOfSameType">If true, any item with the same name and same type will be replaced by the copied item. (if false, a new name is found for the copied item which not conflicts with the existing items).</param>
        public void CopyItemsToFolder(IList <object> list, string destinationFolderName, DocNodeProxyReporter ReportProxies, bool overwriteExistingItemsOfSameType)
        {
            ProjectFolder.ThrowExceptionOnInvalidFullFolderPath(destinationFolderName);

            foreach (object item in list)
            {
                CopyItemToFolder(item, destinationFolderName, ReportProxies, overwriteExistingItemsOfSameType);
            }
        }
Exemple #20
0
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
		}
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			if (null != _columnX)
				Report(_columnX, this, nameof(ColumnX));
			if (null != _columnY)
				Report(_columnY, this, nameof(ColumnY));
			if (null != _columnZ)
				Report(_columnZ, this, nameof(ColumnZ));
		}
Exemple #22
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     Report(_columnProxy, this, nameof(Column));
 }
Exemple #23
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public override void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
     _rootLayer.VisitDocumentReferences(Report);
 }
Exemple #24
0
 /// <summary>
 /// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
 /// to change a plot so that the plot items refer to another table.
 /// </summary>
 /// <param name="Report">Function that reports the found <see cref="DocNodeProxy"/> instances to the visitor.</param>
 public void VisitDocumentReferences(DocNodeProxyReporter Report)
 {
 }
Exemple #25
0
		/// <summary>
		/// Replaces path of items (intended for data items like tables and columns) by other paths. Thus it is possible
		/// to change a plot so that the plot items refer to another table.
		/// </summary>
		/// <param name="Report">Information what to replace.</param>
		public void VisitDocumentReferences(DocNodeProxyReporter Report)
		{
			Report(_labelColumnProxy, this, "LabelColumn");
		}