| Label-text doesn`t have the right color [message #214139] |
Wed, 24 December 2008 04:36  |
|
Originally posted by: cayla_sha.gmx.net
Hello!
I have some labels and I want the text of this labels in a certain color
(not black).
I made a label in the *.gmfgraph-file with a child Foreground Color. It
looks like this:
Figure Descriptor SomeFigure
|_ Rectangle SomeRectangle
|_ Grid Layout 2
|_ Label MyLabel
|_ Grid Layout Data true
|_ Foreground: blue
|_ Basic Font Tahoma (Height: 8)
But in the editor the label-text is black.
In the EditPart of the Rectangle the labels foreground-color is set to
blue but apparently the editor doesn`t care about that.
I already tried to switch the order of the settings inside the EditPart,
so that the color is set first, than the font and finally the text. And
I tried other combinations as well. But this didn`t change anything.
Where is the error? How can I make the label-text blue?
Merry Christmas!
Julia
|
|
|
| Re: Label-text doesn`t have the right color [message #214213 is a reply to message #214139] |
Sun, 28 December 2008 10:38   |
|
Originally posted by: cayla_sha.gmx.net
PS:
I have some new information regarding the font-color.
First in the EditPart of the figure, which holds the label, the
foregroundcolor of the label is set to blue.
But after this, the foregroundcolor is set back to black inside of the
EditPart of the label itself.
There is this Method: <LabelName>EditPart.setFontColor(Color c). This
Method is called from GraphicalEditPart.refreshFontColor() - and this
method has the totally wrong values.
The method refreshFontColor() fetches the FontStyle in this line:
FontStyle style = (FontStyle)
getPrimaryView().getStyle(NotationPackage.Literals.FONT_STYL E);
And when I look into the variable "style" during debugging it has
fontHeight=9 and fontColor=0, although I set different values in the
gmfgraph-file.
That means, that somewhere in this NotationPackage a wrong value is set.
But I don`t understand this concept with this NotationPackage.
NotationPackage itself is just an interface. I can`t find an
implementation. But there must be a file in my generated Code which
holds all the styles and this file has the wrong values.
Can anyone help me?
|
|
|
|
|
|
|
| Re: Label-text doesn`t have the right color [message #221818 is a reply to message #216984] |
Wed, 18 March 2009 12:55  |
Andreas Schoeneck Messages: 22 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
--------------070707050601080205040103
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Hi Alex,
> I do not remember any other. Can you debug the code to see why incorrect
> color was used?
I am not Robert, but I experience the same problem. The problem seems
that getFontStyleOwnerView() is never called (directly or indirectly) by
refreshFontColor(). It is likely to be called by refreshFontUnderline(),
refreshStrikeThrough() and refreshFont().
refreshFontColor() is a call to GraphicalEditPart, i.e. it doesn't get
overwritten/there's no explicit implementation in the generated class.
From there standard color behavior is assumed as you explained.
Adding the following method to the **Label*EditPart classes does the trick:
@Override
protected void refreshFontColor() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if ( style != null ) {
setFontColor(DiagramColorRegistry.getInstance().
getColor(new Integer(style.getFontColor())));
}
}
Though this method should be added by the generator in appropriate
cases, I think.
Regards
Andy
--------------070707050601080205040103
Content-Type: text/x-vcard; charset=utf-8;
name="as_maps.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="as_maps.vcf"
YmVnaW46dmNhcmQNCmZuOkFuZHJlYXMgU2Nob2VuZWNrDQpuOlNjaG9lbmVj aztBbmRyZWFz
DQplbWFpbDtpbnRlcm5ldDphcy5tYXBzQGdtYWlsLmNvbQ0KeC1tb3ppbGxh LWh0bWw6RkFM
U0UNCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------070707050601080205040103--
|
|
|
Powered by
FUDForum. Page generated in 0.07710 seconds