Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Silverlight with javascript? (Read 7262 times)
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Silverlight with javascript?
Oct 28th, 2011 at 10:49am
Print Post  
I have created a webpage that uses the Java version of DiagramView. I am now looking to use the Silverlight version instead.

Are there any major issues with this? I have already hit one, where the AppletStartedScript does not run once the silverlight control is loaded.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #1 - Oct 28th, 2011 at 11:25am
Print Post  
It seems AppletStartedScript has not been implemented in Silverlight mode. We are releasing a new NetDiagram version next week and will add it there.

Alternatively, you could implement event handling entirely in Silverlight by building a custom version of the ClientDiagramApp.xap applet from this project https://mindfusion.eu/_samples/netdiag.xap.zip. You could add handlers to the .NET events exposed by DiagramHost.Diagram instead of using JavaScript.

This will also let you add Overview and NodeListView controls to the xaml page, which are not supported in NetDiagram Silverlight mode otherwise.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Silverlight with javascript?
Reply #2 - Oct 28th, 2011 at 12:38pm
Print Post  
Hi Stoyo,

Thank you for that. I might have to wait for the next version - I'm not very good at silverlight/wpf !

We are actually debating over whether to use java or silverlight. The silverlight looks much cleaner on the page.

If I give you a list of functionality I am looking for, could you just copy/paste and say yes/no to if these are possible in silverlight?

I am looking to do all of the following using javascript:
1. A Treeview layout with horizontal and vertical links (not diagonal)
2. Ability to zoom in and out using javascript
3. Ability to create a group with a number of shapenodes through javascript
4. Ability to create/change a shapenode's id, text, fill and border through javascript
5. When the shapenode's text is too large, then adjust the height of the shapenode accordingly. (keeping the width the same)
6. Ability to detect which shapenode the user has clicked on, and create a new shapenode linked to the clicked shapenode (or delete the shapenode). Also ensure that the layout is followed after the new shapenode is added.
7. Ability to export the diagram as an image

What would also be nice is the following:
a. Ability to initiate an AJAX call or javascript call when a event happens (such as when a shapenode is added).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #3 - Oct 28th, 2011 at 3:29pm
Print Post  
Hi,

What exactly do you find cleaner in the Silverlight version? Is its anti-aliasing better or something else?

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #4 - Oct 28th, 2011 at 3:41pm
Print Post  
1. I can't find a way to instantiate a Silverlight TreeLayout object from JavaScript. It seems we'll have to add a ScriptHelper object similar to what we have in the jdiagram.jar applet to let you create layout instances. You can still run TreeLayout on the server to get the expected layout.
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Silverlight with javascript?
Reply #5 - Oct 28th, 2011 at 4:12pm
Print Post  
Hi Stoyo,

The first time I loaded the Silverlight version, the text in the shapenodes wrapped the whole words. In the java version, it would wrap half words. I think it is also the way we have to load the shapes.

Actually, we have decided to migrate everything to Silverlight (so dont worry about my questions above). We will create the whole page in Silverlight.

So what I would like to do is create a Silverlight page, and put the DiagramView control into this. I'm not great at WPF, so this may take me sometime.

How do I added the control to a Silverlight project? I have looked at your sample project, but it references MindFusion.Diagramming.Silverlight.ddl. Where is this dll?

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #6 - Oct 28th, 2011 at 5:41pm
Print Post  
Hi,

You can enable whole-word text wrapping in Java too.

If you have decided to implement everything in Silverlight, note that it does not support grouping yet, but perhaps you can use ContainerNodes instead. If you need the AttachTo method, our developer can port it to Silverlight next week.

You can unzip the diagramming.silverlight.dll from ClientApp.xap (xap files are in zip format). If you PM me your account name at http://clientsarea.eu/, I can also add the DiagramLite installer to the account so you'll have Silverlight-specific samples and help file.

Stoyan
  
Back to top
 
IP Logged
 
jagdipa2
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 28th, 2011
Re: Silverlight with javascript?
Reply #7 - Oct 28th, 2011 at 9:07pm
Print Post  
Hi Stoyo,

Sorry - forgot my password as its logged in automatically at work.

The zip file above doesnt seem to have the dll. I have tried running the project as well, and it fails to compile.

I have already tried using grouping (on an asp.net page), and it seemed to work fine. But that was just a quick test.

I have PMed my account name.
  
Back to top
 
