/** * Returns a clone of the entity. * * @return A clone. * * @throws CloneNotSupportedException if there is a problem cloning the * entity. */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
/** * Tests the entity for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ContourEntity && super.equals(obj)) { ContourEntity ce = (ContourEntity) obj; if (this.index != ce.index) { return false; } return true; } return false; }
/** * Returns the shape coordinates as a string. * * @return The shape coordinates (never {@code null}). */ public String getShapeCoords() { if (this.area instanceof Rectangle2D) { return getRectCoords((Rectangle2D) this.area); } else { return getPolyCoords(this.area); } }
while (iter.hasNext()) { ChartEntity ce = (ChartEntity) iter.next(); String shapeType = ce.getShapeType(); String shapeCoords = ce.getShapeCoords(); String tooltipText = ce.getToolTipText(); String urltext = ce.getURLText();
for (int i = count - 1; i >= 0; i--) { ChartEntity entity = entities.getEntity(i); if (entity.getToolTipText() != null || entity.getURLText() != null) { String area = entity.getImageMapAreaTag( toolTipTagFragmentGenerator, urlTagFragmentGenerator);
: !this.toolTipText.equals("")); if (hasURL || hasToolTip) { tag.append("<area shape=\"").append(getShapeType()).append("\"") .append(" coords=\"").append(getShapeCoords()).append("\""); if (hasToolTip) { tag.append(toolTipTagFragmentGenerator.generateToolTipFragment(
static Map<Shape, String> buildShapeLinkMap(ChartRenderingInfo renderingInfo, int dotsPerPixel) { Map<Shape, String> linkShapes = null; AffineTransform scaleTransform = new AffineTransform(); scaleTransform.scale(dotsPerPixel, dotsPerPixel); for (Object entity : renderingInfo.getEntityCollection().getEntities()) { if (!(entity instanceof ChartEntity)) continue; ChartEntity chartEntity = (ChartEntity) entity; Shape shape = chartEntity.getArea(); String url = chartEntity.getURLText(); if (url != null) { if (linkShapes == null) linkShapes = new HashMap<Shape, String>(); linkShapes.put(scaleTransform.createTransformedShape(shape), url); } } return linkShapes; }
private static int[] getCoordinates(ChartEntity entity) { int[] coordinates = null; String shapeCoords = entity.getShapeCoords(); if (shapeCoords != null && shapeCoords.length() > 0) { StringTokenizer tokens = new StringTokenizer(shapeCoords, ","); coordinates = new int[tokens.countTokens()]; int idx = 0; while (tokens.hasMoreTokens()) { String coord = tokens.nextToken(); coordinates[idx] = Integer.parseInt(coord); ++idx; } } return coordinates; }
private static JRPrintImageArea getImageArea(ChartEntity entity) { JRPrintImageArea area = new JRPrintImageArea(); area.setShape(JRPrintImageArea.getShape(entity.getShapeType())); int[] coordinates = getCoordinates(entity); if (coordinates != null) { area.setCoordinates(coordinates); } return area; }
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or {@code null} if no tooltip is available. */ @Override public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
/** * Returns the last entity in the list with an area that encloses the * specified coordinates, or {@code null} if there is no such entity. * * @param x the x coordinate. * @param y the y coordinate. * * @return The entity (possibly {@code null}). */ @Override public ChartEntity getEntity(double x, double y) { int entityCount = this.entities.size(); for (int i = entityCount - 1; i >= 0; i--) { ChartEntity entity = (ChartEntity) this.entities.get(i); if (entity.getArea().contains(x, y)) { return entity; } } return null; }
if (ebp != null && sec != null) { if (this.toolTipText != null || this.urlText != null) { ChartEntity entity = new ChartEntity(entityArea, this.toolTipText, this.urlText); sec.add(entity);
for(Iterator it=jfinfo.getEntityCollection().iterator();it.hasNext();) { ChartEntity ce = ( ChartEntity ) it.next(); final String url = ce.getURLText(); Area area = new Area(); area.setParent(chart); area.setCoords(ce.getShapeCoords()); area.setShape(ce.getShapeType()); area.setId("area_"+chart.getId()+'_'+(j++)); if (chart.isShowTooltiptext() && ce.getToolTipText() != null) { area.setTooltiptext(ce.getToolTipText()); area.setAttribute("url", ce.getURLText()); impl.render(chart, area, ce); if (chart.getAreaListener() != null) {
for (int i = count - 1; i >= 0; i--) { ChartEntity entity = entities.getEntity(i); if (entity.getToolTipText() != null || entity.getURLText() != null) { String area = entity.getImageMapAreaTag( toolTipTagFragmentGenerator, urlTagFragmentGenerator);
: !this.toolTipText.equals("")); if (hasURL || hasToolTip) { tag.append("<area shape=\"" + getShapeType() + "\"" + " coords=\"" + getShapeCoords() + "\""); if (hasToolTip) { tag.append(toolTipTagFragmentGenerator.generateToolTipFragment(
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
/** * Returns the last entity in the list with an area that encloses the * specified coordinates, or <code>null</code> if there is no such entity. * * @param x the x coordinate. * @param y the y coordinate. * * @return The entity (possibly <code>null</code>). */ public ChartEntity getEntity(double x, double y) { int entityCount = this.entities.size(); for (int i = entityCount - 1; i >= 0; i--) { ChartEntity entity = (ChartEntity) this.entities.get(i); if (entity.getArea().contains(x, y)) { return entity; } } return null; }
if (ebp != null && sec != null) { if (this.toolTipText != null || this.urlText != null) { ChartEntity entity = new ChartEntity(entityArea, this.toolTipText, this.urlText); sec.add(entity);
/** * Returns a clone of the entity. * * @return A clone. * * @throws CloneNotSupportedException if there is a problem cloning the * entity. */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
/** * Tests the entity for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYAnnotationEntity)) { return false; } XYAnnotationEntity that = (XYAnnotationEntity) obj; if (this.rendererIndex != that.rendererIndex) { return false; } return true; }