コード例 #1
0
        public string GetDescription(DataSchema dataSchema)
        {
            var parts = new List <string>();

            if (RowHeaders.Any())
            {
                parts.Add(Resources.PivotSpec_GetDescription_Row_Headers_);
                parts.AddRange(RowHeaders.Select(header => header.Caption ?? header.SourceColumn.ToString()));
            }
            if (ColumnHeaders.Any())
            {
                if (parts.Any())
                {
                    parts.Add(string.Empty);
                }
                parts.Add(Resources.PivotSpec_GetDescription_Column_Headers_);
                parts.AddRange(ColumnHeaders.Select(header => header.Caption ?? header.SourceColumn.ToString()));
            }
            if (Values.Any())
            {
                if (parts.Any())
                {
                    parts.Add(string.Empty);
                }
                parts.Add(Resources.PivotSpec_GetDescription_Values_);
                parts.AddRange(Values.Select(value =>
                                             (ColumnCaption.ExplicitCaption(value.Caption) ??
                                              value.AggregateOperation.QualifyColumnCaption(value.SourceColumn.ToColumnCaption()))
                                             .GetCaption(dataSchema.DataSchemaLocalizer)));
            }
            return(string.Join(Environment.NewLine, parts));
        }
コード例 #2
0
        public string GetUndoText(DataSchemaLocalizer dataSchemaLocalizer)
        {
            string fullMessage = string.Format(Resources.EditDescription_GetUndoText_Set__0__to___1__,
                                               ColumnCaption.GetCaption(dataSchemaLocalizer), Value);

            return(TruncateLongMessage(fullMessage));
        }
コード例 #3
0
ファイル: PivotEditor.cs プロジェクト: laeubisoft/pwiz
        private ListViewItem MakeListItem(PivotSpec.Column column, Func <IColumnCaption, IColumnCaption> captionMaker)
        {
            var pd           = FindPropertyDescriptor(column.SourceColumn);
            var listViewItem = new ListViewItem();

            if (column.Caption != null)
            {
                listViewItem.Text = column.Caption;
                listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold | listViewItem.Font.Style);
            }
            else if (pd != null)
            {
                listViewItem.Text = captionMaker(ColumnCaption.GetColumnCaption(pd)).GetCaption(DataSchemaLocalizer);
            }
            else
            {
                listViewItem.Text = captionMaker(ColumnCaption.UnlocalizableCaption(column.SourceColumn.ToString())).GetCaption(DataSchemaLocalizer);
            }
            if (pd == null)
            {
                listViewItem.Font        = new Font(listViewItem.Font, FontStyle.Strikeout);
                listViewItem.ToolTipText = string.Format(Resources.PivotEditor_MakeListItem_Unable_to_find_column___0___,
                                                         column.SourceColumn);
            }
            return(listViewItem);
        }
コード例 #4
0
        public ColumnCaption[] GetHeaderColumnCaptions(string[] periods, Guid periodTypeId)
        {
            EntitySchemaQuery    periodEsq           = GetForecastPeriodSelectQuery(periods, periodTypeId);
            EntityCollection     periodCollection    = periodEsq.GetEntityCollection(_userConnection);
            EntitySchemaQuery    indicatorEsq        = GetForecastIndicatorSelectQuery();
            EntityCollection     indicatorCollection = indicatorEsq.GetEntityCollection(_userConnection);
            List <ColumnCaption> columnCaptions      = new List <ColumnCaption>();

            foreach (Entity periodValue in periodCollection)
            {
                Guid periodId = GetEntityPrimaryColumnValue(periodValue);
                foreach (Entity indicatorValue in indicatorCollection)
                {
                    string        indicatorCode = (string)indicatorValue.GetColumnValue("Code");
                    ColumnCaption columnCaption = new ColumnCaption()
                    {
                        PeriodId      = periodId,
                        PeriodName    = (string)periodValue.GetColumnValue("Name"),
                        IndicatorName = (string)indicatorValue.GetColumnValue("Name"),
                        IndicatorCode = indicatorCode,
                        ColumnName    = indicatorCode + periodId
                    };
                    columnCaptions.Add(columnCaption);
                }
            }
            return(columnCaptions.ToArray());
        }