IP Logged
 
jagdipa2
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 28th, 2011
Re: Silverlight with javascript?
Reply #8 - Oct 30th, 2011 at 12:20pm
Print Post  
Hi Stoyo,

After trying to use container nodes, it looks like I do need the AttachTo method. Could you please organise it to be ported over?

I have been trying to use container nodes. I have created links between the nodes within the container nodes. I want to rearrange these in a treelayout. When I try this, I get the following error message:

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  StackTrace:
      at MindFusion.Diagramming.Silverlight.InteractionState.Start()
      at MindFusion.Diagramming.Silverlight.ContainerNode.OnBoundsChanged(Rect oldRect, Rect newRect, Boolean updateChildren, Boolean updateStorage)
      at MindFusion.Diagramming.Silverlight.DiagramNode.xfa961b14b2535a72(DependencyObjec
t x73f821c71fe1e676, DependencyPropertyChangedEventArgs xfbf34718e704c6bc)
      at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyPrope
rty dp, Object oldValue, Object newValue)
      at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
      at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
      at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
      at MindFusion.Diagramming.Silverlight.DiagramNode.set_Bounds(Rect value)
      at MindFusion.Diagramming.Silverlight.ContainerNode.MoveWith(Double dx, Double dy)
      at MindFusion.Diagramming.Silverlight.Layout.x73e4e74934f5902b.set_x6ae4612a8469678
e(Rect xbcea506a33cf9111)
      at MindFusion.Layout.x0685451118af5c7f.x550781f8db1cf5f2(x11d78e5b469ed338 xda5bf54deb817e37, xcb359d3cc19bff83 x672ff13faf031f3d)
      at MindFusion.Layout.xcb359d3cc19bff83.x35618da2db9d09c0(x11d78e5b469ed338 xda5bf54deb817e37)
      at MindFusion.Layout.x3ea78caabca59bc5.x84e6892f0d4e87ad(x11d78e5b469ed338 xcd0140078338adc3, x9f305bec3115d3d9 x672ff13faf031f3d)
      at MindFusion.Layout.x0685451118af5c7f.xb7874248b0c0bc2d(x5660ea42023c83d2 xee6a854ae0b80ef2, x0cbf0b2191c9f896 x8d3f74e5f925679c, x78e3ce9dc43283f0 x22bfd1664c623dc4)
      at MindFusion.Diagramming.Silverlight.Layout.TreeLayout.x1d21b37097156a35(Diagram x8b62359f01cfd806, IEnumerable xf8b54ce7724a27f2)
      at MindFusion.Diagramming.Silverlight.Layout.Layout.Arrange(Diagram diagram, DiagramItemCollection items)
      at MindFusion.Diagramming.Silverlight.Layout.TreeLayout.Arrange(Diagram diagram, DiagramItemCollection items)
      at MindFusion.Diagramming.Silverlight.Layout.Layout.Arrange(Diagram diagram)
      at HFRM.MainPage.LoadHTAItemsToDiagram()
      at HFRM.MainPage.MainPage_Loaded(Object sender, RoutedEventArgs e)
      at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
      at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
  InnerException:
« Last Edit: Oct 30th, 2011 at 1:44pm by jagdipa2 »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #9 - Oct 31st, 2011 at 10:01am
Print Post  
Hi,

Our developer will port it in the next few days. With what settings are you running TreeLayout?

Stoyan
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Silverlight with javascript?
Reply #10 - Oct 31st, 2011 at 10:50am
Print Post  
Hi Stoyo,

As I was trying to port my javascript to vb.net, my code was similar to below (but in vb.net):


       function redrawLayout()
       {
           var tl = script.createTreeLayout();
           tl.setLinkStyle(2);
           tl.arrange(diagram);
           diagram.resizeToFitItems(10.0, true);
       }

I think it was:

dim tl as treelayout
tl.linkStyle = Cascading3
tl.arrange(diagram)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #11 - Nov 1st, 2011 at 11:25am
Print Post  
Hi,

I could not reproduce an exception. Could you save the diagram with which you got it to xml and email the file to support@mindfusion.eu?

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Silverlight with javascript?
Reply #12 - Dec 14th, 2011 at 10:31am
Print Post  
This version adds an AttachTo method:
http://mindfusion.eu/Forum/YaBB.pl?board=diaglite_disc;action=display;num=132377...

It only lets you attach nodes to nodes at this time.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint