Collection elements = page.getElements();
if (elements != null && elements.size() > 0) {
String toolTip = null;
JPanel link = null;
JRPrintElement element = null;
JRPrintHyperlink hyperlink = null;
for (Iterator it = elements.iterator(); it.hasNext();) {
element = (JRPrintElement) it.next();
if (element instanceof JRPrintHyperlink
&& ((JRPrintHyperlink) element).getHyperlinkType() != JRHyperlink.HYPERLINK_TYPE_NONE) {
hyperlink = (JRPrintHyperlink) element;
link = new JPanel();
link.setCursor(new Cursor(Cursor.HAND_CURSOR));
link.setLocation((int) (element.getX() * realZoom),
(int) (element.getY() * realZoom));
link.setSize((int) (element.getWidth() * realZoom),
(int) (element.getHeight() * realZoom));
link.setOpaque(false);
toolTip = null;
switch (hyperlink.getHyperlinkType()) {
case JRHyperlink.HYPERLINK_TYPE_REFERENCE:
toolTip = hyperlink.getHyperlinkReference();
break;
case JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR:
if (hyperlink.getHyperlinkAnchor() != null) {
toolTip = "#" + hyperlink.getHyperlinkAnchor();
}
break;
case JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE:
if (hyperlink.getHyperlinkPage() != null) {
toolTip = "#page " + hyperlink.getHyperlinkPage();
}
break;
case JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR:
toolTip = "";
if (hyperlink.getHyperlinkReference() != null) {
toolTip = toolTip
+ hyperlink.getHyperlinkReference();
}
if (hyperlink.getHyperlinkAnchor() != null) {
toolTip = toolTip + "#"
+ hyperlink.getHyperlinkAnchor();
}
break;
case JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE:
toolTip = "";
if (hyperlink.getHyperlinkReference() != null) {
toolTip = toolTip
+ hyperlink.getHyperlinkReference();
}
if (hyperlink.getHyperlinkPage() != null) {
toolTip = toolTip + "#page "
+ hyperlink.getHyperlinkPage();
}
break;
default:
break;