Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit c0929af

Browse files
BaseDataItem
1 parent f52b389 commit c0929af

8 files changed

Lines changed: 292 additions & 0 deletions

File tree

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
<Folder Include="src\Globals" />
8383
<Folder Include="src\DesignableItems" />
8484
<Folder Include="src\Factory" />
85+
<Folder Include="src\Dialogs" />
8586
<Folder Include="src\Wizard" />
8687
<Folder Include="src\Toolbox" />
8788
<Folder Include="src\TypeProvider" />
@@ -96,6 +97,7 @@
9697
<Compile Include="src\DesignableItems\BaseLineItem.cs" />
9798
<Compile Include="src\DesignableItems\BaseSection.cs" />
9899
<Compile Include="src\DesignableItems\BaseTextItem.cs" />
100+
<Compile Include="src\DesignableItems\BaseDataItem.cs" />
99101
<Compile Include="src\DesignableItems\ReportSettings.cs" />
100102
<Compile Include="src\DesignerBinding\DesignerBinding.cs" />
101103
<Compile Include="src\DesignerBinding\DesignerGenerator.cs" />
@@ -104,14 +106,17 @@
104106
<Compile Include="src\DesignerBinding\ReportDefinitionDeserializer.cs" />
105107
<Compile Include="src\DesignerBinding\ReportDesignerLoader.cs" />
106108
<Compile Include="src\Designer\AbstractDesigner.cs" />
109+
<Compile Include="src\Designer\DataItemDesigner.cs" />
107110
<Compile Include="src\Designer\LineDesigner.cs" />
108111
<Compile Include="src\Designer\ReportRootDesigner.cs" />
109112
<Compile Include="src\Designer\ReportSettingsDesigner.cs" />
110113
<Compile Include="src\Designer\RootReportModel.cs" />
111114
<Compile Include="src\Designer\SectionDesigner.cs" />
112115
<Compile Include="src\Designer\TextItemDesigner.cs" />
116+
<Compile Include="src\Dialogs\DataTypeStringConverter.cs" />
113117
<Compile Include="src\Factory\CreateFormSheetFromModel.cs" />
114118
<Compile Include="src\Globals\DesignerGlobals.cs" />
119+
<Compile Include="src\Globals\GlobalLists.cs" />
115120
<Compile Include="src\Globals\StringWriterWithEncoding.cs" />
116121
<Compile Include="src\Services\DefaultMemberRelationshipService.cs" />
117122
<Compile Include="src\Services\DesignerSerializationService.cs" />
@@ -126,6 +131,7 @@
126131
<Compile Include="src\Toolbox\SideTabItemDesigner.cs" />
127132
<Compile Include="src\Toolbox\ToolboxProvider.cs" />
128133
<Compile Include="src\TypeProvider\AbstractItemTypeProvider.cs" />
134+
<Compile Include="src\TypeProvider\DataItemTypeProvider.cs" />
129135
<Compile Include="src\TypeProvider\LineItemTypeProvider.cs" />
130136
<Compile Include="src\TypeProvider\SectionItemTypeProvider.cs" />
131137
<Compile Include="src\TypeProvider\TextItemTypeProvider.cs" />
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 04.04.2014
5+
* Time: 20:10
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel;
11+
using ICSharpCode.Reporting.Addin.Designer;
12+
using ICSharpCode.Reporting.Addin.TypeProvider;
13+
14+
namespace ICSharpCode.Reporting.Addin.DesignableItems
15+
{
16+
/// <summary>
17+
/// Description of Class1.
18+
/// </summary>
19+
///
20+
[Designer(typeof(DataItemDesigner))]
21+
public class BaseDataItem:BaseTextItem
22+
{
23+
const string datatypeOfTheUnderlyingColumn = "Datatype of the underlying Column";
24+
const string tableName = "TableName";
25+
const string showIfColumnvalueIsEmpty = "Show if Column is empty";
26+
27+
public BaseDataItem() {
28+
TypeDescriptor.AddProvider(new DataItemTypeProvider(), typeof(BaseDataItem));
29+
}
30+
31+
32+
[Category("Databinding"), Description(datatypeOfTheUnderlyingColumn)]
33+
public string ColumnName {get;set;}
34+
35+
36+
// [Category("Databinding"), Description(tableName)]
37+
// public string BaseTableName {get;set;}
38+
39+
[Category("Databinding"), Description(showIfColumnvalueIsEmpty)]
40+
public string NullValue {get;set;}
41+
}
42+
}

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseTextItem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public ContentAlignment ContentAlignment {
130130
}
131131
}
132132

133+
133134
#endregion
134135

