Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Alter the location and the background color of EditPar
Alter the location and the background color of EditPar [message #1042666] Tue, 16 April 2013 18:20 Go to next message
Fatla 777 is currently offline Fatla 777Friend
Messages: 13
Registered: April 2013
Junior Member
Hello,
I have an EditPart I need to alter its location and background color.
I have managed to alter its location using:

	ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
		request.setEditParts(editPart);
		request.setMoveDelta(newLocation);

		Command cmd = editPart.getCommand(request);
		if (cmd != null && cmd.canExecute()) {
			cmd.execute();
		}


I have managed to alter the background color by:
editPart.getContentPane().setBackgroundColor(color);


But whenever I close and re open the application,the color changes I made goes away!

How can I commit the background color !

[Updated on: Tue, 16 April 2013 19:34]

Report message to a moderator

Re: Alter the location and the background color of EditPar [message #1043413 is a reply to message #1042666] Wed, 17 April 2013 17:21 Go to previous messageGo to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 55
Registered: February 2013
Member
Hi Fatla,

you can change the background color of the figure by using the default diagram actions, via the diagram-menu entries or the colorappearancepropertypage.
Either actions trigger commands to alter the settings within the editpart's notation model. This way, the information get's persisted and is present after diagram-reopening.
If you just change the color by setting the editparts resp. figure's background manually, this change will not be persisted.

Regards
Thomas
Re: Alter the location and the background color of EditPar [message #1043463 is a reply to message #1043413] Wed, 17 April 2013 18:36 Go to previous messageGo to next message
Fatla 777 is currently offline Fatla 777Friend
Messages: 13
Registered: April 2013
Junior Member
"Either actions trigger commands to alter the settings within the editpart's notation model."

Yes you are right about persistence.
I have manged to alter the location using the "ChangeBoundsRequest".

What kind of commands can I use to alter the color !


Re: Alter the location and the background color of EditPar [message #1043501 is a reply to message #1042666] Wed, 17 April 2013 19:53 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

Please see http://wiki.eclipse.org/GMF_Newsgroup_Q_and_A#How_do_I_change_the_color_of_a_line_using_an_action.3F

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: Alter the location and the background color of EditPar [message #1043598 is a reply to message #1043501] Wed, 17 April 2013 22:53 Go to previous message
Fatla 777 is currently offline Fatla 777Friend
Messages: 13
Registered: April 2013
Junior Member
Thanks it really helps Smile

@Aurelien: Beside this tutorial ,I had to enable the background filling of the element.
I made that by:
http://gmfsamples.tuxfamily.org/wiki/doku.php?id=gmf_tutorial9

Thanks for your assistance.
Previous Topic:Question on refreshing relations
Next Topic:TopNodeReference Creation
Goto Forum:
  


Current Time: Fri Apr 19 15:35:58 GMT 2024

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

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

Back to the top