Profile Picture

Database Table Shapes and Mapping

Posted By Montford Chelliah 14 Years Ago
Author
Message
Pavel Vladov
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 33, Visits: 2
Hi Montford,
if the document after loading is null this means that the drawing document was not loaded successfully. Take a look at the trace in debug mode to see what causes the problem. You can also try saving in XML or Custom XML format.

Best Regards,
Pavel Vladov

Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi Pavel,

Thanks for the reply. I could manage to solve the problem. I have manually registered the event at the load method now the event is raising.

I am facing a problem to save and loading the Nevron diagram. here is my implementation.

Saving Procedure

string fileFullPath = "C:\Test\f6ece328-8157-412c-9c41-95aade80c1fe.ndb"

NPersistencyManager persistManager = new NPersistencyManager();

persistManager.SaveDrawingToFile(document, fileFullPath);

Loading Procedure

string filePath = "C:\Test\f6ece328-8157-412c-9c41-95aade80c1fe.ndb"

NPersistencyManager persistencyManager = new NPersistencyManager();

NDrawingDocument tempDocument = persistencyManager.LoadDrawingFromFile(filePath);   

if (tempDocument != null) {

    view.Document = tempDocument;

    this.document = tempDocument;

}

Code is running without exception, but the object "tempDocument " is getting null value when I load the diagram (which is highlighted with green). I checked the file in the file system, the file is there. What could be the reason?

Thanks

Best Regards

Montford Anslum



Pavel Vladov
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 33, Visits: 2
Hi Montford,
I'm not familiar with the Microsoft Smart Client Factory and as it has nothing to do with our components I cannot provide any support for it. Please, explain in more details only the problem that you have with our component and I'll help you solve it.

Best Regards,
Pavel Vladov



Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi Pavel,

I am using Microsoft Smart Client Software Factory. I have different work spaces. One workspace I am loading by tree with tables nodes (one user control) and the other workspace I am loading Nevron drawing view (another user control) dynamically.

I have a requirement to validate the mapping between NTableShape shapes when using connectors. I am using NDrawingView's NodeSelecting event for validating the items are selected. Unfortunately this event is not raising when I select any of shapes in NDrawingView object.

Same validation I have done without using the Microsoft Smart Client Software Factory (put everything on a single Win Form object) then the NodeSelecting event is raising successfully.

Please give me your thoughts.

Thanks

Regards

Montford Anslum

 

 



Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi Pavel,

Thanks so much for the help and direction. I am going to add more functionality on that code. If I face any problem I will send you the details on the this thread.

Thanks

Regards

Montford Anslum



Pavel Vladov
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 33, Visits: 2
Hi Montford,

I've examined your code and I've attached the working solution. Some important thigs I would like to bring to your attention are:

1. When you are setting the content of table shapes use the BeginUpdate and EndUpdate method of the table shape. This will greatly improve the performance. Take a look at this topic for more information.

2. To find out the relations all you have to do is to loop through the 1D shapes of the document's active layer. For example:

    NNodeList links = document.ActiveLayer.Children(NFilters.Shape1D);
    int linkCount = links.Count;
    for (int i = 0; i < linkCount; i++)
    {
        NBezierCurveShape link = links[i] as NBezierCurveShape;
        if (link != null)
        {
            // Display a meassage for the current relation
            DisplayMessage(link);
        }
    }

3. Please, take advantage of the Name property of the NShape class and set the table names to this property, so that you can easily retrieve it later. This eliminates the need to use dictionaries in your data object adapter class.

If you have any other questions, I'll be glad to help.

Best Regards,
Pavel

Attachments
TestForm.cs (178 views, 11.00 KB)
Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi Pavel,

Thanks for the idea, I have tried with NTableShape object and the sample is attached herewith. Using NTableShape object I am facing a problem to identify the mappings ports and plugs. Please review my sample and identify the fault.

Thanks

Regards

Montford Anslum



Attachments
TestNevron.zip (119 views, 48.00 KB)
Pavel Vladov
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 33, Visits: 2
Hi Montford,
regarding your questions:

1. The code to activate the erm connector tool is:

NCreateConnectorTool tool = (view.Controller.Tools.GetToolByName(NDWFR.ToolCreateConnector) as NCreateConnectorTool);
if (tool == null)
return;

tool.ConnectorType = ConnectorType.ErmConnector;
view.Controller.Tools.SingleEnableTool(NDWFR.ToolCreateConnector);


Unfortunatelly, I've discovered that there's a bug when activating this tool, but I've fixed it, and it will work fine in the upcoming service pack (it is going to be released today or tomorrow) of our component.

2. In order to work properly, the SizeToContent() method of the erm shape should be called after the shape is added to the drawing document.

3. The erm shapes does not support adding such information. If you need to show more details than just the name of the column and its relation type (i.e. PK = private key or FK = foreign key), I suggest you take a look at the table shape and the UML shape examples.

Best Regards,
Pavel

Montford Chelliah
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1

Hi Pavel,

Could you please provide the sample code of NErmshape object. I could not found any sample application in your product samples (with the Nevron product installation). I have tried the way you suggest, I have following problems.

(1) How do I enable the Erm connector on drawing space? I have found only single connector to connect multiple shapes (like NDWFR.TooltipConnectToPort)

view.Controller.Tools.SingleEnableTool(NDWFR.TooltipConnectToPort)

(2) How do I resize the NErmshape object after populate the table object. It does not resize according to the text.

Dim shape As New NErmShape(0, 0, 10, 10)

' Populate the data table......

shape.SizeToContent()

(3) How do I include the data type column next to field column in NErmShape

Thanks

Regards

Montford Anslum

 



Pavel Vladov
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 33, Visits: 2
Hi Montford,

I understood your requirement. What you have to do is to manually create custom ERM shape for each table, when the user drags it into the drawing view. You can easily do this by using code similar to:

NErmShape shape = new NErmShape(0, 0, 10, 10);
shape.CreateFromTable(dataTable);


Where dataTable is the table that the user has dragged into the drawing view. Next you can provide the user with the ability to connect the tables using Erm connectors.

Best Regards,
Pavel Vladov



Similar Topics


Reading This Topic