Skip to content

Commit

Permalink
Fix issue #498
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Otykier committed Jun 19, 2020
1 parent f0f4dfb commit 4cb0e50
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 6 deletions.
282 changes: 282 additions & 0 deletions TOMWrapper/PropertyGridUI/Converters/ColumnDataCategoryConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TabularEditor.PropertyGridUI.Converters
{
internal class ColumnDataCategoryConverter: StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}

public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return false;
}

private static readonly string[] categories = Enum.GetNames(typeof(ColumnDataCategory)).OrderBy(s => s).ToArray();

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(categories);
}
}

public enum ColumnDataCategory
{
Invalid = -1,
All = 1,
Regular = 2,
Image = 3,
ImageBMP = 4,
ImageGIF = 5,
ImageJPG = 6,
ImagePNG = 7,
ImageTIFF = 8,
ImageURL = 9,
Id = 10,
RelationToParent = 11,
Sequence = 12,
OrgTitle = 13,
Caption = 14,
ShortCaption = 15,
CaptionDescription = 16,
CaptionAbbreviation = 17,
WebURL = 18,
WebHTML = 19,
WebXMLOrXSL = 20,
WebmailAlias = 21,
Address = 22,
AddressStreet = 23,
AddressHouse = 24,
AddressCity = 25,
AddressStateOrProvince = 26,
AddressZIP = 27,
AddressQuarter = 28,
AddressCountry = 29,
AddressBuilding = 30,
AddressRoom = 31,
AddressFloor = 32,
AddressFax = 33,
AddressPhone = 34,
GeoCentroidX = 35,
GeoCentroidY = 36,
GeoCentroidZ = 37,
GeoBoundaryTop = 38,
GeoBoundaryLeft = 39,
GeoBoundaryBottom = 40,
GeoBoundaryRight = 41,
GeoBoundaryFront = 42,
GeoBoundaryRear = 43,
GeoBoundaryPolygon = 44,
PhysicalSize = 45,
PhysicalColor = 46,
PhysicalWeight = 47,
PhysicalHeight = 48,
PhysicalWidth = 49,
PhysicalDepth = 50,
PhysicalVolume = 51,
PhysicalDensity = 52,
PersonFullName = 53,
PersonFirstName = 54,
PersonLastName = 55,
PersonMiddleName = 56,
PersonDemographic = 57,
PersonContact = 58,
QtyRangeLow = 59,
QtyRangeHigh = 60,
FormattingColor = 61,
FormattingOrder = 62,
FormattingFont = 63,
FormattingFontEffects = 64,
FormattingFontSize = 65,
FormattingSubtotal = 66,
Date = 67,
DateStart = 68,
DateEnded = 69,
DateCanceled = 70,
DateModified = 71,
DateDuration = 72,
Version = 73,
Years = 74,
Quarters = 75,
Months = 76,
Weeks = 77,
Days = 78,
Hours = 79,
Minutes = 80,
Seconds = 81,
UndefinedTime = 82,
OrganizationalUnit = 83,
BomResource = 84,
Quantitative = 85,
Account = 86,
Customers = 87,
CustomerGroup = 88,
CustomerHousehold = 89,
Product = 90,
ProductGroup = 91,
Scenario = 92,
Utility = 93,
Person = 94,
Company = 95,
CurrencySource = 96,
CurrencyDestination = 97,
Channel = 98,
Representative = 99,
Promotion = 100,
Continent = 101,
Region = 102,
Country = 103,
StateOrProvince = 104,
County = 105,
City = 106,
PostalCode = 107,
Point = 108,
AccountType = 109,
AccountName = 110,
AccountNumber = 111,
ProjectName = 112,
ProjectCode = 113,
ProjectStartDate = 114,
ProjectEndDate = 115,
ProjectCompletion = 116,
CurrencyName = 117,
CurrencyIsOCode = 118,
PercentOwnership = 119,
PercentVoteright = 120,
Project = 121,
RateType = 122,
Rate = 123,
ProductSKU = 124,
ProductCategory = 125,
ProductBrand = 126,
DeletedFlag = 127,
ScdStatus = 128,
ScdEndDate = 129,
ScdOriginalID = 130,
ScdStartDate = 131,
DayOfMonthOrPeriod = 132,
WeekOfQuarter = 133,
WeekOfMonthOrPeriod = 134,
MonthOrPeriodOfQuarter = 135,
MonthOrPeriodOfYear = 136,
Trimesters = 137,
Halfyears = 138,
Tendays = 139,
DayOfWeek = 140,
DayOfTendays = 141,
DayOfMonth = 142,
DayOfQuarter = 143,
DayOfTrimester = 144,
DayOfHalfyear = 145,
DayOfYear = 146,
WeekOfYear = 147,
TendayOfMonth = 148,
TendayOfQuarter = 149,
TendayOfTrimester = 150,
TendayOfHalfyear = 151,
TendayOfYear = 152,
MonthOfTrimester = 153,
MonthOfQuarter = 154,
MonthOfHalfyear = 155,
MonthOfYear = 156,
TrimesterOfYear = 157,
QuarterOfHalfyear = 158,
QuarterOfYear = 159,
HalfyearOfYear = 160,
FiscalDate = 161,
FiscalDayOfWeek = 162,
FiscalDayOfMonth = 163,
FiscalDayOfQuarter = 164,
FiscalDayOfTrimester = 165,
FiscalDayOfHalfyear = 166,
FiscalDayOfYear = 167,
FiscalWeeks = 168,
FiscalWeekOfYear = 169,
FiscalWeekOfHalfyear = 170,
FiscalWeekOfQuarter = 171,
FiscalWeekOfTrimester = 172,
FiscalWeekOfMonth = 173,
FiscalMonths = 174,
FiscalMonthOfTrimester = 175,
FiscalMonthOfQuarter = 176,
FiscalMonthOfHalfyear = 177,
FiscalMonthOfYear = 178,
FiscalTrimesters = 179,
FiscalTrimesterOfYear = 180,
FiscalQuarters = 181,
FiscalQuarterOfYear = 182,
FiscalQuarterOfHalfyear = 183,
FiscalHalfyears = 184,
FiscalHalfyearOfYear = 185,
FiscalYears = 186,
ReportingDate = 187,
ReportingDayOfWeek = 188,
ReportingDayOfMonth = 189,
ReportingDayOfQuarter = 190,
ReportingDayOfTrimester = 191,
ReportingDayOfHalfyear = 192,
ReportingDayOfYear = 193,
ReportingWeeks = 194,
ReportingWeekOfYear = 195,
ReportingWeekOfHalfyear = 196,
ReportingWeekOfQuarter = 197,
ReportingWeekOfTrimester = 198,
ReportingWeekOfMonth = 199,
ReportingMonths = 200,
ReportingMonthOfTrimester = 201,
ReportingMonthOfQuarter = 202,
ReportingMonthOfHalfyear = 203,
ReportingMonthOfYear = 204,
ReportingTrimesters = 205,
ReportingTrimesterOfYear = 206,
ReportingQuarters = 207,
ReportingQuarterOfYear = 208,
ReportingQuarterOfHalfyear = 209,
ReportingHalfyears = 210,
ReportingHalfyearOfYear = 211,
ReportingYears = 212,
ManufacturingDate = 213,
ManufacturingDayOfWeek = 214,
ManufacturingDayOfMonth = 215,
ManufacturingDayOfQuarter = 216,
ManufacturingDayOfHalfyear = 217,
ManufacturingDayOfYear = 218,
ManufacturingWeeks = 219,
ManufacturingWeekOfYear = 220,
ManufacturingWeekOfHalfyear = 221,
ManufacturingWeekOfQuarter = 222,
ManufacturingWeekOfMonth = 223,
ManufacturingMonths = 224,
ManufacturingMonthOfQuarter = 225,
ManufacturingMonthOfHalfyear = 226,
ManufacturingMonthOfYear = 227,
ManufacturingTrimesters = 228,
ManufacturingTrimesterOfYear = 229,
ManufacturingQuarters = 230,
ManufacturingQuarterOfYear = 231,
ManufacturingQuarterOfHalfyear = 232,
ManufacturingHalfyears = 233,
ManufacturingHalfyearOfYear = 234,
ManufacturingYears = 235,
WinterSummerSeason = 236,
IsHoliday = 237,
IsWeekday = 238,
IsWorkingDay = 239,
IsPeakDay = 240,
ISO8601Date = 241,
ISO8601DayOfWeek = 242,
ISO8601DayOfYear = 243,
ISO8601Weeks = 244,
ISO8601WeekOfYear = 245,
ISO8601Years = 246,
RowNumber = 247,
ExtendedType = 248
}
}
48 changes: 48 additions & 0 deletions TOMWrapper/PropertyGridUI/Converters/TableDataCategoryConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TabularEditor.PropertyGridUI.Converters
{
internal class TableDataCategoryConverter: StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}

