Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to chnage the color of diagram elements
how to chnage the color of diagram elements [message #128355] Wed, 23 May 2007 07:56 Go to next message
Eclipse UserFriend
Originally posted by: bhatia1984.yahoo.com

hiiii

i want to give some default color to my diagram element when they are
created For eg yellow .By default GMF gave white color to diagram element.

when i try to set the defaule color to yellow then i am not able to change
there color to sum other color.

i also want that user cn change the color of diagram element acc to his
own choice .

thanks
Varun Bhatia
Re: how to chnage the color of diagram elements [message #128435 is a reply to message #128355] Wed, 23 May 2007 08:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

Look in the attachment. Does it ring a bell? :-)


"varun" <bhatia1984@yahoo.com> wrote in message
news:a975d0fd417650f615cb2119ec953cce$1@www.eclipse.org...
> hiiii
>
> i want to give some default color to my diagram element when they are
> created For eg yellow .By default GMF gave white color to diagram element.
>
> when i try to set the defaule color to yellow then i am not able to change
> there color to sum other color.
>
> i also want that user cn change the color of diagram element acc to his
> own choice .
>
> thanks
> Varun Bhatia
>


Re: how to chnage the color of diagram elements [message #128451 is a reply to message #128435] Wed, 23 May 2007 09:40 Go to previous messageGo to next message
shawn xing is currently offline shawn xingFriend
Messages: 8
Registered: July 2009
Junior Member
hi
How can I see the attachment,it just display as below

///////////////////////////////////////////////
Re: how to chnage the color of diagram elements [message #128477 is a reply to message #128451] Wed, 23 May 2007 10:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

shawn wrote:
> hi
> How can I see the attachment,it just display as below

[snipped image]

Looks like your news/mail client doesn't properly recognize base64
encoded attachments.
Re: how to chnage the color of diagram elements [message #128612 is a reply to message #128451] Wed, 23 May 2007 12:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

Try the "Paint" program (Start/Programs/Accessories/Paint - for Windows
users)


"shawn" <xingshaomin@gmail.com> wrote in message
news:a3d3f5605cdbb7063da2e05a82d8dd6f$1@www.eclipse.org...
> hi
> How can I see the attachment,it just display as below
>
> ///////////////////////////////////////////////
>
Re: how to chnage the color of diagram elements [message #128664 is a reply to message #128355] Wed, 23 May 2007 12:56 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello varun,

Modify generated ???ViewFactory.createStyles() and set default color value
there.

-----------------
Alex Shatalin
Re: how to chnage the color of diagram elements [message #129038 is a reply to message #128664] Thu, 24 May 2007 05:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhatia1984.yahoo.com

hi Alex

i have modify generated createStyle() method in view factory bt still the
default color is white.

does i hv to make any change in ???EditPart class also.

these are the chnages i hv done in createStyle() method:

protected List<Style> createStyles(View view) {

List<Style> styles = new ArrayList<Style>();

FillStyle style = NotationFactory.eINSTANCE.createFillStyle();

style.setFillColor(12632256);
styles.add(style);

return styles;
}

Thanks
Varun Bhatia
Re: how to chnage the color of diagram elements [message #129116 is a reply to message #129038] Thu, 24 May 2007 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

This should work for the newly created elements; don't expect to reopen
diagram and see all existing nodes in other colour.

varun wrote:
> hi Alex
>
> i have modify generated createStyle() method in view factory bt still
> the default color is white.
>
> does i hv to make any change in ???EditPart class also.
>
> these are the chnages i hv done in createStyle() method:
>
> protected List<Style> createStyles(View view) {
>
> List<Style> styles = new ArrayList<Style>();
>
> FillStyle style = NotationFactory.eINSTANCE.createFillStyle();
>
> style.setFillColor(12632256);
> styles.add(style);
>
> return styles;
> }
>
> Thanks
> Varun Bhatia
>
Re: how to chnage the color of diagram elements [message #129322 is a reply to message #129116] Thu, 24 May 2007 11:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhatia1984.yahoo.com

hiiii

Even for newly created element it doesnt changing the color.


I print the style instance which i hv created in createStyle() method &
style instance in inner class ???Figure of Editpart class both style
object hv same refernce bt in createStyle() methid it shows fill color id
8905185(this is what i am setting)

but in edit part class it shows 16777215.this is the default color id
which GMF provides.

thanks
varun bhatia
Re: how to chnage the color of diagram elements [message #129370 is a reply to message #129322] Thu, 24 May 2007 12:36 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello varun,

Sorry for pointing you to the wrong place. Try setting correct color in ???ViewFactory.decorateView()
method _after_ calling super.decorateView(). This call (super.decorateView())
will change the color value to the default one stored in preferences.

-----------------
Alex Shatalin
Re: how to chnage the color of diagram elements [message #129740 is a reply to message #129370] Fri, 25 May 2007 05:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bhatia1984.yahoo.com

Thanks Alex ! It works
Re: how to chnage the color of diagram elements [message #1220859 is a reply to message #129370] Sat, 14 December 2013 14:35 Go to previous message
Colin Snook is currently offline Colin SnookFriend
Messages: 18
Registered: July 2009
Location: University of Southampton
Junior Member
Hi,

Is this solution outdated? I cannot find any ???ViewFactory in my newer diagram plugins.
I guess I would instead change the create??? methods in a ???ViewProvider now.

However, I think it would be nicer to have some default colours but let my user change the default preferences in her installation so I overrode the fillColor setting in initDefaults in my generated DiagramAppearancePreferencePage. The downside is that this default is for all kinds of nodes in my diagram. I guess I could set up preferences for each of my node kinds in this class? Does this sound a good way to go?

Thanks
Colin
Previous Topic:Drag & Drop from TreeView to GMF Editor
Next Topic:SemanticEditPolicy.completeRequest() behavior question
Goto Forum:
  


Current Time: Thu Mar 28 21:41:52 GMT 2024

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

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

Back to the top