Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Active Shapes problem
Active Shapes problem [message #937138] Mon, 08 October 2012 17:56 Go to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
I have a situation where I have a number of nested shapes (all rectangles in this case).


    The top rectangle is active and therefore selectable.
    In the deepest nested rectangle I want to be able to create other shapes through the palette.

To be able to do this, the deepest nested shape needs to be 'active', otherwise I cannot drop a new shape on it. The problem now is that this deepest nested shape also becomes selectable by the user, but that is not what I need. This shape just defines an area to create other shapes from the palette, it has no further semantics and should remain unselectable. Is there a way to make a shape accessible for dragging new shapes from the palette, and keeping it not selectable by the user?

Jos
Re: Active Shapes problem [message #937444 is a reply to message #937138] Tue, 09 October 2012 01:17 Go to previous messageGo to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

Jos Warmer wrote on Tue, 09 October 2012 02:56
I have a situation where I have a number of nested shapes (all rectangles in this case).


The top rectangle is active and therefore selectable.
In the deepest nested rectangle I want to be able to create other shapes through the palette.

To be able to do this, the deepest nested shape needs to be 'active', otherwise I cannot drop a new shape on it. The problem now is that this deepest nested shape also becomes selectable by the user, but that is not what I need. This shape just defines an area to create other shapes from the palette, it has no further semantics and should remain unselectable. Is there a way to make a shape accessible for dragging new shapes from the palette, and keeping it not selectable by the user?

Jos


What if you have only 1 content pane (you said it as deepest nested shape)
1. Let contentPane as inactive.
2. Let AddSomethingFeature works clever.
Inactive PE delegate drop target to it's parent(active one)
So you can create am add feature using root shape, then add child PE into place you want.

What if you have multiple content panes, It needs some hacky trick
since Graphiti doesn't provide search API with given location.
You can search target pe with API from PE and GA EMF model using location which is given by add context.

It reduces benefit of graphiti's easiness I think.
Re: Active Shapes problem [message #937863 is a reply to message #937138] Tue, 09 October 2012 10:31 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Jos,

another option would be to have the innermost shape active as you described
and override IToolBehaviorProvider.getSelection(...) to change what's being
selected on clicking into the innermost shape. More concrete: you would
return the top rectangle shape in this case.

Michael
Re: Active Shapes problem [message #939001 is a reply to message #937863] Wed, 10 October 2012 10:38 Go to previous messageGo to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
Michael,

Your solution works like a charm,

Tnx, Jos
Re: Active Shapes problem [message #1220246 is a reply to message #939001] Tue, 10 December 2013 15:29 Go to previous messageGo to next message
Martin Hanysz is currently offline Martin HanyszFriend
Messages: 30
Registered: November 2013
Member
Hello,

I have a very similar situation. I have a ContainerShape (cs) that contains two other Shapes (s1 and s2). All Shapes have Rectangle GraphicsAlgorithms.
Since s2 is only decoration, it should not be selectable by the user. I implemented getSelection() in the ToolBehaviorProvider to return s1 once s2 should be selected, which works as expected.
The problem is, that s2 is still selectable once I use the selection rectangle (I can select s2 only and multiple Shapes with it). Is there a way to disable this? It seems I am looking for a way to manipulate the behavior of the marquee tool in general...

Best regards,
Martin
Re: Active Shapes problem [message #1221884 is a reply to message #1220246] Wed, 18 December 2013 16:03 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Martin,

have you tried to set s2 to inactive? That disables selection.

In case it is only decoration you might also consider to omit the shape and
directly add graphic algorithms as children to cs.

Michael
Re: Active Shapes problem [message #1222022 is a reply to message #1221884] Thu, 19 December 2013 12:51 Go to previous message
Martin Hanysz is currently offline Martin HanyszFriend
Messages: 30
Registered: November 2013
Member
Dear Michael,

I already tried setting s2 to inactive, but that also disables the rendering of its GraphicsAlgorithm. Adding the GraphicsAlgorithm of s2 as a child to the GraphicsAlgorithm of cs is also not possible, because cs is inactive, too.

I finally decided to introduce a "disabled" boolean property that I set for every decoration shape and check in every other feature first. If a PictogramElement has this property set to true, the features that are considered user interaction (move, resize, remove, delete...) simply do nothing. Since the "disabled" shapes are handled programmatically once other shapes are manipulated, the user can still move, resize or remove them.

First I tried returning false in the can*() method of these features, but that caused another problem. If the user selects multiple PictogramElements with the marquee tool and then tries to move all of them, the mouse cursor turns into the red forbidden symbol once the respective move feature returns false for at least one of the selected PictogramElements.

Even if your suggestions didn't solve this particular problem, pointing out the possibility to nest GraphicsAlgorithms into each other helped me at some other points, so thanks for that Wink

Best regards,
Martin

[Updated on: Thu, 19 December 2013 12:52]

Report message to a moderator

Previous Topic:Color of Text in MultiText
Next Topic:Rotated labels
Goto Forum:
  


Current Time: Sat Apr 20 01:04:51 GMT 2024

Powered by FUDForum. Page generated in 0.03354 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top