- Code: Select all
ui.click(new ByTextFigureLocator("TestClass1"));
However I can't find a way to locate a PolylineConnection (example: <<implements>> arrow) connecting two Figures (example: Class and Interface).
When using the recorder and click on the Interface, then Class and then on the arrow connecting them, I get something like this:
- Code: Select all
IUIContext ui = getUI();
ui.click(new NamedEditPartFigureLocator("TestInterface"));
ui.click(new NamedEditPartFigureLocator("TestClass1"));
ui.click(new LRLocator(5, new LabelLocator()));
ui.click(new LRLocator(1, new ClassDependencyConnectionFigureLocator()));
ui.click(new LRLocator(1, new PolygonDecorationLocator()));
It's a bit different every time when recording, and when playing it black, it actually does not click on the Polyline at all.
ClassDependencyConnectionFigure extends PolylineConnection and basically just adds the arrowhead and label to the connection:
- Code: Select all
public class ClassDependencyConnectionFigure extends PolylineConnection implements PresentationFigure
{
//[...]
protected void createStereotypes()
{
if (stereotypes == null)
{
stereotypes = new Label();
stereotypes.setText("«implements»");
stereotypes.setOpaque(true);
}
if (!stereotypeAdded)
{
add(stereotypes, new ConnectionLocator(this, ConnectionLocator.MIDDLE));
stereotypeAdded = true;
}
}
protected void removeStereotypes()
{
if (stereotypes != null)
{
remove(stereotypes);
stereotypeAdded = false;
}
}
protected void updateStereotypes()
{
createStereotypes();
if (!showLinkStereotype(link))
{
removeStereotypes();
}
}
//[...]
}
I'd love to be able to locate the <<implements>>arrow between the Interface and Class with something like
- Code: Select all
ui.click(new LabeledLocator(ClassDependencyConnectionFigure.class, "«implements»", myTestInterface, myTestClass));
Is there a way to teach WindowTester new Locators? It's frustrating having a labeled thing in GEF and no way to locate it with WindowTester.
I appreciate any help, even if it's "you can't locate Polylines right now, sorry."