Developing an Extension in Enterprise Architect, it's possible to call Repository.OpenDiagram() function and open a specific diagram. Using the Diagram.SelectedObjects, objects on that diagram can be selected and the list of the selected ones is accessible. However, there I need to focus on a selected object, but cannot find the corresponding EA API/function.
How could I focus on an object so that it be displayed in the center of diagram window (without changing the real position of the object)?
Thanks in advance for any hint!
You can't, except if you use a windows library to simulate clicks on the scrollbar or something like that.
But I'm not recommending that approach as you'll never be sure it will actually put the element in the center.
Related
A big problem for me creating diagrams in visio (and powerpoint and similar programs) is that if you have a background object, it blocks you from selecting multiple objects by lassoing. Instead you end up moving the background around, this is annoying.
In many applications there's an option to "lock" or "protect" a specific object so it becomes un-selectable while still visible on the drawing. In Visio there is no simple way of doing this as far as I'm aware.
There's a rather convoluted way of doing this, it feels to me like Visio designers wanted to make this difficult on purpose. The methods I'm aware of I list here, feel free to let me know of a better way(s)
You can protect objects from selection by going to (hidden by default) Developer tab and pick "shape design"-> protection -> selection. However this does not actually protect them from selection, which makes sense . To actually protect the said object from selection, you have to open drawing explorer, which is also hidden by default and the visibility tickbox is in hidden by default Developer tab under show/hide section.
Drawing explorer, however won't highlight whatever object you have selected in the drawing, another unexplicable design decision. If you want to see the name of the object you've selected with live update, you have to enable the diagram navigation pane. That's found in View tab on Show section under "task panes" icon. This pane does highlight whatever you've selected and you can rename the object to give it a meaningful name, but not change the shape in any other way.
To finally protect that shape from selection, right click on the top level document on the drawing explorer and pick "Protect document" and tick "shapes" and hey presto, now your background rectangle is visible but not selectable. Very straightforward indeed
There are also layers which offer similar functionality but they naturally come with their own gotchas.
You can see layers on the Drawing explorer under foreground pages, page name, "Layers" tree. To move an object on a specific layer, you cannot do it by right clicking on the object, because of course you can't. There's an assign to layer button in Home->Editing->Layers->"Assign to Layer", which will let you select the layer(s) for the selected object. You can also do this by right clicking on an object from the Drawing explorer, but you have to know the object name, because there's no reverse selection .. The object name you can get from the Diagram navigation. By default "protected" and "lock" layers do nothing.
To change what the layers do, you again go to the Home -> Editing -> Layers and select "Layer properties". This is also available from Drawing explorer by right clicking on the "layers" tree under a specific page. Here you can control if the layer is visible and/or protected. However, if you lock a layer, you also cannot move objects to/from it, as that'd be too easy. So you have to untick "lock" if you want to move stuff in and out of a protection layer.
So there are two awkward ways of doing that that I'm aware of.
If the shape really is a background object then maybe you should be looking at putting the shape on a background page. You can then make it the background page for your active page. That'll fix all your shape selection problems.
I have created a new profile for activity diagram in EA(Enterprise Architect).
The stereotype I created is named dummy. The profile is created with some activity diagram elements, but I use elements from my newly created profile, on top of each element, something like is seen with element name «dummy» followed by the element name.
I would like to know if there is a way to hide the stereotype label. I have learned about shape script but couldn't figure it out well.
I am using EA version 13.
The only way (I know) is to turn off stereotype display for the whole diagram:
I first thought that DrawNativeShape in the shape script would work, but it also draws the stereotype. And it's near to impossible to show all compartments manually except for the stereotype. Just showing the class name (and individual drawings/texts) is simple. But showing attributes/operations and respecting the feature/diagram settings is near to impossible.
Does anybody have any idea on how to easily implement a image list(like the windows explorer with medium icons) control with swt? it seems like that it could be done easily with CListCtrl in c++ on windows, but does not seem to be easy with swt? any hints are appreciated!
Up to me, you need to create your own widget (check e.g. http://www.snip2code.com/Snippet/11489/Custom-SWT-List-Box) and add composite items to your custom list.
If vertical-only scrolling is enough, I suggest you rely on a single column TableViewer. This is what I did in a project where I needed a gallery-like window allowing the user to pick a graphical component based on displayed thumbnails.
You just need to implement the proper TableLabelProvider.getColumnImage and return the desired thumbnail corresponding to your list entry.
That gives a pretty decent list-like rendering.
In addition, TableViewer API is very well documented.
An UI question...
There are two select boxes between which there are two buttons "<<" and ">>". When you hit the "<<" button the selected items from the select item on the right moves to the left and similarly from left to right ">>". I am not sure what this kind of set up is called in terms of or jargon or terminology ;)
I wanted to know if there is a prototype component like this existing already? or an optimized way of doing this with Prototype library?
Thanks, J
There is no fixed terminology of your required UI problem, so far to my knowledge. Still you may call it as "Moving selected Items from one Listbox to another".
For reference, you can see this example, which is built using plain JavaScript.
Also I am pretty sure that there is some way to build this type of functionality using Prototype & Scriptaculous libraries, along with the effects. You will require the "Sortables" object, most probably.
Hope it helps.
I would like to arrange UIControls in WPF in a similar way to the applications on the iPhone. They should be positioned on a grid, but a user should be able to drag them somewhere else, after releasing the mouse button (or the finger in case of an iPhone) the selected UIControl should snap back to the next position in the grid. The other UIElements should be rearranged automatically.
Further the user should also be connect two elements with a line or something.
I'm not experienced with WPF. The first question is if there is a container which is suitable for something (System.Windows.Controls.Grid ?) or if I have to extend canvas or somethig else for this.
I would like to know which elements from the WPF framework can be used and which elements I have to write myself.
For people who do not own an iPhone: http://www.youtube.com/watch?v=3omhu2AUWC8
Update
I've looked at AnimatedTilePanel in the BangOTricks examples (see below), this one explains how to create your own Panel and how to let it arrange things there.. However I still need an idea how to implement drag and drop correctly in this example..
Unfortunately, you'll have to write a lot of things yourself, as WPF doesn't automatically do what you're looking for.
For positioning the controls, you can use either UniformGrid or Grid. Assuming it's much like the iPhone video you showed, you can just use the UniformGrid with 4 columns and however many rows you need.
For the dragging animation, layout-wise, you could start by manipulating the RenderTransform property on whatever is being dragged, but you'll have to set a handler to check once you've met whatever threshold necessary to move into the another "cell" -- and at that point, you'll have to changed the order of the items in the tree.
Take a look at AnimatedTilePanel from Kevin's Bag-o-Tricks at:
http://j832.com/bagotricks/
It doesn't do everything you want but it will show you how to write a panel that animates its children when changing size or order.
New input to this old post in 09. Earlier this year (2012) someone has wrote a FluidWrapPanel and open sourced it. I tried it and it works like a charm - just like that on the iPhone menu.
You can also apply to other UI Elements or UserControl.