Different Link types in ValidLink

In our application, there are different types of links between nodes. When ValidLink is called on the view, I need to know what type of link is being drawn. (Set by a toolbar selection). How would I go about this? TIA

It sounds like you’ve already created a subclass of JGoView and overridden ValidLink. You can add a member variable to your JGoView subclass that contains the toolbar or parent frame. Just set that information when your JGoView subclass is created.

I thought about that but would prefer to get it at the time that ValidLink is called since the other way would require someone to set the property. I would prefer if my view was self sufficient since I am providing a control to other developers.

Although is there an event that happens right before ValidLink is called? I could raise an exception at that point that says the required property is not set.

If your view needs to know about the state of some other portion of your user interface (the toolbar), it can’t be self sufficient. You can make that dependency explicit by using creating a new property and raising an exception if it’s not set as you mention above. I suppose you could also create an implicit dependency by calling getParent on the JGoView until you find the parent frame and then make some assumptions about how to find the toolbar, but I think the explicit dependency is much better.