Java Code Examples for org.apache.commons.lang3.text.StrBuilder#append()
The following examples show how to use
org.apache.commons.lang3.text.StrBuilder#append() .
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: HtmlUtils.java From appstatus with Apache License 2.0 | 6 votes |
/** * Outputs table headers. * * <p> * <b>WARNING</b> : this method accepts HTML content as table headers. Any * sensitive value must be encoded before calling this method. * * @param sb * The target string builder. * @param cols * Column titles (HTML). */ public static void generateHeaders(StrBuilder sb, Object... cols) { sb.append("<thead><tr>"); for (Object obj : cols) { sb.append("<th>"); if (obj != null) { if (obj instanceof Long) { sb.append(((Long) obj).longValue()); } else { sb.append(obj.toString()); } } sb.append("</th>"); } sb.append("</tr></thead><tbody>"); }
Example 2
Source File: HtmlUtils.java From appstatus with Apache License 2.0 | 6 votes |
/** * Outputs one table row. * <p> * <b>WARNING</b> : this method accepts HTML content as row content. Any * sensitive value must be encoded before calling this method. * * * @param sb * The target string builder. * @param status * status class name. * @param cols * Column titles (HTML). * @throws IOException */ public static void generateRow(StrBuilder sb, String status, Object... cols) throws IOException { sb.append("<tr>"); sb.append(("<td class='icon'><img src='?icon=" + escapeHtml4(status) + "'></td>")); for (Object obj : cols) { sb.append("<td>"); if (obj != null) { if (obj instanceof Date) { DateFormat dateFormat = getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); sb.append(dateFormat.format((Date) obj)); } else { sb.append(obj.toString()); } } sb.append("</td>"); } sb.append("</tr>"); }
Example 3
Source File: TrieImpl.java From gsc-core with GNU Lesser General Public License v3.0 | 5 votes |
public String dumpTrie(boolean compact) { if (root == null) { return "<empty>"; } encode(); StrBuilder ret = new StrBuilder(); List<String> strings = root.dumpTrieNode(compact); ret.append("Root: " + hash2str(getRootHash(), compact) + "\n"); for (String s : strings) { ret.append(s).append('\n'); } return ret.toString(); }
Example 4
Source File: TrieImpl.java From nuls with MIT License | 5 votes |
public String dumpTrie(boolean compact) { if (root == null) { return "<empty>"; } encode(); StrBuilder ret = new StrBuilder(); List<String> strings = root.dumpTrieNode(compact); ret.append("Root: " + hash2str(getRootHash(), compact) + "\n"); for (String s : strings) { ret.append(s).append('\n'); } return ret.toString(); }
Example 5
Source File: AO_TargetExt.java From svg2vector with Apache License 2.0 | 5 votes |
/** * Creates a long description with supported targets. * @param descr original long description * @param supportedTargets targets * @return long description with added list of supported targets * @throws NullPointerException if argument was null * @throw IllegalArgumentException if target had null elements */ protected static String buildLongDescr(String descr, SvgTargets[] supportedTargets){ Validate.notNull(supportedTargets); Validate.noNullElements(supportedTargets); StrBuilder ret = new StrBuilder(); ret.append(descr); ret.append(" Supported targets are: ").appendWithSeparators(supportedTargets, ", "); return ret.toString(); }
Example 6
Source File: AbstractPage.java From appstatus with Apache License 2.0 | 5 votes |
protected String getPage(final StatusWebHandler webHandler, final Map<String, String> valueMap) throws UnsupportedEncodingException, IOException { valueMap.put("css", "<link href=\"" + webHandler.getCssLocation() + "\" rel=\"stylesheet\">"); valueMap.put("UrlAppStatus", URL); final StrBuilder menu = new StrBuilder(); for (final String pageId : webHandler.getPages().keySet()) { final IPage page = webHandler.getPages().get(pageId); if (StringUtils.equals(pageId, getId())) { menu.append("<li class=active>"); } else { menu.append("<li>"); } menu.append("<a href=\"?p=" + page.getId() + "\">" + page.getName() + "</a></li>"); } valueMap.put("menu", menu.toString()); valueMap.put("applicationName", webHandler.getApplicationName()); if (!valueMap.containsKey("js")) { valueMap.put("js", ""); } return applyLayout(valueMap, PAGELAYOUT); }
Example 7
Source File: BatchPage.java From appstatus with Apache License 2.0 | 5 votes |
private String generateClearActions() throws IOException { StrBuilder sb = new StrBuilder(); sb.append("<p>Actions :</p><form action='?p=batch' method='post'><input type='submit' name='" + CLEAR_OLD // + "' value='Delete old (6 months)' class='btn'/> <input type='submit' name='" + CLEAR_SUCCESS // + "' value='Delete Success w/o rejected' class='btn'/></form>"); return sb.toString(); }
Example 8
Source File: HtmlUtils.java From appstatus with Apache License 2.0 | 5 votes |
/** * Prints table start tag, or a message if table is empty. * * @param size * @return true if we can go on with table generation. * @throws IOException * @throws UnsupportedEncodingException */ public static boolean generateBeginTable(StrBuilder sb, int size) throws UnsupportedEncodingException, IOException { if (size == 0) { sb.append("<p>No items</p>"); return false; } sb.append("<table class=\"table table-hover table-condensed\">"); return true; }
Example 9
Source File: AppProperties.java From svg2vector with Apache License 2.0 | 4 votes |
/** * Set output and do all tests for layer processing. * @param target the set target * @return null on success, error message on error */ private String setOutputWithLayers(SvgTargets target){ //warnings first for(ApplicationOption<?> ao : this.withLayersWarnings){ if(ao.inCli()){ this.warnings.add("layers processed but CLI option <" + ao.getCliOption().getLongOpt() + "> used, will be ignored"); } } String dout = this.aoDirOut.getValue(); File testDir = new File(dout); if(testDir.exists() && !testDir.isDirectory()){ return "output directory <" + dout + "> exists but is not a directory"; } if(testDir.exists() && !testDir.canWrite()){ return "output directory <" + dout + "> exists but cannot write into it, check permissions"; } if(!testDir.exists() && !this.aoCreateDirs.inCli()){ return "output directory <" + dout + "> does not exist and CLI option <" + this.aoCreateDirs.getCliOption().getLongOpt() + "> not used"; } if(!this.aoFoutLayerId.inCli() && !this.aoFoutLayerIndex.inCli()){ return "processing layers but neither <" + this.aoFoutLayerId.getCliOption().getLongOpt() + "> nor <" + this.aoFoutLayerIndex.getCliOption().getLongOpt() + "> options requestes, amigious output file names"; } StrBuilder pattern = new StrBuilder(); pattern.append(dout); if(!pattern.endsWith("/")){ pattern.append('/'); } if(!this.aoFoutNoBasename.inCli()){ if(this.aoUseBaseName.inCli()){ pattern.append(this.aoUseBaseName.getValue()); } else{ String bn = StringUtils.substringAfterLast(this.fin, "/"); bn = StringUtils.substringBeforeLast(bn, "."); pattern.append(bn); } } if(this.aoFoutLayerIndex.inCli()){ if(!pattern.endsWith("/")){ pattern.append('-'); } pattern.append(SUBST_PATTERN_INDEX); } if(this.aoFoutLayerId.inCli()){ if(!pattern.endsWith("/")){ pattern.append('-'); } pattern.append(SUBST_PATTERN_ID); } this.dout = dout; this.doutFile = testDir; this.foutPattern = pattern.toString(); return null; }
Example 10
Source File: HtmlUtils.java From appstatus with Apache License 2.0 | 4 votes |
public static void generateEndTable(StrBuilder sb, int size) throws UnsupportedEncodingException, IOException { if (size > 0) { sb.append("</tbody></table>"); } }