8 changed files with 292 additions and 0 deletions
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 04.04.2014 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
using ICSharpCode.Reporting.Addin.Designer; |
||||
using ICSharpCode.Reporting.Addin.TypeProvider; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.DesignableItems |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Class1.
|
||||
/// </summary>
|
||||
///
|
||||
[Designer(typeof(DataItemDesigner))] |
||||
public class BaseDataItem:BaseTextItem |
||||
{ |
||||
const string datatypeOfTheUnderlyingColumn = "Datatype of the underlying Column"; |
||||
const string tableName = "TableName"; |
||||
const string showIfColumnvalueIsEmpty = "Show if Column is empty"; |
||||
|
||||
public BaseDataItem() { |
||||
TypeDescriptor.AddProvider(new DataItemTypeProvider(), typeof(BaseDataItem)); |
||||
} |
||||
|
||||
|
||||
[Category("Databinding"), Description(datatypeOfTheUnderlyingColumn)] |
||||
public string ColumnName {get;set;} |
||||
|
||||
|
||||
// [Category("Databinding"), Description(tableName)]
|
||||
// public string BaseTableName {get;set;}
|
||||
|
||||
[Category("Databinding"), Description(showIfColumnvalueIsEmpty)] |
||||
public string NullValue {get;set;} |
||||
} |
||||
} |
||||
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 04.04.2014 |
||||
* Time: 20:18 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel.Design; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.Designer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataItemDesigner.
|
||||
/// </summary>
|
||||
public class DataItemDesigner:TextItemDesigner |
||||
{ |
||||
public DataItemDesigner () { |
||||
|
||||
} |
||||
/* |
||||
#region SmartTags
|
||||
|
||||
public override DesignerActionListCollection ActionLists { |
||||
get { |
||||
DesignerActionListCollection actions = new DesignerActionListCollection (); |
||||
actions.Add (new TextBasedDesignerActionList(this.Component)); |
||||
|
||||
return actions; |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
private void OnSelectionChanged(object sender, EventArgs e) |
||||
{ |
||||
Control.Invalidate( ); |
||||
} |
||||
|
||||
|
||||
|
||||
private void OnComponentRename(object sender,ComponentRenameEventArgs e) { |
||||
if (e.Component == this.Component) { |
||||
Control.Name = e.NewName; |
||||
Control.Invalidate(); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void GetService () |
||||
{ |
||||
selectionService = GetService(typeof(ISelectionService)) as ISelectionService; |
||||
if (selectionService != null) |
||||
{ |
||||
selectionService.SelectionChanged += OnSelectionChanged; |
||||
} |
||||
|
||||
componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); |
||||
if (componentChangeService != null) { |
||||
componentChangeService.ComponentRename += new ComponentRenameEventHandler(OnComponentRename); |
||||
} |
||||
} |
||||
*/ |
||||
} |
||||
} |
||||
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 04.04.2014 |
||||
* Time: 20:49 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
using ICSharpCode.Reporting.Addin.Globals; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.Dialogs |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataTypeStringConverter.
|
||||
/// </summary>
|
||||
public class DataTypeStringConverter:StringConverter |
||||
{ |
||||
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) |
||||
|
||||
{ |
||||
//true means show a combobox
|
||||
return true; |
||||
} |
||||
|
||||
|
||||
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) |
||||
|
||||
{ |
||||
//true will limit to list. false will show the list, but allow free-form entry
|
||||
return true; |
||||
} |
||||
|
||||
|
||||
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) |
||||
{ |
||||
return new StandardValuesCollection(GlobalLists.DataTypeList()); |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 04.04.2014 |
||||
* Time: 20:51 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GlobalLists.
|
||||
/// </summary>
|
||||
static class GlobalLists |
||||
{ |
||||
#region DataTypes
|
||||
|
||||
public static string[] DataTypeList () |
||||
{ |
||||
return (string[])dataTypeList.Clone(); |
||||
} |
||||
|
||||
|
||||
static readonly string[] dataTypeList = { |
||||
"System.String", |
||||
"System.DateTime", |
||||
"System.TimeSpan", |
||||
"System.Decimal", |
||||
"System.Int"}; |
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 04.04.2014 |
||||
* Time: 20:14 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using ICSharpCode.Reporting.Addin.DesignableItems; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.TypeProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataItemTypeProvider.
|
||||
/// </summary>
|
||||
class DataItemTypeProvider : TypeDescriptionProvider |
||||
{ |
||||
|
||||
public DataItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem))) |
||||
{ |
||||
} |
||||
|
||||
|
||||
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) |
||||
{ |
||||
ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); |
||||
return new DataItemTypeDescriptor(td, instance); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
class DataItemTypeDescriptor : CustomTypeDescriptor |
||||
{ |
||||
|
||||
public DataItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) |
||||
: base(parent) |
||||
{ |
||||
} |
||||
|
||||
|
||||
public override PropertyDescriptorCollection GetProperties() |
||||
{ |
||||
return GetProperties(null); |
||||
} |
||||
|
||||
|
||||
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) |
||||
{ |
||||
PropertyDescriptorCollection props = base.GetProperties(attributes); |
||||
List<PropertyDescriptor> allProperties = new List<PropertyDescriptor>(); |
||||
|
||||
TypeProviderHelper.AddDefaultProperties(allProperties,props); |
||||
TypeProviderHelper.AddTextBasedProperties(allProperties,props); |
||||
|
||||
PropertyDescriptor prop = props.Find("Text",true); |
||||
allProperties.Add(prop); |
||||
|
||||
prop = props.Find("DrawBorder",true); |
||||
allProperties.Add(prop); |
||||
|
||||
prop = props.Find("FrameColor",true); |
||||
allProperties.Add(prop); |
||||
|
||||
prop = props.Find("ForeColor",true); |
||||
allProperties.Add(prop); |
||||
|
||||
prop = props.Find("Visible",true); |
||||
allProperties.Add(prop); |
||||
|
||||
prop = props.Find("ColumnName",true); |
||||
allProperties.Add(prop); |
||||
|
||||
// prop = props.Find("BaseTableName",true);
|
||||
// allProperties.Add(prop);
|
||||
|
||||
// prop = props.Find("DbValue",true);
|
||||
// allProperties.Add(prop);
|
||||
|
||||
prop = props.Find("NullValue",true); |
||||
allProperties.Add(prop); |
||||
|
||||
// prop = props.Find("Expression",true);
|
||||
// allProperties.Add(prop);
|
||||
|
||||
return new PropertyDescriptorCollection(allProperties.ToArray()); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue