Search in sources :

Example 1 with RelativeSize

use of net.sourceforge.processdash.tool.probe.SizePerItemTable.RelativeSize in project processdash by dtuma.

the class EditSizePerItemTables method showTable.

private void showTable(SizePerItemTable table) throws IOException {
    writeHTMLHeader();
    out.print("<h2>");
    out.print(esc(table.getTableName()));
    out.println("</h2>");
    showUnits(table.getSizeUnits(), false);
    interpOut("<table border class='view'><tr>" + "<th>${Category}</th>" + "<th>${Very_Small}</th>" + "<th>${Small}</th>" + "<th>${Medium}</th>" + "<th>${Large}</th>" + "<th>${Very_Large}</th></tr>");
    for (String category : table.getCategoryNames()) {
        out.print("<tr><td>");
        out.print(esc(category));
        for (RelativeSize relSize : RelativeSize.values()) {
            out.print("</td><td class='center'>");
            out.print(FormatUtil.formatNumber(table.getSize(category, relSize), 2));
        }
        out.println("</td><tr>");
    }
    out.println("</table>");
    interpOut("<p><a href='" + SCRIPT + "'>${Show_List}</a></p>");
    out.println("</body></html>");
}
Also used : RelativeSize(net.sourceforge.processdash.tool.probe.SizePerItemTable.RelativeSize)

Example 2 with RelativeSize

use of net.sourceforge.processdash.tool.probe.SizePerItemTable.RelativeSize in project processdash by dtuma.

the class SizeEstimatingTemplate2 method initSizeTypeData.

private void initSizeTypeData() {
    StringBuffer options = new StringBuffer("<option>\n");
    StringBuffer sizeData = new StringBuffer("<script>DashSET.itemSizes = { \n");
    String sizeUnits = new ProcessUtil(getDataContext()).getSizeUnits();
    SortedMap<String, SizePerItemTable> tables = SizePerItemTable.getDefinedTables(getDataRepository(), sizeUnits);
    for (Entry<String, SizePerItemTable> e : tables.entrySet()) {
        String sizePerItemTableName = e.getKey();
        SizePerItemTable sizePerItemTable = e.getValue();
        String valuePrefix = getCategoryValuePrefix(sizePerItemTableName);
        options.append("<optgroup label=\"").append(esc(sizePerItemTableName)).append("\">\n");
        for (String category : sizePerItemTable.getCategoryNames()) {
            String fullCat = valuePrefix + category;
            options.append("<option value=\"").append(esc(fullCat)).append("\">").append(esc(category)).append("\n");
            for (RelativeSize relSize : RelativeSize.values()) {
                sizeData.append('"').append(StringUtils.javaEncode(fullCat)).append("/").append(REL_SIZE_NAMES[relSize.ordinal()]).append("\" : ").append(sizePerItemTable.getSize(category, relSize)).append(",\n");
            }
        }
        options.append("</optgroup>\n");
    }
    if (tables.isEmpty()) {
        String messageHtml = resources.getHTML("SizePerItem.Errors.No_Types_Message");
        String tooltip = resources.format("SizePerItem.Errors.No_Types_Tooltip_FMT", sizeUnits);
        options.append("<option value=\"-\" title=\"").append(esc(tooltip)).append("\">").append(messageHtml).append("\n");
    }
    sizeData.setLength(sizeData.length() - 2);
    sizeData.append(" };\n");
    if (USE_COMMA)
        sizeData.append("DashSET.useCommaForDecimal = true;\n");
    if (freezePlan || Settings.getBool("sizeEst.disableBasePartsGraph", false))
        sizeData.append("DashSET.disableBasePartsGraph = true;\n");
    sizeData.append("</script>\n");
    this.sizeTypeInit = sizeData.toString();
    this.sizeTypeOptions = options.toString();
}
Also used : SizePerItemTable(net.sourceforge.processdash.tool.probe.SizePerItemTable) RelativeSize(net.sourceforge.processdash.tool.probe.SizePerItemTable.RelativeSize) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Aggregations

RelativeSize (net.sourceforge.processdash.tool.probe.SizePerItemTable.RelativeSize)2 ProcessUtil (net.sourceforge.processdash.process.ProcessUtil)1 SizePerItemTable (net.sourceforge.processdash.tool.probe.SizePerItemTable)1