Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Jayson on November 06, 2019, 10:13:02 am

Title: Hiding Diagram Objects on a diagram
Post by: Jayson on November 06, 2019, 10:13:02 am
Hey all

My understanding has always been that (unlike diagram links), there is no "IsVisible" attribute or equivalent that can be used to suppress a diagram object from being visible on a diagram.

However, if I look at the link below, it lists Elements as having the following two properties that can be access from shape scripts:

IsVisible, and
Visibility

So the obvious answer, is "what gives"?

https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/displaying_element_properties.html

Cheers

Jays :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: Aaron B on November 06, 2019, 11:11:29 am
IsVisible I think is mainly for processing child elements. See Example 3 on the following page about custom compartments:
https://www.sparxsystems.com/enterprise_architect_user_guide/15.0/modeling/add_custom_compartments_to_ele.html

I'm not 100% sure what the Visibility property is though. At first I thought it might be the Scope (Public, Private etc) since that sometimes gets referred to as Visibility in other places, but doesn't seem to be the case here.
Title: Re: Hiding Diagram Objects on a diagram
Post by: Paolo F Cantoni on November 06, 2019, 11:26:14 am
IsVisible I think is mainly for processing child elements. See Example 3 on the following page about custom compartments:
https://www.sparxsystems.com/enterprise_architect_user_guide/15.0/modeling/add_custom_compartments_to_ele.html

I'm not 100% sure what the Visibility property is though. At first I thought it might be the Scope (Public, Private etc) since that sometimes gets referred to as Visibility in other places, but doesn't seem to be the case here.
Visibility may be related to the [Ctrl+F9]|Objects|Advanced,  It seems to be related to Element Visibility.

Thomas, in his excellent book, lists Visibility as "Always NULL?!"

Paolo
Title: Re: Hiding Diagram Objects on a diagram
Post by: qwerty on November 06, 2019, 12:04:17 pm
Just guessing: connectors can be set invisible. Maybe that property only works on connectors being set invisible. But then: why evaluate it in a shape script if the connector is invisible anyway? So many strange things in EA. Another guess: it's just a wrong documentation.

q.
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 06, 2019, 12:13:00 pm
I have wondered if that is the case.

Do you know if I can access the IsSelectable property of an element from the shape script?
The same webpage doesn't list as being accessible, which seems strange to say the least.

I have added a diagram property called "Visible" to my stereotypes and modified the shape script to show nothing when this is set.
However, I cannot find a way to set diagram properties of individual diagram objects from scripting.

As a backup, maybe I can set the IsSelectable switch from scripting and then modify the shape script to display nothing when THAT switch is set?
But to do that I need to be able to detect it in the shape script!

Cheers

Jays :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: Paolo F Cantoni on November 06, 2019, 04:33:45 pm
Hi Jays,

IIRC, the User Specific Diagram Properties end up in the ObjectStyle column of t_diagramobjects.  They aren't available directly from the API, you need to parse the column.

If you search for "User Specific Diagram Propert" you'll find a lot of stuff on how they need to be improved.

HTH,
Paolo
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 06, 2019, 04:39:36 pm
Hey Paolo

Thanks for that! Am I able to get and set the contents of that column from the API somehow?
I'm not adverse to a little bit of parsing if I can get hold of the data in the column.

Cheers

Jays :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: Paolo F Cantoni on November 06, 2019, 05:28:37 pm
Hey Paolo

Thanks for that! Am I able to get and set the contents of that column from the API somehow?
I'm not averse to a little bit of parsing if I can get hold of the data in the column.

Cheers

Jays :-)
DiagramObject.Style  Search for DiagramObject Class in the Help.

Paolo

[Edit: They're actually in Diagram.StyleEx referencing a DUID in DiagramObjects.  See later posts from KP]
Title: Re: Hiding Diagram Objects on a diagram
Post by: qwerty on November 06, 2019, 07:47:30 pm
See p. 58 of my Inside book: DiagramObject.StyleEx has a CSV value NSL=1/0

q.
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 07, 2019, 05:32:01 am
Hey Thomas

I have ALL your books which I bought a good number of years ago now.
Looks like you must have changed it from the original as I can't see NSL in there anywhere.
Unfortunately I lost my LeanPub credentials when I left my last company but never mind my current company can give you another generous donation so I can get the updates  ;)
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 07, 2019, 06:40:56 am
Alrightie, so you should be a handful of dollars richer as I have updated my version of Inside EA.
Looking at page 58, it states that NSL is "1/0 corresponding to the context menu setting Selectable".

