Book a Demo

Author Topic: Lock a diagram and image as EA element  (Read 4332 times)

tonySparx

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Lock a diagram and image as EA element
« on: April 24, 2010, 06:16:25 pm »
Hi all,

I'm working on an add-in that generates diagrams according to certain rules. I'd like that, once generated, these diagram should no longer change even if an element in them is deleted from model, because they represent a model state at a given time.
How I can "block" a diagram? I tried with lock diagram, but if I delete from model an element in it, it doesn't work (the element disappear too).

Any ideas?

I guess to resolve this issue it could be generated an image for every custom diagram.
Is it possible someway add this image(jpg, gif...) in a EA as "model element", i.e. selectable like a class or a use case in the project tree? My question is whether there is a way to embed a diagram image in the model and then in the .eap file(not as an extern file) not as stereotype icon (for example to change a particular class object appareance), but as image itself to display to the user. Reading user guide I have not found relevant stuff about this...  :-[
"everything is possible, but there are things more likely than others..." © all rights reserved

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Lock a diagram and image as EA element
« Reply #1 on: April 24, 2010, 08:45:41 pm »
Yes, you will need to create a snapshot image of the diagram in order to preserve the soon-to-be-deleted element.

The diagram is a view into the model and therefore cannot show what is not there.

You will need to export the diagram as an image (Using Diagram|Save Diagram [Ctrl+T]) then re-import the saved image into the images set (using Settings|Images...)  Lastly you'll need to apply the imported image to an element (using <Element context menu>|Appearance...|Select Alternate Image... [Ctrl+Shift+W]).  If you want to be able to use the element in the browser - pick a suitable element type.  If you just want a shape to hold the image, you can use a boundary shape.

HTH,
Paolo
« Last Edit: April 24, 2010, 08:49:55 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

tonySparx

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Lock a diagram and image as EA element
« Reply #2 on: April 25, 2010, 06:18:16 pm »
Quote
Yes, you will need to create a snapshot image of the diagram in order to preserve the soon-to-be-deleted element.

The diagram is a view into the model and therefore cannot show what is not there.

You will need to export the diagram as an image (Using Diagram|Save Diagram [Ctrl+T]) then re-import the saved image into the images set (using Settings|Images...)  Lastly you'll need to apply the imported image to an element (using <Element context menu>|Appearance...|Select Alternate Image... [Ctrl+Shift+W]).  If you want to be able to use the element in the browser - pick a suitable element type.  If you just want a shape to hold the image, you can use a boundary shape.

HTH,
Paolo

Thanks Paolo!
Can I do this within my add-in?
"everything is possible, but there are things more likely than others..." © all rights reserved

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Lock a diagram and image as EA element
« Reply #3 on: April 25, 2010, 07:49:29 pm »
Quote
Thanks Paolo!
Can I do this within my add-in?
Since EA DOESN'T use the API for it's own work, it's difficult to say.  You have to try it and see.

The functions you'll need to use (in the API) may be slightly different.

Sorry, I can't be more help.  As usual, I'm having my own problems tripping up against MORE EA bugs!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Lock a diagram and image as EA element
« Reply #4 on: April 27, 2010, 08:57:10 am »
An easier way to do as Paolo suggested (via GUI) is clear selection on the clipboard. Press Ctrl+C.
Then go to another diagram and select Edit | Paste Element(s) | Paste Image from Clipboard (Ctrl + Shift + Insert)
If you have an element selected when performing that last step it will apply the image to that element, otherwise it creates a new boundary.