Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Custom Figures and two figures for one EditPart
Custom Figures and two figures for one EditPart [message #241215] Mon, 04 February 2008 08:26 Go to next message
Eclipse UserFriend
Originally posted by: ogucuk.gmail.com

Hello all,

we have an EMF Model element "state" which is shown in our generated GMF
editor as a "node"

Now we want to implement a collapse/expand feature for this editor. So
we let the user select some nodes (stated), right-click on a button
'Collapse Selected Items' and we delete the selected figures.

After that we want to show a custom figure representing all deleted
nodes. So this custom figure is just another view for our model element
"state"

The user then should be able to click on that custom figure and
right-click on 'Expand' and the deleted nodes should come back again.
But we have not come so far because we even cannot assign this custom
figure to our StateEditPart. It seem there must be exactly one Figure
for one EditPart.

Is that true? How can we implement this "temporary custom figures" to
represent the collapsed element on our editor?


Every help will be greatly appreciated

Thanks in advance

Meryem
Re: Custom Figures and two figures for one EditPart [message #241240 is a reply to message #241215] Mon, 04 February 2008 21:31 Go to previous message
Xiang Qinxian is currently offline Xiang QinxianFriend
Messages: 119
Registered: July 2009
Senior Member
myName 写道:
> Hello all,
>
> we have an EMF Model element "state" which is shown in our generated GMF
> editor as a "node"
>
> Now we want to implement a collapse/expand feature for this editor. So
> we let the user select some nodes (stated), right-click on a button
> 'Collapse Selected Items' and we delete the selected figures.
>
> After that we want to show a custom figure representing all deleted
> nodes. So this custom figure is just another view for our model element
> "state"
>
> The user then should be able to click on that custom figure and
> right-click on 'Expand' and the deleted nodes should come back again.
> But we have not come so far because we even cannot assign this custom
> figure to our StateEditPart. It seem there must be exactly one Figure
> for one EditPart.
>
> Is that true? How can we implement this "temporary custom figures" to
> represent the collapsed element on our editor?
>
>
> Every help will be greatly appreciated
>
> Thanks in advance
>
> Meryem
Hi,
From design view, the figure cannot(should not) be deleted. GEF editor
use GraphicalEditPart createFigure() method (but just design, isnot?)
From your requirement, the "node" add a state which named "collapsed",
it's a presentation model state. IMO, the best place is editpart self.
You can operate it(the collapsed state) at a gef Command class, then
notfiy editpart handle figure changing. the command class can be also in
editpart class.
@this moment, you change the figures inner children figure, change it
with another figure, and udpate it.

like this:
//handle ui action, get a command
//call refreshVisuals
refreshVisuals(){
getState();
initAnotherFigure();//or cached figure
getFigure().remove(oldFigure);
getFigure().add(anotherFigure());
setFigureConstraint();
//layout can help this too.
}


logic example give a led figure demo, it's good sample for change figure.

Regards,
Xiangya
Previous Topic:GEF auto-scroll when dragging an EditPart
Next Topic:customizing connections
Goto Forum:
  


Current Time: Fri Apr 19 06:23:50 GMT 2024

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

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

Back to the top