|
|
|
|
Re: How to invoke direct editing programatically? [message #730859 is a reply to message #668569] |
Thu, 29 September 2011 11:58 |
Michael Messages: 1 Registered: September 2011 |
Junior Member |
|
|
Hi,
i just ran into this error in the tutorial too. // SHAPE WITH TEXT
{
// create shape for text
Shape shape = peCreateService.createShape(containerShape, false);
// create and set text graphics algorithm
Text text = gaService.createDefaultText(getDiagram(), shape, addedClass.getName());
text.setForeground(manageColor(CLASS_TEXT_FOREGROUND));
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
text.getFont().setBold(true);
gaService.setLocationAndSize(text, 0, 0, width, 20);
// create link and wire it
link(shape, addedClass);
// provide information to support direct-editing directly
// after object creation (must be activated additionally)
IDirectEditingInfo directEditingInfo =
getFeatureProvider().getDirectEditingInfo();
// activate direct editing after object creation
getFeatureProvider().getDirectEditingInfo().setActive(true);
// set container shape for direct editing after object creation
directEditingInfo.setMainPictogramElement(containerShape);
// set shape and graphics algorithm where the editor for
// direct editing shall be opened after object creation
directEditingInfo.setPictogramElement(shape);
directEditingInfo.setGraphicsAlgorithm(text);
This way it works fine. You can another mistake in the corresponding code from the tutorial:
Quote: text.setHorizontalAlignment(OrientationEnum.ALIGNMENT_CENTER);
text.setVerticalAlignment(OrientationEnum.ALIGNMENT_CENTER);
should be:
Quote: text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
I use Ubuntu 11.04 with gnome.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04065 seconds