Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - StefanBrandmeier

Pages: [1]
what is also interesting - when adding the hyperlink using the subtype 19 it is set to a link type "File". I can set the Address via element.Name
but I have no clue how to change the link type to "web site". Could it be that I have to go to the dirty ways of SQL interaction with the repository
to do this ?

I found it: contentElement.Name = "$inet://https://..../asset/fbe3455c-f811-4b8f-b747-1343ebfd808d" will change the link type to "web site".

And with a bit of trial and error I found:

- the hyperlink object is actually added to the diagramobject
- it is the z-order that needs to be fixed and the location where I drop the hyperlink via code. So

diagramObject.Sequence = diagramHyperlink.Sequence+1;

after I make sure the hyperlink is created on (geometrically) in the area of the diagramObject.

So now I have the solution I was looking for


Not a problem Geert. I am also puzzled at why code lets me add the hyperlink to the class but then
shows it outside the class. Given the behavior for the wireframehyperlink it was my assumption that it
should work as well with the hyperlink(text with subtype 19).
I opened a ticket with sparx about the wireframehyperlink that is created in my original code. They will hopefully
come back with the same sort of insight you gave in your initial reply.
I will try to "complain" about the problem with adding the hyperlink to the class' elements collection.
Will keep you posted if there is a solution. Please let me know if some idea pops up at your end.


In fact, using the EA GUI you can drop a hyperlink directly onto a class and it is embedded. Try it yourself.

Hello Geert, thanks with your help my code now does create the right object. However, while it did add the wireframehyperlink to the class on my diagram (i.e. the hyperlink was then part of the class) - it does not add it to the class now but just drops it on the diagram. When adding a hyperlink via the EA GUI it also does not create an object which is visible on the project browser. Maybe that's why this object type cannot be added to the elements collection of a class element ?
Is there another way to add this object type to the elements list than what I did ?

Thank you for your help

// create the object as part of the original class element
// the subtype 19 makes it a correct "hyperlink" object
contentElement = relatedElement.Elements.AddNew("Glossary" ,"Text");

// with this code it creates a wireframehyperlink and later successfully adds it to the class on the diagram
//contentElement = relatedElement.Elements.AddNew("Glossary" ,"Hyperlink");

contentElement.Subtype = 19;
Session.Output("contentElement: " + contentElement.Alias + " stereotypeex: " + contentElement.StereotypeEx);
// create the diagram object and replace the ElementID with the hyperlink created above
diagramHyperlink = currentDiagram.DiagramObjects.AddNew("l=100;r=100;t=100;b=10;", "Text" );

when adding a hyperlink using this code:
contentElement = relatedElement.Elements.AddNew("Glossary" ,"Hyperlink");
a hyperlink is created but of the stereotype "Wireframing::WireframeHyperlink".

When adding the hyperlink stereotype from the EA GUI - found in the profile common then the right stereotype is added to the diagramm.

As a workaround: how to set the actual URL in script JScript for the WireframeHyperlink ? It should be set such that the link is clickable in the html exports of our Models.

Thanks for any support on this.

Pages: [1]