Search in sources :

Example 26 with RMetric

use of com.cpjd.roblu.models.metrics.RMetric in project Roblu by wdavies973.

the class MatchData method generateSheet.

@Override
public void generateSheet(XSSFSheet sheet, REvent event, RForm form, RTeam[] teams, ArrayList<RCheckout> checkouts) {
    /*
         * Output the headers
         */
    Row row = createRow(sheet);
    createCell(row, 0, "Team Number");
    createCell(row, 1, "Match number");
    for (int i = 0; i < form.getMatch().size(); i++) {
        createCell(row, i + 2, form.getMatch().get(i).getTitle());
    }
    /*
         * Output the data
         */
    for (RCheckout checkout : checkouts) {
        if (checkout.getTeam().getTabs().get(0).getTitle().equalsIgnoreCase("PIT") || checkout.getTeam().getTabs().get(0).getTitle().equalsIgnoreCase("PREDICTIONS"))
            continue;
        Row data = createRow(sheet);
        Cell cs = data.createCell(0);
        cs.setCellValue(checkout.getTeam().getNumber());
        cs.setCellStyle(getStyle());
        createCell(data, 1, checkout.getTeam().getTabs().get(0).getTitle().replace("Quals ", ""));
        int index = 0;
        for (RMetric metric : checkout.getTeam().getTabs().get(0).getMetrics()) {
            if (shouldWriteMetric(checkout.getTeam(), metric)) {
                if (metric instanceof RStopwatch)
                    createCell(data, index + 2, ((RStopwatch) metric).getLapsString());
                else if (metric instanceof RCalculation)
                    createCell(data, index + 2, ((RCalculation) metric).getValue(checkout.getTeam().getTabs().get(0).getMetrics()));
                else if (metric instanceof RFieldData)
                    continue;
                else
                    createCell(data, index + 2, metric.toString());
            } else
                createCell(data, index + 2, "");
            index++;
        }
    }
}
Also used : RStopwatch(com.cpjd.roblu.models.metrics.RStopwatch) RFieldData(com.cpjd.roblu.models.metrics.RFieldData) RCheckout(com.cpjd.roblu.models.RCheckout) Row(org.apache.poi.ss.usermodel.Row) RMetric(com.cpjd.roblu.models.metrics.RMetric) Cell(org.apache.poi.ss.usermodel.Cell) RCalculation(com.cpjd.roblu.models.metrics.RCalculation)

Aggregations

RMetric (com.cpjd.roblu.models.metrics.RMetric)26 RTab (com.cpjd.roblu.models.RTab)12 RTeam (com.cpjd.roblu.models.RTeam)10 RStopwatch (com.cpjd.roblu.models.metrics.RStopwatch)10 RTextfield (com.cpjd.roblu.models.metrics.RTextfield)10 ArrayList (java.util.ArrayList)10 RCounter (com.cpjd.roblu.models.metrics.RCounter)9 RGallery (com.cpjd.roblu.models.metrics.RGallery)9 IO (com.cpjd.roblu.io.IO)8 RCheckbox (com.cpjd.roblu.models.metrics.RCheckbox)8 RChooser (com.cpjd.roblu.models.metrics.RChooser)8 RSlider (com.cpjd.roblu.models.metrics.RSlider)8 RForm (com.cpjd.roblu.models.RForm)7 RBoolean (com.cpjd.roblu.models.metrics.RBoolean)7 RFieldData (com.cpjd.roblu.models.metrics.RFieldData)7 RCalculation (com.cpjd.roblu.models.metrics.RCalculation)6 RCheckout (com.cpjd.roblu.models.RCheckout)5 LinkedHashMap (java.util.LinkedHashMap)5 Bundle (android.os.Bundle)4 View (android.view.View)4