Skip to main content



      Home
Home » Eclipse Projects » GEF » z-index of figures
z-index of figures [message #248120] Tue, 07 April 2009 07:45 Go to next message
Eclipse UserFriend
Originally posted by: juergen.scheffler.gmx.de

Hi,

how do I change the z-index of figures f.e.: bringing sth one step to
front or total front.

G

Juergen
Re: z-index of figures [message #248137 is a reply to message #248120] Tue, 07 April 2009 17:01 Go to previous messageGo to next message
Eclipse UserFriend
Z-order in GEF is determined by the order of the children parts of a
particular edit part. This order is in turn determined by the order of
the corresponding model children.

Please search the newsgroup for "Z-order" if you need more clarification.

Cheers
Ben

juergen.scheffler@gmx.de wrote:
> Hi,
>
> how do I change the z-index of figures f.e.: bringing sth one step to
> front or total front.
>
> G
>
> Juergen
Re: z-index of figures [message #248205 is a reply to message #248137] Thu, 09 April 2009 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.scheffler.gmx.de

Ben Vitale schrieb:
> Z-order in GEF is determined by the order of the children parts of a
> particular edit part. This order is in turn determined by the order of
> the corresponding model children.
>
> Please search the newsgroup for "Z-order" if you need more clarification.
>
> Cheers
> Ben
>
> juergen.scheffler@gmx.de wrote:
>> Hi,
>>
>> how do I change the z-index of figures f.e.: bringing sth one step to
>> front or total front.
>>
>> G
>>
>> Juergen

Ok, I found out that I have to use protected List getModelChildren()
from the container Editpart and change the Order by coding sth easy, but
I dont understand from where I have to call this method.

f.e. I think I can create a new context menu entry that launches a
command. In that command, do I have to call getModelChildren()?!
Then rearrange them and then send where?!

G

JS
Re: z-index of figures [message #248504 is a reply to message #248205] Wed, 22 April 2009 01:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.scheffler.gmx.de

Is there an example code for a "bring to front" ? I mean I can sort
correct, but I dont know where to use "getmodelchildren()".
Help plz

Juergen
Re: z-index of figures [message #248513 is a reply to message #248504] Wed, 22 April 2009 09:17 Go to previous messageGo to next message
Eclipse UserFriend
You could just call refresh() on the EditPart, which will refresh its
children.

Jürgen Scheffler wrote:
> Is there an example code for a "bring to front" ? I mean I can sort
> correct, but I dont know where to use "getmodelchildren()".
> Help plz
>
> Juergen
Re: z-index of figures [message #248526 is a reply to message #248513] Wed, 22 April 2009 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.scheffler.gmx.de

Ben Vitale schrieb:
> You could just call refresh() on the EditPart, which will refresh its
> children.
>
> Jürgen Scheffler wrote:
>> Is there an example code for a "bring to front" ? I mean I can sort
>> correct, but I dont know where to use "getmodelchildren()".
>> Help plz
>>
>> Juergen


I want to have a button in the toolbar (later in context menu) like
"bring to front". I know how to make those actions in my
"EditorWithPalette.java". So, I select a figure and press the "bring to
front"-button. So the EditorWithPalette.java has the control. Do I have
to find the selected Element there or only later in the Editpart?

b) making sth like MyEditpart.refresh() in the EditorWithPalette.java
doesnt transports the selected element as parameter.

plz explain in child english and like a "sequencediagram". (You dont
have to draw one, just tell some control steps and classes plz)

You understand my problem?
In other words again:
If I do it like this: in the Editpart.java getchildren method I can sort
the elements and probably I can get the selected element and put it to
postion [0] in the list. Everytime this method gets called (f.e. by gef)
the selected element gets to front. But I dont want this behavior! I
want it only when the user says so.

User clicks, control is at RCP action class and in the Editor. Where to
go now? (Do I have to write sorting methods in the Editpart? if yes,
arent there sideeffects when GEF calls randomly* the getmodelchildren
method?!)

Please enumerate/specify the classes and methods that you would use for
this.
Re: z-index of figures [message #248539 is a reply to message #248526] Wed, 22 April 2009 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jurgen,

OK, so let's say you've got the following,

com.your.product.model.Stack
com.your.product.model.StackChild

com.your.product.parts.StackEditPart
com.your.product.parts.StackChildEditPart

First, take GEF out of the picture. Think of this as a model operation.

Your Stack model needs to maintain an ordered list composed of
StackChild objects. When you first create this list, it should be in
whatever the default order is. When your action runs, you need to
modify this list to put the appropriate Child in the right slot.

First, you need to encapsulate that logic in a GEF Command. The Command
need only know about the Stack and the StackChild.

For your Action, most likely it will be easiest to subclass
org.eclipse.gef.ui.actions.SelectionAction. There are methods on that
class (and its superclass) to get the selected EditPart, and then
execute a Command. Take a look at the DeleteAction as an example.

If you need help understanding how to hook up the SelectionAction, look
at how DeleteAction is used in the Logic example. It just needs a
reference to the IEditorPart that is wrapping your GraphicalViewer.

So, full circle:

1. Action executes a Command
2. Command modifies the model
3. The Stack model class must send a notification to its listeners. One
of those listeners must be the StackEditPart. The StackEditPart must
respond to this event by refreshing itself (using refresh() or similar).
This will cause it to get a new properly ordered set of
StackChildEditPart objects. Then your figures will be in the right order
automatically.

You will find this is a very standard workflow in GEF. The Command
modifies the model, which notifies the edit parts, which update their
visuals accordingly.

Good luck!
Ben

Jürgen Scheffler wrote:
> I want to have a button in the toolbar (later in context menu) like
> "bring to front". I know how to make those actions in my
> "EditorWithPalette.java". So, I select a figure and press the "bring to
> front"-button. So the EditorWithPalette.java has the control. Do I have
> to find the selected Element there or only later in the Editpart?
Re: z-index of figures [message #248545 is a reply to message #248539] Wed, 22 April 2009 13:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: juergen.scheffler.gmx.de

Super Ben! thx a lot!
I had lost the clear view on the MVC of GEF. You gave it back!
1. and 2. will be not very hard. I just hope I get 3. done, but I think
its connected correct.

Ok, so, I change the model in a command. I sort the childs in the
correct order for the parent stack and the editparts get notified
because of the adapter.

Whats the benefit of the Editpart getmodelchildren method then?
So I dont need to code there?!
Who needs to overwrite this method? or is it only for the first view
until there are changes to the model?!

G

Jürgen
Re: z-index of figures [message #248555 is a reply to message #248545] Wed, 22 April 2009 15:12 Go to previous message
Eclipse UserFriend
No need to mess with getModelChildren at all. Let the model be the guide.

Jürgen Scheffler wrote:
> Super Ben! thx a lot!
> I had lost the clear view on the MVC of GEF. You gave it back!
> 1. and 2. will be not very hard. I just hope I get 3. done, but I think
> its connected correct.
>
> Ok, so, I change the model in a command. I sort the childs in the
> correct order for the parent stack and the editparts get notified
> because of the adapter.
>
> Whats the benefit of the Editpart getmodelchildren method then?
> So I dont need to code there?!
> Who needs to overwrite this method? or is it only for the first view
> until there are changes to the model?!
>
> G
>
> Jürgen
Previous Topic:[Zest] setText of connection with GraphViewer
Next Topic:[Announce] GEF 3.5.0 I200904222348 is available
Goto Forum:
  


Current Time: Tue Apr 15 02:47:58 EDT 2025

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

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

Back to the top