public static ReadableColumnProxyForStandaloneColumns FromColumn(IReadableColumn column)
		{
			var colAsDocumentNode = column as IDocumentLeafNode;
			if (null != colAsDocumentNode)
				throw new ArgumentException(string.Format("column does implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));

			return new ReadableColumnProxyForStandaloneColumns(column); ;
		}
        public static ReadableColumnProxyForStandaloneColumns FromColumn(IReadableColumn column)
        {
            var colAsDocumentNode = column as IDocumentLeafNode;

            if (null != colAsDocumentNode)
            {
                throw new ArgumentException(string.Format("column does implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));
            }

            return(new ReadableColumnProxyForStandaloneColumns(column));

            ;
        }
Exemple #3
0
        /// <summary>
        /// Updates the information, indicating in <paramref name="hasTableChanged"/> whether the underlying data table has changed.
        /// </summary>
        /// <param name="dataTableOfPlotItem">The data table of plot item.</param>
        /// <param name="groupNumberOfPlotItem">The group number of plot item.</param>
        /// <param name="hasTableChanged">If set to <c>true</c>, the data table has recently changed.</param>
        public void Update(DataTable dataTableOfPlotItem, int groupNumberOfPlotItem, bool hasTableChanged)
        {
            bool hasChanged = false;

            if (!object.ReferenceEquals(_supposedDataTable, dataTableOfPlotItem))
            {
                _supposedDataTable = dataTableOfPlotItem;
                hasChanged         = true;
            }

            if (!(_supposedGroupNumber == groupNumberOfPlotItem))
            {
                _supposedGroupNumber = groupNumberOfPlotItem;
                hasChanged           = true;
            }

            if (null == _underlyingColumn)
            {
                if (string.IsNullOrEmpty(_nameOfUnderlyingDataColumn))
                {
                    hasChanged |= InternalSet(ref _plotColumnBoxText, string.Empty);
                    hasChanged |= InternalSet(ref _plotColumnBoxState, _plotColumnBoxStateIfColumnIsMissing);
                    switch (_plotColumnBoxState)
                    {
                    case PlotColumnControlState.Normal:
                        hasChanged |= InternalSet(ref _plotColumnToolTip, string.Empty);
                        break;

                    case PlotColumnControlState.Warning:
                        hasChanged |= InternalSet(ref _plotColumnToolTip, "Warning: it is highly recommended to set a column!");
                        break;

                    case PlotColumnControlState.Error:
                        hasChanged |= InternalSet(ref _plotColumnToolTip, "Error: it is mandatory to set a column!");
                        break;
                    }
                }
                else
                {
                    hasChanged |= InternalSet(ref _plotColumnBoxText, _nameOfUnderlyingDataColumn);
                    hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("Column {0} can not be found in this table with this group number", _nameOfUnderlyingDataColumn));
                    hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Error);
                }
            }
            else if (_underlyingColumn is DataColumn)
            {
                var dcolumn          = (DataColumn)_underlyingColumn;
                var parentTable      = DataTable.GetParentDataTableOf(dcolumn);
                var parentCollection = DataColumnCollection.GetParentDataColumnCollectionOf(dcolumn);
                if (null == parentTable)
                {
                    hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("This column is an orphaned data column without a parent data table", _nameOfUnderlyingDataColumn));
                    hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Error);
                    if (parentCollection == null)
                    {
                        hasChanged |= InternalSet(ref _plotColumnBoxText, string.Format("Orphaned {0}", dcolumn.GetType().Name));
                    }
                    else
                    {
                        string columnName = parentCollection.GetColumnName(dcolumn);
                        hasChanged |= InternalSet(ref _nameOfUnderlyingDataColumn, columnName);
                        hasChanged |= InternalSet(ref _plotColumnBoxText, columnName);
                    }
                }
                else // UnderlyingColumn has a parent table
                {
                    if (!object.ReferenceEquals(parentTable, dataTableOfPlotItem))
                    {
                        hasChanged |= InternalSet(ref _plotColumnBoxText, parentTable.DataColumns.GetColumnName(dcolumn));
                        hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("The column {0} is a data column with another parent data table: {1}", _nameOfUnderlyingDataColumn, parentTable.Name));
                        hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Warning);
                    }
                    else if (!(parentTable.DataColumns.GetColumnGroup(dcolumn) == _supposedGroupNumber))
                    {
                        string columnName = parentTable.DataColumns.GetColumnName(dcolumn);
                        hasChanged |= InternalSet(ref _nameOfUnderlyingDataColumn, columnName);
                        hasChanged |= InternalSet(ref _plotColumnBoxText, columnName);
                        hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("The column {0} is a data column with another group number: {1}", _nameOfUnderlyingDataColumn, parentTable.DataColumns.GetColumnGroup(dcolumn)));
                        hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Warning);
                    }
                    else
                    {
                        string columnName = parentTable.DataColumns.GetColumnName(dcolumn);
                        hasChanged |= InternalSet(ref _nameOfUnderlyingDataColumn, columnName);
                        hasChanged |= InternalSet(ref _plotColumnBoxText, columnName);
                        hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("UnderlyingColumn {0} of data table {1}", _nameOfUnderlyingDataColumn, parentTable.Name));
                        hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Normal);
                    }
                }
            }
            else // UnderlyingColumn is not a DataColumn, but is something else
            {
                hasChanged |= InternalSet(ref _nameOfUnderlyingDataColumn, null);
                hasChanged |= InternalSet(ref _plotColumnBoxText, _underlyingColumn.FullName);
                hasChanged |= InternalSet(ref _plotColumnToolTip, string.Format("Independent data of type {0}: {1}", _underlyingColumn.GetType(), _underlyingColumn.ToString()));
                hasChanged |= InternalSet(ref _plotColumnBoxState, PlotColumnControlState.Normal);
            }

            // now the transformation
            if (null != _transformation)
            {
                hasChanged |= InternalSet(ref _transformationBoxText, _transformation.RepresentationAsOperator ?? _transformation.RepresentationAsFunction);
                hasChanged |= InternalSet(ref _transformationToolTip, string.Format("Transforms the column data by the function f(x)={0}", _transformation.RepresentationAsFunction));
            }
            else // transformation is null
            {
                hasChanged |= InternalSet(ref _transformationBoxText, string.Empty);
                hasChanged |= InternalSet(ref _transformationToolTip, "No transformation applied.");
            }

            _isDirty |= hasChanged;
            _isDirty |= hasTableChanged;

            if (_isDirty)
            {
                _isDirty = false;
                OnChanged();
            }
        }
Exemple #4
0
		public static ReadableColumnProxy FromColumn(IReadableColumn column)
		{
			if (null == column)
				throw new ArgumentNullException(nameof(column));
			var colAsDocumentNode = column as IDocumentLeafNode;
			if (null == colAsDocumentNode)
				throw new ArgumentException(string.Format("column does not implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));

			return new ReadableColumnProxy(colAsDocumentNode);
		}
Exemple #5
0
        public static ReadableColumnProxy FromColumn(IReadableColumn column)
        {
            if (null == column)
            {
                throw new ArgumentNullException(nameof(column));
            }
            var colAsDocumentNode = column as IDocumentLeafNode;

            if (null == colAsDocumentNode)
            {
                throw new ArgumentException(string.Format("column does not implement {0}. The actual type of column is {1}", typeof(IDocumentLeafNode), column.GetType()));
            }

            return(new ReadableColumnProxy(colAsDocumentNode));
        }