org.jfree.chart.entity.CategoryItemEntity Java Examples

The following examples show how to use org.jfree.chart.entity.CategoryItemEntity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCategoryItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #2
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #3
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #4
Source File: AbstractCategoryItemRenderer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #5
Source File: AbstractCategoryItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #6
Source File: BarChartPanel.java    From nmonvisualizer with Apache License 2.0 6 votes vote down vote up
@Override
public void chartMouseClicked(ChartMouseEvent event) {
    if (event.getEntity().getClass() == CategoryItemEntity.class) {
        if ((getChart() != null) && (getChart().getClass() == HighlightableBarChart.class)) {
            HighlightableBarChart chart = (HighlightableBarChart) getChart();
            CategoryItemEntity entity = (CategoryItemEntity) event.getEntity();

            // toggle highlight if already selected
            if (chart.isHighlighted(entity)) {
                chart.clearHighlights();

                firePropertyChange("highlightedBar", getRowAndColumn(entity), null);
            }
            else {
                chart.clearHighlights();
                chart.highlightEntity(entity);

                firePropertyChange("highlightedBar", null, getRowAndColumn(entity));
            }

            // assume whatever fired the event will repaint the chart
        }
    }
}
 
Example #7
Source File: CategoryChartHyperlinkProvider.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
{
	JRPrintHyperlink printHyperlink = null;
	if (hasHyperlinks() && entity instanceof CategoryItemEntity)
	{
		CategoryItemEntity itemEntity = (CategoryItemEntity) entity;
		Comparable<?> serie = itemEntity.getRowKey();
		Map<Comparable<?>,JRPrintHyperlink> serieHyperlinks = itemHyperlinks.get(serie);
		if (serieHyperlinks != null)
		{
			Comparable<?> category = itemEntity.getColumnKey();
			printHyperlink = serieHyperlinks.get(category);
		}
	}
	return printHyperlink;
}
 
Example #8
Source File: AbstractCategoryItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #9
Source File: AbstractCategoryItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot, but only if an entity 
 * collection is accessible via the renderer state.
 * 
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot.
 */
protected void addItemEntity(EntityCollection entities, 
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {

    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url, 
            dataset, row, dataset.getColumnKey(column), column);
    entities.add(entity);

}
 
Example #10
Source File: AbstractCategoryItemRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot.
 */
protected void addItemEntity(EntityCollection entities,
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {

    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);

}
 
Example #11
Source File: ChartJFreeChartOutputRadar.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void getModelCoordinatesInfo(final int xOnScreen, final int yOnScreen, final IDisplaySurface g,
		final Point positionInPixels, final StringBuilder sb) {
	final int x = xOnScreen - positionInPixels.x;
	final int y = yOnScreen - positionInPixels.y;
	final ChartEntity entity = info.getEntityCollection().getEntity(x, y);
	// getChart().handleClick(x, y, info);

	final Comparable<?> columnKey = ((CategoryItemEntity) entity).getColumnKey();
	final String title = columnKey.toString();
	final CategoryDataset data = ((CategoryItemEntity) entity).getDataset();
	final Comparable<?> rowKey = ((CategoryItemEntity) entity).getRowKey();
	final double xx = data.getValue(rowKey, columnKey).doubleValue();
	final boolean xInt = xx % 1 == 0;
	sb.append(title).append(" ").append(xInt ? (int) xx : String.format("%.2f", xx));

}
 
Example #12
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.0.13
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
                         CategoryDataset dataset, int row, int column,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #13
