If you have
your set of control for visualization Olap data you can add some of Kropka Olap
control to you application and integrate them together.
Drag-and-Drop
integration
There are
info interfaces in Kropka.Data.Info
namespace (Kropka.Data assembly), which are designed to support Drag-and-Drop
operations.
These
interfaces are:
- ICubeInfo
- IDimensionInfo
- IHierarchyInfo
- IKpiGoalInfo
- IKpiInfo
- IKpiStatusInfo
- IKpiTrendInfo
- IKpiValueInfo
- ILevelInfo
- IMeasureGroupInfo
- IMeasureInfo
- IMeasureSetInfo
- IMeasuresInfo
- IMemberInfo
- ISetInfo
Most of
them have two properties:
- UniqueName
- the unique name of OLAP data or metadata item. For example, [Date].[Calendar].
- CubeName –
name of the cube (without brackets) which items belongs to. For example, Adventure Works).
Kropka Olap Components as
drop targets
Implement
one of the Kropka.Data.Info
interfaces in your class that will be the DataObject
in drag-and-drop operation.
using Kropka.Data.Info;
…
class MyDragedObject: IHierarchyInfo
{
...
string IOlapInfo.CubeName
{
get { return this.MyMethodToGetCubeName(); }
}
string IOlapInfo.UniqueName
{
get { return this.MyMethodToGetUniqueName(); }
}
}
Or create
simple class for drag-and-drop operation purpose.
class
DragedHierarchy: IHierarchyInfo
{
private
string cubeName = null;
private
string uniqueName = null;
public string CubeName
{
get
{ return this.cubeName;
}
set
{ this.cubeName = value;
}
}
public string UniqueName
{
get
{ return this.uniqueName;
}
set
{ this.uniqueName = value;
}
}
}
And add it
when you will initiates a drag-and-drop operation.
private void StartDragHierarchy()
{
DataObject
dataObject = new DataObject();
...
DragedHierarchy
dragedHierarchy = new DragedHierarchy();
dragedHierarchy.UniqueName = "[Date].[Calendar]";
dragedHierarchy.CubeName = "Adventure Works";
dataObject.SetData(typeof(Kropka.Data.Info.IOlapInfo), metadataNodeInfo);
...
this.MyControl.DoDragDrop(dataObject,
DragDropEffects.Copy);
}
Kropka Olap Components as
drag source
When you
handle drag-and-drop events in your control check whether the transferred data
is desired Kropka.Data.Info
interface.
protected override void
OnDragDrop(DragEventArgs drgevent)
{
if
(drgevent.Data.GetDataPresent(typeof(Kropka.Data.Info.IOlapInfo)))
{
Kropka.Data.Info.IOlapInfo olapInfo =
drgevent.Data.GetData(typeof(Kropka.Data.Info.IOlapInfo)) as Kropka.Data.Info.IOlapInfo;
if
(olapInfo is Kropka.Data.Info.IHierarchyInfo)
{
...
}
}
}