However, what I am after is the ability to read from and write to the User Specific Diagram Properties that I define as belonging to a particular stereotype.
Please see the link below for an example of what I am after.

https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/query_methods.html

In this scenario, I am looking for a method for reading and writing to the Is Red property for the Red Flag stereotype.

Cheers :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: qwerty on November 07, 2019, 08:12:19 am
Hey Thomas

I have ALL your books which I bought a good number of years ago now.
Looks like you must have changed it from the original as I can't see NSL in there anywhere.
Unfortunately I lost my LeanPub credentials when I left my last company but never mind my current company can give you another generous donation so I can get the updates  ;)

Send me a PM and I mail you an update.

q.
Title: Re: Hiding Diagram Objects on a diagram
Post by: qwerty on November 07, 2019, 08:15:07 am
Hmm. Late for me already. But diagrams don't have stereotype properties (aka TVs) in V13.5. Are there in later versions?

q.
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 07, 2019, 08:45:58 am
Hey Thomas

The properties I am talking about belong to Element Stereotypes (please see the bottom of the page below).
These are properties that can have different values on different diagrams for the SAME element.

Therefore, I am assuming that they belong somewhere to the DiagramObject class but can't find where to access them.
It is driving me crazy! ;-)

Cheers

Jays :-)



https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/query_methods.html
Title: Re: Hiding Diagram Objects on a diagram
Post by: qwerty on November 07, 2019, 09:20:26 am
I haven't dealt with these diagram properties. Not sure if V13.5 has them. I do have V14 but actually work just with 13.5. Will have a look tomorrow.

q.

P.S. I tried locating something in the help that tells how to create that in a MDG: of course no luck. That picture just looks like something I never saw before. Es ist zum Knochen kotzen (don't try to translate, it's sort of a curse. Nothing to beep away, though)

P.P.S: Don't try to find these. It's anyway part of the MDG stuff which is held in memory. No access to us dumb users. If someone can give me a hint where to find info about these <<diagram property>> attributes: thanks in advance.
Title: Re: Hiding Diagram Objects on a diagram
Post by: KP on November 07, 2019, 09:56:59 am
The properties I am talking about belong to Element Stereotypes (please see the bottom of the page below).
These are properties that can have different values on different diagrams for the SAME element.

Therefore, I am assuming that they belong somewhere to the DiagramObject class but can't find where to access them.


They are in t_diagram.StyleEx, look for "OPTIONS_"
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 07, 2019, 10:07:48 am
Hey KP

I'm assuming I access this via the Diagram.StyleEx property?
If so, I did that and couldn't find anything.

Given that the properties I am talking about seem to be attached to the Diagram Objects (and not the Diagram itself), would it make sense for them to be in the diagram database table?

Cheers :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: KP on November 07, 2019, 10:30:23 am
I'm assuming I access this via the Diagram.StyleEx property?
If so, I did that and couldn't find anything.
It looks like they are only saved in that field when they are different to the default.

I checked this the following way: Start with an empty model, Perspective->Construction->Project Management, new diagram, put two "Sprint" elements on diagram, select one of them and right-click->Show as Requirement.

Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 07, 2019, 01:18:35 pm
Hey KP

But I am trying to access properties attached to specific diagram objects and NOT the diagram itself, so shouldn't the data be somewhere in the t_diagramobject table???

I am really confused! :-(

Jays :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: KP on November 07, 2019, 01:56:13 pm
Each diagram object has a DUID (like a GUID but only 8 characters; stored in the t_diagramobjects.ObjectStyle field) and that DUID is referenced in the t_diagram.StyleEx field. e.g. "OPTIONS_3FA0FE61=DrawAsRequirement=0;"


But I am trying to access properties attached to specific diagram objects and NOT the diagram itself, so shouldn't the data be somewhere in the t_diagramobject table???
I'm sorry, I have no insight into why it was done this way.
Title: Re: Hiding Diagram Objects on a diagram
Post by: Jayson on November 08, 2019, 04:58:36 am
Thanks so much KP! :-)

Now that I know where the flags are stored, its pretty easy to hack the fields to get the outcome I am after.
Honestly I don't think I would have ever found the flags on my own, they are NOT in a remotely intuitive place are they?

Cheers

Jays :-)
Title: Re: Hiding Diagram Objects on a diagram
Post by: Geert Bellekens on November 08, 2019, 05:32:10 am
The "trick" to finding stuff like that is to use a profiler (such as on SQL Server) that captures all SQL statements issued to the database.

Start the profiler, change whatever you are interested in, stop the profiler, and examine the SQL update/insert/delete statements

Geert