public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return false;
}

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(Enum.GetNames(typeof(TableDataCategory)));
}
}


public enum TableDataCategory
{
Unknown = 0,
Regular = 1,
Time = 2,
Geography = 3,
Organization = 4,
BillOfMaterials = 5,
Accounts = 6,
Customers = 7,
Products = 8,
Scenario = 9,
Quantitative = 10,
Utility = 11,
Currency = 12,
Rates = 13,
Channel = 14,
Promotion = 15
}
}
2 changes: 2 additions & 0 deletions TOMWrapper/TOMWrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
<Compile Include="PropertyGridUI\CollectionEditors\SetCollectionEditor.cs" />
<Compile Include="PropertyGridUI\CollectionEditors\CalculationItemCollectionEditor.cs" />
<Compile Include="PropertyGridUI\CollectionEditors\ColumnSetCollectionEditor.cs" />
<Compile Include="PropertyGridUI\Converters\ColumnDataCategoryConverter.cs" />
<Compile Include="PropertyGridUI\Converters\TableDataCategoryConverter.cs" />
<Compile Include="TOMWrapper\CalculationGroupAttribute.cs" />
<Compile Include="PropertyGridUI\CollectionEditors\ExtendedPropertyCollectionEditor.cs" />
<Compile Include="PropertyGridUI\CollectionEditors\RoleMemberCollectionEditor.cs" />
Expand Down
3 changes: 3 additions & 0 deletions TOMWrapper/TOMWrapper/Base/Rules.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ partial class Rules {
if(propertyName == "ColumnOrigin") return "[Browsable(false)]";
if(propertyName == "IsSimpleMeasure") return "[Browsable(false)]";

if(propertyName == "DataCategory" && className == "Table") return "[TypeConverter(typeof(TableDataCategoryConverter))]";
if(propertyName == "DataCategory" && className.EndsWith("Column")) return "[TypeConverter(typeof(ColumnDataCategoryConverter))]";

if(propertyName == "Password") return "[PasswordPropertyText(true)]";

if(propertyName == "StatusGraphic") return "[TypeConverter(typeof(KPIStatusGraphicConverter))]";
Expand Down
8 changes: 4 additions & 4 deletions TOMWrapper/TOMWrapper/Base/WrapperBase.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using System.Collections.Generic;
using System.ComponentModel;
using TabularEditor.PropertyGridUI;
using TabularEditor.PropertyGridUI.Converters;
using TabularEditor.TOMWrapper.Undo;
using TabularEditor.TOMWrapper.Utils;
using TabularEditor.TOMWrapper.PowerBI;
using System.Drawing.Design;
using TOM = Microsoft.AnalysisServices.Tabular;

namespace TabularEditor.TOMWrapper
{
internal static partial class Properties
Expand Down Expand Up @@ -1991,7 +1991,7 @@ internal new TOM.Column MetadataObject
/// Specifies the type of data contained in the column so that you can add custom behaviors based on column type. There are 248 possible values. The first ten are Invalid (-1), All (1), Regular (2), Image (3), ImageBMP (4), ImageGIF (5), ImageJPG (6), ImagePNG (7), ImageTIFF (8), ImageURL (9), Id (10). For the rest, please refer to the MS-SSAS-T SQL Server Analysis Services Tabular Protocol documentation on MSDN.
/// </summary>
[DisplayName("Data Category")]
[Category("Options"),Description(@"Specifies the type of data contained in the column so that you can add custom behaviors based on column type. There are 248 possible values. The first ten are Invalid (-1), All (1), Regular (2), Image (3), ImageBMP (4), ImageGIF (5), ImageJPG (6), ImagePNG (7), ImageTIFF (8), ImageURL (9), Id (10). For the rest, please refer to the MS-SSAS-T SQL Server Analysis Services Tabular Protocol documentation on MSDN."),IntelliSense(@"Specifies the type of data contained in the column so that you can add custom behaviors based on column type. There are 248 possible values. The first ten are Invalid (-1), All (1), Regular (2), Image (3), ImageBMP (4), ImageGIF (5), ImageJPG (6), ImagePNG (7), ImageTIFF (8), ImageURL (9), Id (10). For the rest, please refer to the MS-SSAS-T SQL Server Analysis Services Tabular Protocol documentation on MSDN.")]
[Category("Options"),Description(@"Specifies the type of data contained in the column so that you can add custom behaviors based on column type. There are 248 possible values. The first ten are Invalid (-1), All (1), Regular (2), Image (3), ImageBMP (4), ImageGIF (5), ImageJPG (6), ImagePNG (7), ImageTIFF (8), ImageURL (9), Id (10). For the rest, please refer to the MS-SSAS-T SQL Server Analysis Services Tabular Protocol documentation on MSDN."),IntelliSense(@"Specifies the type of data contained in the column so that you can add custom behaviors based on column type. There are 248 possible values. The first ten are Invalid (-1), All (1), Regular (2), Image (3), ImageBMP (4), ImageGIF (5), ImageJPG (6), ImagePNG (7), ImageTIFF (8), ImageURL (9), Id (10). For the rest, please refer to the MS-SSAS-T SQL Server Analysis Services Tabular Protocol documentation on MSDN.")][TypeConverter(typeof(ColumnDataCategoryConverter))]
public string DataCategory {
get {
return MetadataObject.DataCategory;
Expand Down Expand Up @@ -11888,7 +11888,7 @@ internal new TOM.Table MetadataObject
/// Specifies the type of Table so that you can customize application behavior based on the type of data in the table. Allowed values are identical to those of dimension type properties for Multidimensional models. Regular is the default. Other values include Time (2), Geography (3), Organization (4), BillOfMaterials (5), Accounts (6), Customers (7), Products (8), Scenario (9), Quantitativ1e (10), Utility (11), Currency (12), Rates (13), Channel (14) - channel dimension, Promotion (15).
/// </summary>
[DisplayName("Data Category")]
[Category("Options"),Description(@"Specifies the type of Table so that you can customize application behavior based on the type of data in the table. Allowed values are identical to those of dimension type properties for Multidimensional models. Regular is the default. Other values include Time (2), Geography (3), Organization (4), BillOfMaterials (5), Accounts (6), Customers (7), Products (8), Scenario (9), Quantitativ1e (10), Utility (11), Currency (12), Rates (13), Channel (14) - channel dimension, Promotion (15)."),IntelliSense(@"Specifies the type of Table so that you can customize application behavior based on the type of data in the table. Allowed values are identical to those of dimension type properties for Multidimensional models. Regular is the default. Other values include Time (2), Geography (3), Organization (4), BillOfMaterials (5), Accounts (6), Customers (7), Products (8), Scenario (9), Quantitativ1e (10), Utility (11), Currency (12), Rates (13), Channel (14) - channel dimension, Promotion (15).")]
[Category("Options"),Description(@"Specifies the type of Table so that you can customize application behavior based on the type of data in the table. Allowed values are identical to those of dimension type properties for Multidimensional models. Regular is the default. Other values include Time (2), Geography (3), Organization (4), BillOfMaterials (5), Accounts (6), Customers (7), Products (8), Scenario (9), Quantitativ1e (10), Utility (11), Currency (12), Rates (13), Channel (14) - channel dimension, Promotion (15)."),IntelliSense(@"Specifies the type of Table so that you can customize application behavior based on the type of data in the table. Allowed values are identical to those of dimension type properties for Multidimensional models. Regular is the default. Other values include Time (2), Geography (3), Organization (4), BillOfMaterials (5), Accounts (6), Customers (7), Products (8), Scenario (9), Quantitativ1e (10), Utility (11), Currency (12), Rates (13), Channel (14) - channel dimension, Promotion (15).")][TypeConverter(typeof(TableDataCategoryConverter))]
public string DataCategory {
get {
return MetadataObject.DataCategory;
Expand Down
4 changes: 2 additions & 2 deletions TOMWrapper/TOMWrapper/Base/WrapperBase.tt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using TabularEditor.PropertyGridUI;
using TabularEditor.PropertyGridUI.Converters;
using TabularEditor.TOMWrapper.Undo;
using TabularEditor.TOMWrapper.Utils;
using TabularEditor.TOMWrapper.PowerBI;
using System.Drawing.Design;
using TOM = Microsoft.AnalysisServices.Tabular;

namespace TabularEditor.TOMWrapper
{
<#
Expand Down

0 comments on commit 4cb0e50

Please sign in to comment.