question-circle Properties for Rectangle

1 year 7 months ago #4321 by kurales
Hi all,

I have one question. How can I define a label and some properties for the rectangle, which was created after call createDrawingRectangle-function?

For properties I wrote the following code, but it doesn't work:
dn = gf.createDrawingRectangle(layer, id, 30, 30, 150, 120);

	                   dn.setProperty("RECTANGLE_HALIGN", "LEFT");
	                   dn.setProperty("RECTANGLE_VALIGN", "TOP");

Please Log in or Create an account to join the conversation.

1 year 6 months ago #4342 by cma
Hello,

createDrawingRectangle(...) returns a org.modelio.diagram.api.dg.drawings.common.DiagramDrawingNodeDG .

This class has a setLabel(String) method to modify the label.

The following properties applies to the DiagramDrawingNodeDG label:
  • RECTANGLE_FONT : a string of the form fontname-style-height where fontname is the name of a font, style is a font style (one of "regular", "bold", "italic", or "bold italic") and height is an integer representing the font height. Example: "Times New Roman-bold-36".
  • RECTANGLE_TEXTCOLOR : a string of the form "red,green,blue" where red, green, and blue are valid integers.
  • RECTANGLE_HALIGN : Left, Center, Right. The case is important.
  • RECTANGLE_VALIGN :Top, Center, Bottom . The case is important.
  • RECTANGLE_TEXTALIGN : Left, Center, Right. The case is important.

Hopes it helps,

Cédric

Please Log in or Create an account to join the conversation.

1 year 6 months ago #4344 by kurales
Hi Cédric,

it returns IDiagramNode:
www.modelio.org/documentation/javadoc-3....mGraphicFactory.html

and this class has not a setLabel(String) method. Do you mean another version of Modelio or I'm doing something wrong?

With properties is all ok, my mistake was in the case.

Please Log in or Create an account to join the conversation.

1 year 6 months ago - 1 year 6 months ago #4345 by cma
Exact, the interface specified it returns a IDiagramNode, that does not define setLabel() .
This is a missing feature of the public API.

As a workaround you may cast the returned IDiagramNode to DiagramDrawingNodeDG then call setLabel() on it.
As it is an internal class your code might not be compatible with future Modelio releases.
The following user(s) said Thank You: kurales

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.030 seconds
^ Back to Top