Package org.jfree.chart.entity

Examples of org.jfree.chart.entity.StandardEntityCollection


    */
   public Object draw(Graphics2D g2, Rectangle2D area, Object params)
   {
      Rectangle2D target = (Rectangle2D) area.clone();
      Rectangle2D hotspot = (Rectangle2D) area.clone();
      StandardEntityCollection sec = null;
      if (params instanceof EntityBlockParams
              && ((EntityBlockParams) params).getGenerateEntities())
      {
         sec = new StandardEntityCollection();
         sec.add(new TitleEntity(hotspot, this));
      }
      target = trimMargin(target);
      if (this.backgroundPaint != null)
      {
         g2.setPaint(this.backgroundPaint);
         g2.fill(target);
      }
      BlockFrame border = getFrame();
      border.draw(g2, target);
      border.getInsets().trim(target);
      BlockContainer container = this.wrapper;
      if (container == null)
      {
         container = this.items;
      }
      target = trimPadding(target);
      Object val = container.draw(g2, target, params);
      if (val instanceof BlockResult)
      {
         EntityCollection ec = ((BlockResult) val).getEntityCollection();
         if (ec != null && sec != null)
         {
            sec.addAll(ec);
            ((BlockResult) val).setEntityCollection(sec);
         }
      }
      return val;
   }
View Full Code Here


        area = trimBorder(area);
        area = trimPadding(area);
       
        // check if we need to collect chart entities from the container
        EntityBlockParams ebp = null;
        StandardEntityCollection sec = null;
        Shape entityArea = null;
        if (params instanceof EntityBlockParams) {
            ebp = (EntityBlockParams) params;
            if (ebp.getGenerateEntities()) {
                sec = new StandardEntityCollection();
                entityArea = (Shape) area.clone();
            }
        }
        g2.setPaint(this.paint);
        g2.setFont(this.font);
        this.label.draw(g2, (float) area.getX(), (float) area.getY(),
                TextBlockAnchor.TOP_LEFT);
        BlockResult result = 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);
                result = new BlockResult();
                result.setEntityCollection(sec);
            }
        }
        return result;
View Full Code Here

     *         <code>null</code>.
     */
    public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
        Rectangle2D target = (Rectangle2D) area.clone();
        Rectangle2D hotspot = (Rectangle2D) area.clone();
        StandardEntityCollection sec = null;
        if (params instanceof EntityBlockParams
                && ((EntityBlockParams) params).getGenerateEntities()) {
      sec = new StandardEntityCollection();
            sec.add(new TitleEntity(hotspot,this));
        }
        target = trimMargin(target);
        if (this.backgroundPaint != null) {
            g2.setPaint(this.backgroundPaint);
            g2.fill(target);
        }
        BlockFrame border = getFrame();
        border.draw(g2, target);
        border.getInsets().trim(target);
        BlockContainer container = this.wrapper;
        if (container == null) {
            container = this.items;
        }
        target = trimPadding(target);
        Object val = container.draw(g2, target, params);
        if (val instanceof BlockResult){
          EntityCollection ec = ((BlockResult) val).getEntityCollection();
          if (ec != null && sec != null){
            sec.addAll(ec);
            ((BlockResult) val).setEntityCollection(sec);
          }
        }
        return val;
    }
View Full Code Here

                 || position == RectangleEdge.RIGHT) {
            drawVertical(g2, area);
        }
        BlockResult result = new BlockResult();
        if (entity != null) {
            StandardEntityCollection sec = new StandardEntityCollection();
            sec.add(entity);
            result.setEntityCollection(sec);
        }
        return result;
    }
View Full Code Here

        area = trimBorder(area);
        area = trimPadding(area);

        // check if we need to collect chart entities from the container
        EntityBlockParams ebp = null;
        StandardEntityCollection sec = null;
        Shape entityArea = null;
        if (params instanceof EntityBlockParams) {
            ebp = (EntityBlockParams) params;
            if (ebp.getGenerateEntities()) {
                sec = new StandardEntityCollection();
                entityArea = (Shape) area.clone();
            }
        }
        g2.setPaint(this.paint);
        g2.setFont(this.font);
        Point2D pt = RectangleAnchor.coordinates(area, this.textAnchor);
        this.label.draw(g2, (float) pt.getX(), (float) pt.getY(),
                this.contentAlignmentPoint);
        BlockResult result = 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);
                result = new BlockResult();
                result.setEntityCollection(sec);
            }
        }
        return result;
View Full Code Here

                JFreeChart chart = chart();
                if(chart != null) {
                    ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
                    ChartRenderingInfo info = null;
                    if(showToolTips() || showUrls()) {
                        info = new ChartRenderingInfo(new StandardEntityCollection());
                    }
                    if("image/jpeg".equals(imageType())) {
                        ChartUtilities.writeChartAsJPEG(imageStream, chart, width(), height(), info);
                    } else {
                        ChartUtilities.writeChartAsPNG(imageStream, chart, width(), height(), info, true, 0);
View Full Code Here

           chart = ec.createWallclockChart( ""+this.getExperiment().getEntityID() );
           // Pick into the session...
           HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
           HttpSession session = request.getSession();
           //  Write the chart image to the temporary directory
           ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
           this.graphId = ServletUtilities.saveChartAsPNG(chart, 600, 500, info, session);
           this.graphImageMap = ChartUtilities.getImageMap(graphId, info);
           this.graphUrl = request.getContextPath() + "/servlet/DisplayChart?filename=" + graphId;
           return this.graphUrl;
       } catch ( Exception e ) {
View Full Code Here

        // change the auto tick unit selection to integer units only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
       
        //change the chart to a bufferedImage
        ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
        BufferedImage image = chart.createBufferedImage(width, height, info);
       
        return image;
    }
View Full Code Here

        // change the auto tick unit selection to integer units only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
       
        //change the chart to a bufferedImage
        ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
        BufferedImage image = chart.createBufferedImage(width, height, info);
       
        return image;
    }
View Full Code Here

    /**
     * Constructs a new ChartRenderingInfo structure that can be used to collect information
     * about the dimensions of a rendered chart.
     */
    public ChartRenderingInfo() {
        this(new StandardEntityCollection());
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.entity.StandardEntityCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.