org.jfree.util.StringUtils Java Examples

The following examples show how to use org.jfree.util.StringUtils. 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: AbstractFileSelectionAction.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Selects a file to use as target for the operation.
 *
 * @param selectedFile    the selected file.
 * @param dialogType  the dialog type.
 * @param appendExtension true, if the file extension should be added if
 *                        necessary, false if the unmodified filename should be used.
 * 
 * @return the selected and approved file or null, if the user canceled
 *         the operation
 */
protected File performSelectFile(final File selectedFile,
                                 final int dialogType,
                                 final boolean appendExtension) {
    if (this.fileChooser == null) {
        this.fileChooser = createFileChooser();
    }

    this.fileChooser.setSelectedFile(selectedFile);
    this.fileChooser.setDialogType(dialogType);
    final int option = this.fileChooser.showDialog(this.parent, null);
    if (option == JFileChooser.APPROVE_OPTION) {
        final File selFile = this.fileChooser.getSelectedFile();
        String selFileName = selFile.getAbsolutePath();
        if (StringUtils.endsWithIgnoreCase(selFileName, getFileExtension()) == false) {
            selFileName = selFileName + getFileExtension();
        }
        return new File(selFileName);
    }
    return null;
}
 
Example #2
Source File: ImageMapUtilities.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example #3
Source File: ImageMapUtilities.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example #4
Source File: ImageMapUtilities.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example #5
Source File: ImageMapUtilities.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example #6
Source File: ImageMapUtilities.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted 
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if 
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuffer sb = new StringBuffer();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();
    
}
 
Example #7
Source File: ImageMapUtilities.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example #8
Source File: ImageMapUtilities.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        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);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}