Example usage for org.jfree.util StringUtils getLineSeparator

List of usage examples for org.jfree.util StringUtils getLineSeparator

Introduction

In this page you can find the example usage for org.jfree.util StringUtils getLineSeparator.

Prototype

public static String getLineSeparator() 

Source Link

Document

Queries the system properties for the line separator.

Usage

From source file:gov.nih.nci.caintegrator.ui.graphing.util.ImageMapUtil.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer//w ww .  j  av  a  2 s. c  o m
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
private static void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            if (sb.indexOf(chartEntity.getImageMapAreaTag(ttg, urlg)) == -1) {
                sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
                sb.append(StringUtils.getLineSeparator());
            }
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}

From source file:org.openfaces.component.chart.impl.helpers.MapRenderUtilities.java

public static String getImageMapExt(Chart chart, String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {
    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(name).append("\" name=\"").append(name).append("\">");
    sb.append(StringUtils.getLineSeparator());

    // the following is needed for displaying tooltips under IE (doesn't display tooltips if there's no area with href)
    String fakeArea = "<area shape=\"rect\" coords=\"0,0,0,0\" href=\"fake.jsp\" alt=\"\" title=\"\" />";
    sb.append(fakeArea);/*from   w  ww .  j  a v  a2  s .com*/
    sb.append(StringUtils.getLineSeparator());

    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        ChartView view = chart.getChartView();

        for (int i = count - 1; i >= 0; i--) {
            ChartEntity entity = entities.getEntity(i);

            if (entity.getToolTipText() == null && entity.getURLText() == null
                    && getOnClick(chart, chart.getChartView(), entity) == null && !viewHasAction(view)
                    && !viewHasPopup(view) && chart.getChartSelection() == null)
                continue;

            String area;
            if (i == 0) {
                area = getTitleImageMapAreaTag(chart, new StandardToolTipTagFragmentGenerator(),
                        new StandardURLTagFragmentGenerator(), entity);
            } else {
                if (entity instanceof PieSectionEntity) {
                    area = getImageMapAreaTag(chart, view, toolTipTagFragmentGenerator, urlTagFragmentGenerator,
                            entity, i);
                } else if (entity instanceof CategoryItemEntity) {
                    area = getImageMapAreaTag(chart, view, toolTipTagFragmentGenerator, urlTagFragmentGenerator,
                            entity, i);
                } else if (entity instanceof XYItemEntity) {
                    area = getImageMapAreaTag(chart, view, toolTipTagFragmentGenerator, urlTagFragmentGenerator,
                            entity, i);
                } else {
                    area = "";
                }
            }

            if (area.length() > 0) {
                sb.append(area);
                sb.append(StringUtils.getLineSeparator());
            }
        }

    }

    sb.append("</map>");
    return sb.toString();
}

From source file:gov.nih.nci.caintegrator.ui.graphing.util.ImageMapUtil.java

public static String getBoundingRectImageMapTag(String name, boolean useOverlibToolTip,
        ChartRenderingInfo info) {//from   w  ww . ja v a  2  s .  c  om
    EntityCollection collection = info.getEntityCollection();
    Collection entities = collection.getEntities();

    Collection<ChartEntity> myBoundingEntities = getBoundingEntities(entities);

    System.out.println("Num entities=" + myBoundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    ToolTipTagFragmentGenerator ttg = null;

    if (useOverlibToolTip) {
        ttg = new CAIOverlibToolTipTagFragmentGenerator();
    } else {
        ttg = new CAIStandardToolTipTagFragmentGenerator();
    }

    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("\n\n<MAP name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = myBoundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            if (sb.indexOf(chartEntity.getImageMapAreaTag(ttg, urlg)) == -1) {
                sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
                sb.append(StringUtils.getLineSeparator());
            }
        }
    }
    sb.append("</MAP>\n\n");
    return sb.toString();
}

From source file:gov.nih.nci.cma.web.graphing.CMAPrincipalComponentAnalysisPlot.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer/*w w w  . j  a va  2s  .  c  o  m*/
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
private void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
            sb.append(StringUtils.getLineSeparator());
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}

From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.PrincipalComponentAnalysisPlot.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer/* ww w  .  j  a  va  2 s .c o m*/
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
protected void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
            sb.append(StringUtils.getLineSeparator());
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}