private String generateOverviewText() throws InsufficientDataException { StringBuilder sb = new StringBuilder(); final String team = config.getTeam(); double total = checkTotal(); final String nl = System.getProperty("line.separator"); for (Entry<String, Row> entry : rows.entrySet()) { double hours = Double.parseDouble(entry.getValue().hoursTF.getText()); double fraction = hours / total; if (fraction < 0.004) continue; String line = team + ", " + decimalFormat.format(fraction) + ", " + entry.getKey(); sb.append(line + nl); } return sb.toString(); }
/** * Generates a string representation of the configuration options. * * @return A string * @see java.lang.Object#toString() */ public String toString() { StringBuilder buff = new StringBuilder("AjaxMetricsFilterConfiguration:"); buff.append("\n\tParameter Names:"); for (Entry<String, String> entry : parameterNames.entrySet()) { buff.append("\n\t\t").append(entry.getKey()).append(":").append(entry.getValue()); } buff.append("\n\tRun Options:"); for (Entry<String, Boolean> entry : runOptions.entrySet()) { buff.append("\n\t\t").append(entry.getKey()).append(":").append(entry.getValue()); } buff.append("\n\tBatch Options:"); for (Entry<String, Integer> entry : batchOptions.entrySet()) { buff.append("\n\t\t").append(entry.getKey()).append(":").append(entry.getValue()); } buff.append("\n\tListener Class Name:").append(listenerClassName); buff.append("\n\tAgent Logging Level:").append(agentLogLevel); buff.append("\n\tAgent Name:").append(agentName); return buff.toString(); }
/** * Generates a JavaScript command to update the JavaScript agent's parameter names. Follows this * format: <code>agent.updateParameterNames({serial: 'XXXX', parameter: 'YYYY'});</code> * * @return A JavaScript Command. */ public String generateCommand(String type, Map<String, ?> props) { StringBuilder buff = new StringBuilder(agentName); buff.append(".update").append(type).append("({"); for (Entry<String, ?> entry : props.entrySet()) { if (entry.getValue() instanceof String) { buff.append(entry.getKey()).append(": '").append(entry.getValue()).append("',"); } else { buff.append(entry.getKey()).append(": ").append(entry.getValue()).append(","); } } buff.deleteCharAt(buff.length() - 1); buff.append("});"); return buff.toString(); }
/** * Generates JavaScript commands to execute a full initialization configuration of the JavaScript * Agent. * * @return A JavaScript Command Set. */ public String generateInitCommands() { StringBuilder buff = new StringBuilder(); buff.append(generateCommand("ParameterNames", parameterNames)); buff.append(generateCommand("RunOptions", runOptions)); buff.append(generateCommand("BatchOptions", batchOptions)); buff.append(agentName).append(".setLogLevel(").append(agentLogLevel).append(");"); buff.append(agentName).append(".setEnabled(").append(enabled).append(");"); buff.append(agentName) .append(".setAjaxListener(new ") .append(listenerClassName) .append("(") .append(agentName) .append("));"); return buff.toString(); }