Community
Participate
Working Groups
Build Identifier: M20110210-1200 If defined a style with .setHorizontalAlignment(Orientation.ALIGNMENT_CENTER) a text with that style has alignment left Reproducible: Always Steps to Reproduce: 1.define a style with .setHorizontalAlignment(Orientation.ALIGNMENT_CENTER) 2.set defined style to a Text element 3.check Text getHorizontalAlignment()
This is as expected: the method getHorizontalAlignment is just a dumb metamodel method that simply returns the value of that attribute and knows nothing about styles. You should use the method getHorizontalAlignment in IGaService if you are interested in styles as well; this method is also used by the framework when the value is retrieved from an object in the diagram.
(In reply to comment #1) > This is as expected: the method getHorizontalAlignment is just a dumb metamodel > method that simply returns the value of that attribute and knows nothing about > styles. You should use the method getHorizontalAlignment in IGaService if you > are interested in styles as well; this method is also used by the framework > when the value is retrieved from an object in the diagram. the real bug is the graphical presentation of Text is not centered if I don't call directly setHorizontalAlignment on Text element (excuse for my engrish)
Sorry for the misunderstanding. Now I see the issue, there's a default value for that attribute, so the value from the style is never drawn.
Graphiti has some default values for GA attributes. This makes sense for start-up phases when building graphical tools. If you want to work with styles, you have to reset these attributes in the GAs because they have higher priority. In your case you can do the reset as follows: <textGa>.setHorizontalAlignment(Orientation.UNSPECIFIED); Please let us know if this solution is not really valid.
(In reply to comment #4) > Graphiti has some default values for GA attributes. This makes sense for > start-up phases when building graphical tools. If you want to work with styles, > you have to reset these attributes in the GAs because they have higher > priority. > In your case you can do the reset as follows: > <textGa>.setHorizontalAlignment(Orientation.UNSPECIFIED); > Please let us know if this solution is not really valid. I want to use style for every GA. Is possible to use default style in place of default value for property. with current implementation i'm forced to reset the property of every created GA or don't use GaService.
(In reply to comment #5) > (In reply to comment #4) > > Graphiti has some default values for GA attributes. This makes sense for > > start-up phases when building graphical tools. If you want to work with styles, > > you have to reset these attributes in the GAs because they have higher > > priority. > > In your case you can do the reset as follows: > > <textGa>.setHorizontalAlignment(Orientation.UNSPECIFIED); > > Please let us know if this solution is not really valid. > > I want to use style for every GA. > Is possible to use default style in place of default value for property. > > with current implementation i'm forced to reset the property of every created > GA > or don't use GaService. the problem is also for font,lineWidth,lineStyle,transparency
Having a default style is currently not supported by Graphiti. If you would like to see that, please open an enhancement bugzilla requesting that. Sorry for the late reply! Michael
One further comment from my side: I've opened a Bugzilla for checking the feasibility of the styles concept as it is implemented today. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=352542