135136
#region RighToLeft
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 04.04.2014
5+
* Time: 20:18
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel.Design;
11+
12+
namespace ICSharpCode.Reporting.Addin.Designer
13+
{
14+
/// <summary>
15+
/// Description of DataItemDesigner.
16+
/// </summary>
17+
public class DataItemDesigner:TextItemDesigner
18+
{
19+
public DataItemDesigner () {
20+
21+
}
22+
/*
23+
#region SmartTags
24+
25+
public override DesignerActionListCollection ActionLists {
26+
get {
27+
DesignerActionListCollection actions = new DesignerActionListCollection ();
28+
actions.Add (new TextBasedDesignerActionList(this.Component));
29+
30+
return actions;
31+
}
32+
}
33+
#endregion
34+
35+
36+
private void OnSelectionChanged(object sender, EventArgs e)
37+
{
38+
Control.Invalidate( );
39+
}
40+
41+
42+
43+
private void OnComponentRename(object sender,ComponentRenameEventArgs e) {
44+
if (e.Component == this.Component) {
45+
Control.Name = e.NewName;
46+
Control.Invalidate();
47+
}
48+
}
49+
50+
51+
private void GetService ()
52+
{
53+
selectionService = GetService(typeof(ISelectionService)) as ISelectionService;
54+
if (selectionService != null)
55+
{
56+
selectionService.SelectionChanged += OnSelectionChanged;
57+
}
58+
59+
componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
60+
if (componentChangeService != null) {
61+
componentChangeService.ComponentRename += new ComponentRenameEventHandler(OnComponentRename);
62+
}
63+
}
64+
*/
65+
}
66+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 04.04.2014
5+
* Time: 20:49
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel;
11+
using ICSharpCode.Reporting.Addin.Globals;
12+
13+
namespace ICSharpCode.Reporting.Addin.Dialogs
14+
{
15+
/// <summary>
16+
/// Description of DataTypeStringConverter.
17+
/// </summary>
18+
public class DataTypeStringConverter:StringConverter
19+
{
20+
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
21+
22+
{
23+
//true means show a combobox
24+
return true;
25+
}
26+
27+
28+
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
29+
30+
{
31+
//true will limit to list. false will show the list, but allow free-form entry
32+
return true;
33+
}
34+
35+
36+
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
37+
{
38+
return new StandardValuesCollection(GlobalLists.DataTypeList());
39+
40+
}
41+
}
42+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 04.04.2014
5+
* Time: 20:51
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
11+
namespace ICSharpCode.Reporting.Addin.Globals
12+
{
13+
/// <summary>
14+
/// Description of GlobalLists.
15+
/// </summary>
16+
static class GlobalLists
17+
{
18+
#region DataTypes
19+
20+
public static string[] DataTypeList ()
21+
{
22+
return (string[])dataTypeList.Clone();
23+
}
24+
25+
26+
static readonly string[] dataTypeList = {
27+
"System.String",
28+
"System.DateTime",
29+
"System.TimeSpan",
30+
"System.Decimal",
31+
"System.Int"};
32+
#endregion
33+
}
34+
}

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Toolbox/ToolboxProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ static SideTab CreateReportingSidetab ()
6262
};
6363
sideTab.Items.Add(new SideTabItemDesigner(toolboxItem));
6464

65+
66+
toolboxItem = new ToolboxItem(typeof(BaseDataItem)) {
67+
DisplayName = ResourceService.GetString("SharpReport.Toolbar.DataField"),
68+
// tb.Bitmap = WinFormsResourceService.GetBitmap("Icons.16x16.SharpQuery.Column");
69+
Bitmap = IconService.GetBitmap("Icons.16x16.SharpQuery.Column")
70+
};
71+
sideTab.Items.Add(new SideTabItemDesigner(toolboxItem));
72+
73+
6574
//Grahics
6675
// Line
6776
toolboxItem = new ToolboxItem(typeof(BaseLineItem)) {
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 04.04.2014
5+
* Time: 20:14
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.Collections.Generic;
11+
using System.ComponentModel;
12+
using ICSharpCode.Reporting.Addin.DesignableItems;
13+
14+
namespace ICSharpCode.Reporting.Addin.TypeProvider
15+
{
16+
/// <summary>
17+
/// Description of DataItemTypeProvider.
18+
/// </summary>
19+
class DataItemTypeProvider : TypeDescriptionProvider
20+
{
21+
22+
public DataItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem)))
23+
{
24+
}
25+
26+
27+
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
28+
{
29+
ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance);
30+
return new DataItemTypeDescriptor(td, instance);
31+
}
32+
}
33+
34+
35+
36+
class DataItemTypeDescriptor : CustomTypeDescriptor
37+
{
38+
39+
public DataItemTypeDescriptor(ICustomTypeDescriptor parent, object instance)
40+
: base(parent)
41+
{
42+
}
43+
44+
45+
public override PropertyDescriptorCollection GetProperties()
46+
{
47+
return GetProperties(null);
48+
}
49+
50+
51+
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
52+
{
53+
PropertyDescriptorCollection props = base.GetProperties(attributes);
54+
List<PropertyDescriptor> allProperties = new List<PropertyDescriptor>();
55+
56+
TypeProviderHelper.AddDefaultProperties(allProperties,props);
57+
TypeProviderHelper.AddTextBasedProperties(allProperties,props);
58+
59+
PropertyDescriptor prop = props.Find("Text",true);
60+
allProperties.Add(prop);
61+
62+
prop = props.Find("DrawBorder",true);
63+
allProperties.Add(prop);
64+
65+
prop = props.Find("FrameColor",true);
66+
allProperties.Add(prop);
67+
68+
prop = props.Find("ForeColor",true);
69+
allProperties.Add(prop);
70+
71+
prop = props.Find("Visible",true);
72+
allProperties.Add(prop);
73+
74+
prop = props.Find("ColumnName",true);
75+
allProperties.Add(prop);
76+
77+
// prop = props.Find("BaseTableName",true);
78+
// allProperties.Add(prop);
79+
80+
// prop = props.Find("DbValue",true);
81+
// allProperties.Add(prop);
82+
83+
prop = props.Find("NullValue",true);
84+
allProperties.Add(prop);
85+
86+
// prop = props.Find("Expression",true);
87+
// allProperties.Add(prop);
88+
89+
return new PropertyDescriptorCollection(allProperties.ToArray());
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)