* - the presentation figure is supported by this method<br>
* or null otherwise.
*/
private static Figure getOverlay(Object owner, XFigure [] overlayFigures)
{
Figure presentationFigure = null;
// Determine the presentation figure of the owner
if (owner instanceof VisualElement)
presentationFigure = ((VisualElement) owner).getPresentationFigure();
else if (owner instanceof Figure)
presentationFigure = (Figure) owner;
if (presentationFigure != null)
{
// Check if we support this type of figure
Class presentationClass = presentationFigure.getClass();
for (int i = 0; i < overlayFigures.length; ++i)
{
XFigure figure = overlayFigures [i];
if (figure.getClass().isAssignableFrom(presentationClass))
{
// Yes, we do. Adjust the overlay figure position and orientation accordingly and return it
figure.displayBox(presentationFigure.displayBox());
if (presentationFigure instanceof XFigure)
{
figure.setOrientation(((XFigure) presentationFigure).getOrientation());
}