コード例 #5
0
ファイル: SkylineDataSchema.cs プロジェクト: joey10086/pwiz
 public override IColumnCaption GetInvariantDisplayName(string uiMode, Type type)
 {
     if (typeof(ListItem).IsAssignableFrom(type))
     {
         return(ColumnCaption.UnlocalizableCaption(ListItemTypes.INSTANCE.GetListName(type)));
     }
     return(base.GetInvariantDisplayName(uiMode, type));
 }
コード例 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (ColumnCaption != null ? ColumnCaption.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Predicate.GetHashCode();
         return(hashCode);
     }
 }
コード例 #7
0
ファイル: RowFilter.cs プロジェクト: suchp-max/proteowizard
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (ColumnCaption != null ? ColumnCaption.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FilterOperation != null ? FilterOperation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Operand != null ? Operand.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #8
0
        private ListViewItem MakeListViewColumnItem(DisplayColumn displayColumn)
        {
            string listItemText = displayColumn.GetColumnCaption(null, ColumnCaptionType.localized);

            var listViewItem = new ListViewItem {
                Text = listItemText
            };

            Debug.Assert(!displayColumn.ColumnSpec.Hidden);
            if (!string.IsNullOrEmpty(displayColumn.ColumnSpec.Caption))
            {
                listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold | listViewItem.Font.Style);
                DataSchema    dataSchema    = displayColumn.DataSchema;
                ColumnCaption columnCaption = dataSchema.GetColumnCaption(displayColumn.ColumnDescriptor);
                listViewItem.ToolTipText = dataSchema.GetLocalizedColumnCaption(columnCaption);
            }
            return(listViewItem);
        }
コード例 #9
0
ファイル: GroupAndTotaler.cs プロジェクト: zrolfs/pwiz
        public GroupAndTotaler(CancellationToken cancellationToken, DataSchema dataSchema, PivotSpec pivotSpec, IEnumerable <DataPropertyDescriptor> itemProperties)
        {
            CancellationToken = cancellationToken;
            DataSchema        = dataSchema;
            var columnsByDisplayName = itemProperties.ToLookup(ColumnId.GetColumnId);

            RowHeaders = ImmutableList.ValueOf(pivotSpec.RowHeaders.SelectMany(
                                                   col => columnsByDisplayName[col.SourceColumn]
                                                   .Select(pd => Tuple.Create(pd, ColumnCaption.ExplicitCaption(col.Caption) ?? ColumnCaption.GetColumnCaption(pd)))));
            ColumnHeaders = ImmutableList.ValueOf(pivotSpec.ColumnHeaders.SelectMany(
                                                      col => columnsByDisplayName[col.SourceColumn]));
            AggregateColumns = ImmutableList.ValueOf(pivotSpec.Values.SelectMany(
                                                         col => columnsByDisplayName[col.SourceColumn]
                                                         .Select(pd => Tuple.Create(pd,
                                                                                    ColumnCaption.ExplicitCaption(col.Caption) ??
                                                                                    col.AggregateOperation.QualifyColumnCaption(ColumnCaption.GetColumnCaption(pd)),
                                                                                    col.AggregateOperation))));
        }
コード例 #10
0
 /// <summary>
 /// Returns an EditDescription corresponding to setting an annotation to a particular value.
 /// </summary>
 public static EditDescription SetAnnotation(AnnotationDef annotationDef, object value)
 {
     return(new EditDescription(ColumnCaption.UnlocalizableCaption(annotationDef.Name), value));
 }
コード例 #11
0
 public EditDescription(ColumnCaption columnCaption, object value)
 {
     ColumnCaption = columnCaption;
     Value         = value;
 }