Example usage for org.jfree.chart.entity PieSectionEntity setURLText

List of usage examples for org.jfree.chart.entity PieSectionEntity setURLText

Introduction

In this page you can find the example usage for org.jfree.chart.entity PieSectionEntity setURLText.

Prototype

public void setURLText(String text) 

Source Link

Document

Sets the URL text.

Usage

From source file:org.pentaho.platform.uifoundation.chart.CategoryDatasetChartComponent.java

private void populatePieSectionEntity(PieSectionEntity pieSectionEntity) {
    String value = pieSectionEntity.getSectionKey().toString();
    if (paramName == null) {
        pieSectionEntity.setURLText(value);
    } else {/*from   ww w  .  j  av  a 2s.c om*/
        try {
            String encodedVal = URLEncoder.encode(value, LocaleHelper.getSystemEncoding());
            String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal);
            pieSectionEntity.setURLText(drillURL);

        } catch (UnsupportedEncodingException ignored) {
            this.getLogger().debug(ignored);
        }
    }
}

From source file:org.pentaho.platform.uifoundation.chart.PieDatasetChartComponent.java

private void populateInfo(final ChartRenderingInfo info) {
    ArrayList keyListArray = null;
    int keyListIndex = 0;
    Iterator iter = info.getEntityCollection().iterator();
    while (iter.hasNext()) {
        ChartEntity entity = (ChartEntity) iter.next();
        if (entity instanceof PieSectionEntity) {
            PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
            String value = pieSectionEntity.getSectionKey().toString();
            if (paramName == null) {
                pieSectionEntity.setURLText(value);
            } else {
                try {
                    String encodedVal = URLEncoder.encode(value, LocaleHelper.getSystemEncoding());
                    String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal);
                    pieSectionEntity.setURLText(drillURL);

                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }/*from   w  w  w . ja v a  2 s .  c  om*/
            }
        } else if (entity instanceof CategoryItemEntity) {
            CategoryItemEntity categoryItemEntity = (CategoryItemEntity) entity;
            if (keyListArray == null) {
                keyListArray = new ArrayList(categoryItemEntity.getDataset().getRowKeys());
            }
            String category = categoryItemEntity.getCategory().toString();
            if (paramName == null) {
                categoryItemEntity.setURLText(category);
            } else {
                try {
                    String encodedVal = URLEncoder.encode(category, LocaleHelper.getSystemEncoding());
                    String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal);
                    if (keyListIndex >= keyListArray.size()) {
                        keyListIndex = 0;
                    }
                    encodedVal = URLEncoder.encode(keyListArray.get(keyListIndex).toString(),
                            LocaleHelper.getSystemEncoding());
                    keyListIndex++;
                    drillURL = TemplateUtil.applyTemplate(drillURL, paramName2, encodedVal);
                    categoryItemEntity.setURLText(drillURL);

                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}