private void initHypelinks() { links.clear(); if (page == null) return; List<JRPrintElement> elements = page.getElements(); if (elements == null) return; for (JRPrintElement element : elements) { if (element instanceof JRPrintImage) { Renderable r = ((JRPrintImage) element).getRenderable(); if (r instanceof ImageMapRenderable) { try { List<JRPrintImageAreaHyperlink> hyperlinks = ((ImageMapRenderable) r).getImageAreaHyperlinks(new java.awt.Rectangle(0, 0, element.getWidth(), element.getHeight())); if (hyperlinks != null) links.add(new ImageAreaHyperlink(element.getX(), element.getY(), hyperlinks)); } catch (JRException e) { throw new RuntimeException(e); } } } else if (element instanceof JRPrintHyperlink && !((JRPrintHyperlink) element).getHyperlinkTypeValue().equals(HyperlinkTypeEnum.NONE)) links.add(new PrintHyperlink(0, 0, element)); } }
public ImageMapPanel(Rectangle renderingArea, ImageMapRenderable imageMap) { try { imageAreaHyperlinks = imageMap.getImageAreaHyperlinks(renderingArea);//FIXMECHART } catch (JRException e) { throw new JRRuntimeException(e); } addMouseListener(this); addMouseMotionListener(this); }