I have this method that clicks to a position relative to the center of a NamedFigure:
- Code: Select all
protected IWidgetLocator clickOnFigureCenterInDiagramWithOffset(String prefix, String figureName, int xOffset, int yOffset) throws Exception
{
System.out.println("clickOnFigureCenterInDiagramWithOffset" + figureName + xOffset + yOffset);
moveMouseToDiagramOrigin();
boolean isClickable = true;
NamedFigureLocator locator = new NamedFigureLocator(prefix + figureName);
int figureCenterX = getFigureCenterXOffset(prefix + figureName);
int figureCenterY = getFigureCenterYOffset(prefix + figureName);
ILocator clickLocation = new XYLocator(locator, figureCenterX + xOffset, figureCenterY + yOffset);
IWidgetLocator widgetThatWasClickedOn = null;
try
{
widgetThatWasClickedOn = ui.click(clickLocation);
}
catch (Exception e)
{
isClickable = false;
}
assertTrue("Can't click on the Figure: \"" + prefix + figureName + "\" with offset x = " + xOffset + ", y = " + yOffset, isClickable);
/*
* TODO Right now, this always returns a
* "com.windowtester.runtime.gef.internal.FigureReference". Find a way
* to return the Class Type or getFigureId() of the clicked location.
*/
return widgetThatWasClickedOn;
}
Is there a way to resolve that FigureReference (widgetThatWasClickedOn) so I can get the type of the Figure that was clicked on?
I wanna do something like:
- Code: Select all
if (clickedOnFigure.getFigureId().contains "Foobar")
System.out.println("A Foobar-Figure was clicked");
Thanks in advance.