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++;
}
}
}
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++;
}
}
Aggregations