Search in sources :

Example 16 with RCheckout

use of com.cpjd.roblu.models.RCheckout 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)

Example 17 with RCheckout

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

the class MatchList method generateSheet.

@Override
public void generateSheet(XSSFSheet sheet, REvent event, RForm form, RTeam[] teams, ArrayList<RCheckout> checkouts) {
    Row labels = createRow(sheet);
    createCell(labels, 0, "Match Number");
    createCell(labels, 1, "Red1");
    createCell(labels, 2, "Red2");
    createCell(labels, 3, "Red3");
    createCell(labels, 4, "Blue1");
    createCell(labels, 5, "Blue2");
    createCell(labels, 6, "Blue3");
    int teamNumber = io.loadSettings().getTeamNumber();
    /*
         * Start writing match numbers
         */
    int index = 0;
    String currentMatch = "";
    Row row = null;
    for (RCheckout checkout : checkouts) {
        if (checkout.getTeam().getTabs().get(0).getTitle().equalsIgnoreCase("PIT") || checkout.getTeam().getTabs().get(0).getTitle().equalsIgnoreCase("PREDICTIONS"))
            continue;
        if (!currentMatch.equals(checkout.getTeam().getTabs().get(0).getTitle()))
            row = createRow(sheet);
        try {
            Cell c = row.createCell(0);
            c.setCellValue(Integer.parseInt(checkout.getTeam().getTabs().get(0).getTitle().replace("Quals ", "")));
            c.setCellStyle(getStyle());
        } catch (NumberFormatException e) {
            Cell c = row.createCell(0);
            c.setCellValue(checkout.getTeam().getTabs().get(0).getTitle().replace("Quals ", ""));
            c.setCellStyle(getStyle());
        }
        int pos = checkout.getTeam().getTabs().get(0).getAlliancePosition();
        if (pos == -1)
            pos = index + 1;
        if (checkout.getTeam().getNumber() == teamNumber)
            getStyle().getFont().setBold(true);
        else
            getStyle().getFont().setBold(false);
        Cell cs = row.createCell(pos);
        cs.setCellValue(checkout.getTeam().getNumber());
        cs.setCellStyle(getStyle());
        currentMatch = checkout.getTeam().getTabs().get(0).getTitle();
        index++;
    }
}
Also used : RCheckout(com.cpjd.roblu.models.RCheckout) Row(org.apache.poi.ss.usermodel.Row) Cell(org.apache.poi.ss.usermodel.Cell)

Aggregations

RCheckout (com.cpjd.roblu.models.RCheckout)17 IO (com.cpjd.roblu.io.IO)8 RTeam (com.cpjd.roblu.models.RTeam)8 RTab (com.cpjd.roblu.models.RTab)6 RMetric (com.cpjd.roblu.models.metrics.RMetric)5 ArrayList (java.util.ArrayList)5 StrictMode (android.os.StrictMode)3 Request (com.cpjd.http.Request)3 CloudCheckout (com.cpjd.models.CloudCheckout)3 CloudCheckoutRequest (com.cpjd.requests.CloudCheckoutRequest)3 REvent (com.cpjd.roblu.models.REvent)3 RForm (com.cpjd.roblu.models.RForm)3 RSettings (com.cpjd.roblu.models.RSettings)3 RSyncSettings (com.cpjd.roblu.models.RSyncSettings)3 RFieldData (com.cpjd.roblu.models.metrics.RFieldData)3 SyncHelper (com.cpjd.roblu.sync.SyncHelper)3 Row (org.apache.poi.ss.usermodel.Row)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 TextView (android.widget.TextView)2 CloudTeam (com.cpjd.models.CloudTeam)2