viewerContext.refreshPage();
}
Container container = pnlInScroll.getParent();
if (container instanceof JViewport)
{
JViewport viewport = (JViewport) container;
int newX = (int)(anchorIndex.getElementAbsoluteX() * realZoom);
int newY = (int)(anchorIndex.getElementAbsoluteY() * realZoom);
int maxX = pnlInScroll.getWidth() - viewport.getWidth();
int maxY = pnlInScroll.getHeight() - viewport.getHeight();
if (newX < 0)
{
newX = 0;
}
if (newX > maxX)
{
newX = maxX;
}
if (newY < 0)
{
newY = 0;
}
if (newY > maxY)
{
newY = maxY;
}
viewport.setViewPosition(new Point(newX, newY));
}
}
break;
}
case LOCAL_PAGE :
{
int page = viewerContext.getPageIndex() + 1;
if (hyperlink.getHyperlinkPage() != null)
{
page = hyperlink.getHyperlinkPage().intValue();
}
if (page >= 1 && page <= viewerContext.getJasperPrint().getPages().size() && page != viewerContext.getPageIndex() + 1)
{
viewerContext.setPageIndex(page - 1);
viewerContext.refreshPage();
Container container = pnlInScroll.getParent();
if (container instanceof JViewport)
{
JViewport viewport = (JViewport) container;
viewport.setViewPosition(new Point(0, 0));
}
}
break;
}