Source File: CategoryItemEntityTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DefaultCategoryDataset d = new DefaultCategoryDataset();
    d.addValue(1.0, "R1", "C1");
    d.addValue(2.0, "R1", "C2");
    d.addValue(3.0, "R2", "C1");
    d.addValue(4.0, "R2", "C2");
    CategoryItemEntity e1 = new CategoryItemEntity(new Rectangle2D.Double(
            1.0, 2.0, 3.0, 4.0), "ToolTip", "URL", d, "R2", "C2"); 
    CategoryItemEntity e2 = new CategoryItemEntity(new Rectangle2D.Double(
            1.0, 2.0, 3.0, 4.0), "ToolTip", "URL", d, "R2", "C2"); 
    assertTrue(e1.equals(e2));  
    
    e1.setArea(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertFalse(e1.equals(e2));
    e2.setArea(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertTrue(e1.equals(e2));  

    e1.setToolTipText("New ToolTip");
    assertFalse(e1.equals(e2));
    e2.setToolTipText("New ToolTip");
    assertTrue(e1.equals(e2));  

    e1.setURLText("New URL");
    assertFalse(e1.equals(e2));
    e2.setURLText("New URL");
    assertTrue(e1.equals(e2));  
    
    e1.setColumnKey("C1");
    assertFalse(e1.equals(e2));
    e2.setColumnKey("C1");
    assertTrue(e1.equals(e2)); 
    
    e1.setRowKey("R1");
    assertFalse(e1.equals(e2));
    e2.setRowKey("R1");
    assertTrue(e1.equals(e2)); 
    
}
 
Example #14
Source File: AbstractCategoryItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #15
Source File: JFreeChartReportDrawable.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void draw( final Graphics2D graphics2D, final Rectangle2D bounds ) {
  this.bounds = (Rectangle2D) bounds.clone();
  if ( chartRenderingInfo != null ) {
    this.chartRenderingInfo.clear();
  }
  final Graphics2D g2 = (Graphics2D) graphics2D.create();
  this.chart.draw( g2, bounds, chartRenderingInfo );
  g2.dispose();

  if ( chartRenderingInfo == null || debugRendering == false ) {
    return;
  }

  graphics2D.setColor( Color.RED );
  final Rectangle2D dataArea = getDataAreaOffset();
  final EntityCollection entityCollection = chartRenderingInfo.getEntityCollection();
  for ( int i = 0; i < entityCollection.getEntityCount(); i++ ) {
    final ChartEntity chartEntity = entityCollection.getEntity( i );
    if ( chartEntity instanceof XYItemEntity ||
      chartEntity instanceof CategoryItemEntity ||
      chartEntity instanceof PieSectionEntity ) {
      final Area a = new Area( chartEntity.getArea() );
      if ( buggyDrawArea ) {
        a.transform( AffineTransform.getTranslateInstance( dataArea.getX(), dataArea.getY() ) );
      }
      a.intersect( new Area( dataArea ) );
      graphics2D.draw( a );
    } else {
      graphics2D.draw( chartEntity.getArea() );
    }
  }
}
 
Example #16
Source File: Elixir_000_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #17
Source File: Elixir_000_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #18
Source File: jMutRepair_0020_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #19
Source File: jMutRepair_0020_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #20
Source File: CategoryItemEntityTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DefaultCategoryDataset d = new DefaultCategoryDataset();
    d.addValue(1.0, "R1", "C1");
    d.addValue(2.0, "R1", "C2");
    d.addValue(3.0, "R2", "C1");
    d.addValue(4.0, "R2", "C2");
    CategoryItemEntity e1 = new CategoryItemEntity(new Rectangle2D.Double(
            1.0, 2.0, 3.0, 4.0), "ToolTip", "URL", d, "R2", "C2");
    CategoryItemEntity e2 = new CategoryItemEntity(new Rectangle2D.Double(
            1.0, 2.0, 3.0, 4.0), "ToolTip", "URL", d, "R2", "C2");
    assertTrue(e1.equals(e2));

    e1.setArea(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertFalse(e1.equals(e2));
    e2.setArea(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0));
    assertTrue(e1.equals(e2));

    e1.setToolTipText("New ToolTip");
    assertFalse(e1.equals(e2));
    e2.setToolTipText("New ToolTip");
    assertTrue(e1.equals(e2));

    e1.setURLText("New URL");
    assertFalse(e1.equals(e2));
    e2.setURLText("New URL");
    assertTrue(e1.equals(e2));

    e1.setColumnKey("C1");
    assertFalse(e1.equals(e2));
    e2.setColumnKey("C1");
    assertTrue(e1.equals(e2));

    e1.setRowKey("R1");
    assertFalse(e1.equals(e2));
    e2.setRowKey("R1");
    assertTrue(e1.equals(e2));

}
 
Example #21
Source File: jMutRepair_000_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #22
Source File: jMutRepair_000_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #23
Source File: jKali_0031_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #24
Source File: jKali_0031_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #25
Source File: jKali_0019_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #26
Source File: jKali_0019_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #27
Source File: jKali_000_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #28
Source File: jKali_000_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
        CategoryDataset dataset, int row, int column, boolean selected,
        double entityX, double entityY) {
    if (!getItemCreateEntity(row, column, selected)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getURLGenerator(row, column, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
 
Example #29
Source File: BarChartPanel.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
private int[] getRowAndColumn(CategoryItemEntity entity) {
    int[] toReturn = new int[2];

    toReturn[0] = entity.getDataset().getRowIndex(entity.getRowKey());
    toReturn[1] = entity.getDataset().getColumnIndex(entity.getColumnKey());

    return toReturn;
}
 
Example #30
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param hotspot  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param row  the series.
 * @param column  the item.
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.0.13
 */
protected void addEntity(EntityCollection entities, Shape hotspot,
                         CategoryDataset dataset, int row, int column,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    Shape s = hotspot;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    CategoryToolTipGenerator generator = getToolTipGenerator(row, column);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(s, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}