List of usage examples for com.itextpdf.text.pdf PdfContentByte ALIGN_RIGHT
int ALIGN_RIGHT
To view the source code for com.itextpdf.text.pdf PdfContentByte ALIGN_RIGHT.
Click Source Link
From source file:Almacen.formatosAlmacen.java
private void cabeceraCompra(PDF reporte, BaseFont bf, PdfPTable tabla, Almacen almacen, Orden ord) { Session session = HibernateUtil.getSessionFactory().openSession(); try {/*from w ww . ja v a2s.com*/ reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); if (almacen.getPedido() != null) { reporte.contenido.roundRectangle(35, 695, 180, 10, 0); reporte.contenido.roundRectangle(35, 625, 180, 80, 0); reporte.contenido.roundRectangle(215, 695, 180, 10, 0); reporte.contenido.roundRectangle(215, 625, 180, 80, 0); } reporte.contenido.roundRectangle(395, 695, 180, 10, 0); reporte.contenido.roundRectangle(395, 625, 180, 80, 0); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 13); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.agregaObjeto(reporte.crearImagen("imagenes/grande300115.jpg", 30, -40, 60)); reporte.contenido.setFontAndSize(bf, 12); reporte.contenido.setColorFill(BaseColor.BLACK); if (almacen.getPedido() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento en almacen: " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 710, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento en almacen: " + almacen.getIdAlmacen(), 35, 710, 0); reporte.contenido.setFontAndSize(bf, 7); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 570, 710, 0); ord = (Orden) session.get(Orden.class, ord.getIdOrden()); //************************datos del proveedor**************************** if (almacen.getPedido() != null) { DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");//YYYY-MM-DD HH:MM:SS reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "DATOS DEL PROVEEDOR", 73, 697, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, almacen.getPedido().getProveedorByIdProveedor().getNombre(), 40, 687, 0); if (almacen.getPedido().getProveedorByIdProveedor().getDireccion() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, almacen.getPedido().getProveedorByIdProveedor().getDireccion(), 40, 677, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Dir:", 40, 677, 0); if (almacen.getPedido().getProveedorByIdProveedor().getColonia() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Col: " + almacen.getPedido().getProveedorByIdProveedor().getColonia(), 40, 667, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Col:", 40, 667, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Edo: " + almacen.getPedido().getProveedorByIdProveedor().getEstado(), 40, 657, 0); if (almacen.getPedido().getProveedorByIdProveedor().getTel1() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tel: " + almacen.getPedido().getProveedorByIdProveedor().getTel1(), 40, 647, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tel:", 40, 647, 0); if (almacen.getPedido().getProveedorByIdProveedor().getTel1() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Cto: " + almacen.getPedido().getProveedorByIdProveedor().getRepresentante(), 40, 637, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Cto:", 40, 637, 0); if (almacen.getPedido().getProveedorByIdProveedor().getEmail() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Email: " + almacen.getPedido().getProveedorByIdProveedor().getEmail(), 40, 627, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Email: ", 40, 627, 0); //**********************datos de facturacion***************************** reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "DATOS DE FACTURACIN", 250, 697, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, almacen.getPedido().getProveedorByIdEmpresa().getNombre(), 220, 687, 0); if (almacen.getPedido().getProveedorByIdEmpresa().getDireccion() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, almacen.getPedido().getProveedorByIdEmpresa().getDireccion(), 220, 677, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Dir:", 220, 677, 0); if (almacen.getPedido().getProveedorByIdEmpresa().getColonia() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Col: " + almacen.getPedido().getProveedorByIdEmpresa().getColonia(), 220, 667, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Col:", 220, 667, 0); if (almacen.getPedido().getProveedorByIdEmpresa().getPoblacion() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Pob: " + almacen.getPedido().getProveedorByIdEmpresa().getPoblacion(), 220, 657, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Pob:", 220, 657, 0); if (almacen.getPedido().getProveedorByIdEmpresa().getCp() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "CP: " + almacen.getPedido().getProveedorByIdEmpresa().getCp(), 220, 647, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "CP:", 220, 647, 0); if (almacen.getPedido().getProveedorByIdEmpresa().getRfc() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RFC: " + almacen.getPedido().getProveedorByIdEmpresa().getRfc(), 220, 637, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RFC:", 220, 537, 0); } //**********************datos de la unidad***************************** reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "DATOS LA UNIDAD", 450, 697, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "No Orden: " + ord.getIdOrden(), 410, 687, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo: " + ord.getTipo().getTipoNombre(), 410, 677, 0); if (ord.getNoSerie() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "No Serie: " + ord.getNoSerie(), 410, 667, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "No Serie: ", 410, 667, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Modelo: " + ord.getModelo(), 410, 657, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Compaia: " + ord.getCompania().getNombre(), 410, 647, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Cli:" + ord.getClientes().getNombre(), 410, 637, 0); if (ord.getSiniestro() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "No Siniestro:" + ord.getSiniestro(), 410, 627, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "No Siniestro:", 410, 627, 0); reporte.finTexto(); reporte.contenido.setFontAndSize(bf, 12); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; int centro = Element.ALIGN_CENTER; tabla.addCell(reporte.celda("N", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("#", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("N Parte", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Descripcin", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Med", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Cant", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Costo c/u", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Total", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); reporte.contenido.roundRectangle(50, 40, 180, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Almacen", 120, 30, 0); reporte.contenido.roundRectangle(370, 40, 180, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Proveedor", 440, 30, 0); } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); }
From source file:Almacen.formatosOrden.java
private void cabeceraCompra(PDF reporte, BaseFont bf, PdfPTable tabla, Almacen almacen, Orden ord) { Session session = HibernateUtil.getSessionFactory().openSession(); try {//from ww w . ja v a2s . com reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); reporte.contenido.roundRectangle(35, 755, 280, 10, 0); reporte.contenido.roundRectangle(35, 735, 280, 20, 0); ////*2 reporte.contenido.roundRectangle(35, 388, 280, 10, 0); reporte.contenido.roundRectangle(35, 368, 280, 20, 0); //// reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 13); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.agregaObjeto(reporte.crearImagen("imagenes/grande300115.jpg", 335, -23, 30)); /*2*/reporte.agregarImagen(reporte.crearImagen("imagenes/grande300115.jpg", 100, -390, 30)); reporte.contenido.setFontAndSize(bf, 12); reporte.contenido.setColorFill(BaseColor.BLACK); if (miAlmacen.getTipoMovimiento() == 1) { if (miAlmacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos en Almacn (Entrada de Material): " + almacen.getIdAlmacen(), 35, 767, 0); if (miAlmacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Devolucin de material de operarios): " + almacen.getIdAlmacen(), 35, 767, 0); //*********2 if (miAlmacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos en Almacn (Entrada de Material): " + almacen.getIdAlmacen(), 35, 400, 0); if (miAlmacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Devolucin de material de operarios): " + almacen.getIdAlmacen(), 35, 400, 0); //// } else { if (miAlmacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento de Almacn (Devolucin de material a proveedor): " + almacen.getIdAlmacen(), 35, 767, 0); if (miAlmacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Entrega de material a operarios): " + almacen.getIdAlmacen(), 35, 767, 0); //*********2 if (miAlmacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento de Almacn (Devolucin de material a proveedor): " + almacen.getIdAlmacen(), 35, 400, 0); if (miAlmacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Entrega de material a operarios): " + almacen.getIdAlmacen(), 35, 400, 0); /// } reporte.contenido.setFontAndSize(bf, 7); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 306, 757, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 306, 390, 0); ord = (Orden) session.get(Orden.class, ord.getIdOrden()); //************************datos de movimiento**************************** DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");//YYYY-MM-DD HH:MM:SS reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Materiales y Refacciones del Almacn", 40, 757, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Materiales y Refacciones del Almacn", 40, 390, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Movimiento: " + almacen.getIdAlmacen(), 40, 747, 0); /*2*/ reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Movimiento: " + almacen.getIdAlmacen(), 40, 380, 0); if (almacen.getTipoMovimiento() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Entrada", 120, 747, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Salida", 120, 747, 0); ////**2 if (almacen.getTipoMovimiento() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Entrada", 120, 380, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Salida", 120, 380, 0); //// if (almacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Compaa", 220, 747, 0); if (almacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Operarios", 220, 747, 0); ////**2 if (almacen.getOperacion() == 4) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Compaa", 220, 380, 0); if (almacen.getOperacion() == 5) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Operarios", 220, 380, 0); //// reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Orden: " + ord.getIdOrden(), 40, 737, 0); /*2*/ reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Orden: " + ord.getIdOrden(), 40, 370, 0); //Firmas de material if (miAlmacen.getTipoMovimiento() == 1) { reporte.contenido.roundRectangle(45, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getEntrego(), 45, 440, 0); reporte.contenido.roundRectangle(250, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 440, 0); reporte.contenido.roundRectangle(440, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getUsuario().getEmpleado().getNombre(), 440, 440, 0); } else { reporte.contenido.roundRectangle(45, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getUsuario().getEmpleado().getNombre(), 45, 440, 0); reporte.contenido.roundRectangle(250, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 440, 0); reporte.contenido.roundRectangle(440, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getEntrego(), 440, 440, 0); } /*2*/if (miAlmacen.getTipoMovimiento() == 1) { reporte.contenido.roundRectangle(45, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getEntrego(), 45, 20, 0); reporte.contenido.roundRectangle(250, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 20, 0); reporte.contenido.roundRectangle(440, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getUsuario().getEmpleado().getNombre(), 440, 20, 0); } else { reporte.contenido.roundRectangle(45, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getUsuario().getEmpleado().getNombre(), 45, 20, 0); reporte.contenido.roundRectangle(250, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 20, 0); reporte.contenido.roundRectangle(440, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getEntrego(), 440, 20, 0); } /// reporte.finTexto(); reporte.contenido.setFontAndSize(bf, 12); //agregamos renglones vacios para dejar un espacio(tabla) reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; int centro = Element.ALIGN_CENTER; tabla.addCell(reporte.celda("N", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("#", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("N Parte", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Descripcin", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Med", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Cant", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } catch (Exception e) { System.out.println(e); e.printStackTrace(); JOptionPane.showMessageDialog(null, "No se pudo realizar el reporte si el archivo esta abierto"); } if (session != null) if (session.isOpen()) session.close(); }
From source file:Almacen.formatosPedido.java
private void cabeceraCompra(PDF reporte, BaseFont bf, PdfPTable tabla, Almacen almacen, Orden ord) { Session session = HibernateUtil.getSessionFactory().openSession(); try {//from w w w. ja va2s . c o m reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); reporte.contenido.roundRectangle(35, 755, 280, 10, 0); reporte.contenido.roundRectangle(35, 735, 280, 20, 0); ////*2 reporte.contenido.roundRectangle(35, 388, 280, 10, 0); reporte.contenido.roundRectangle(35, 368, 280, 20, 0); //// reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 13); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.agregaObjeto(reporte.crearImagen("imagenes/grande300115.jpg", 335, -23, 30)); /*2*/reporte.agregarImagen(reporte.crearImagen("imagenes/grande300115.jpg", 100, -390, 30));//-390//-375 reporte.contenido.setFontAndSize(bf, 12); reporte.contenido.setColorFill(BaseColor.BLACK); if (miAlmacen.getTipoMovimiento() == 1) { if (miAlmacen.getOperacion() == 1 || miAlmacen.getOperacion() == 2 || miAlmacen.getOperacion() == 3) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimiento en Almacn (Entrada de Material): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 767, 0); if (miAlmacen.getOperacion() == 5) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Devolucin de ventas): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 767, 0); ////*2 if (miAlmacen.getOperacion() == 1 || miAlmacen.getOperacion() == 2 || miAlmacen.getOperacion() == 3) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimiento en Almacn (Entrada de Material): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 400, 0); if (miAlmacen.getOperacion() == 6) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Devolucin de ventas): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 400, 0); ///// } else { if (miAlmacen.getOperacion() == 1 || miAlmacen.getOperacion() == 2 || miAlmacen.getOperacion() == 3) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento de Almacn (Devolucin de material a proveedor): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 767, 0); if (miAlmacen.getOperacion() == 6) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Entrega de ventas): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 767, 0); ///**2 if (miAlmacen.getOperacion() == 1 || miAlmacen.getOperacion() == 2 || miAlmacen.getOperacion() == 3) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Movimiento de Almacn (Devolucin de material a proveedor): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 400, 0); if (miAlmacen.getOperacion() == 6) reporte.contenido.showTextAligned( PdfContentByte.ALIGN_LEFT, "Movimientos de Almacn (Entrega de ventas): " + almacen.getIdAlmacen() + " Pedido:" + almacen.getPedido().getIdPedido(), 35, 400, 0); /// } reporte.contenido.setFontAndSize(bf, 7); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 306, 757, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 306, 390, 0); if (ord != null) ord = (Orden) session.get(Orden.class, ord.getIdOrden()); //************************datos de movimiento**************************** DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");//YYYY-MM-DD HH:MM:SS reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Materiales y Refacciones del Almacn", 40, 757, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Materiales y Refacciones del Almacn", 40, 390, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Movimiento: " + almacen.getIdAlmacen(), 40, 747, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Movimiento: " + almacen.getIdAlmacen(), 40, 380, 0); if (almacen.getTipoMovimiento() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Entrada", 120, 747, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Salida", 120, 747, 0); ////2 if (almacen.getTipoMovimiento() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Entrada", 120, 380, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Movimiento : Salida", 120, 380, 0); //// if (almacen.getOperacion() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido", 220, 747, 0); if (almacen.getOperacion() == 2) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido E.", 220, 747, 0); if (almacen.getOperacion() == 3) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido A.", 220, 747, 0); if (almacen.getOperacion() == 6) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Venta", 220, 747, 0); ////2 if (almacen.getOperacion() == 1) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido", 220, 380, 0); if (almacen.getOperacion() == 2) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido E.", 220, 380, 0); if (almacen.getOperacion() == 3) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Pedido A.", 220, 380, 0); if (almacen.getOperacion() == 6) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Tipo de Operacin : Venta", 220, 380, 0); //// if (ord != null) { reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Orden: " + ord.getIdOrden(), 40, 737, 0); /*2*/reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N. Orden: " + ord.getIdOrden(), 40, 370, 0); } //Firmas de material if (miAlmacen.getTipoMovimiento() == 1) { reporte.contenido.roundRectangle(45, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getEntrego(), 45, 440, 0); reporte.contenido.roundRectangle(250, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 440, 0); reporte.contenido.roundRectangle(440, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getUsuario().getEmpleado().getNombre(), 440, 440, 0); } else { reporte.contenido.roundRectangle(45, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getUsuario().getEmpleado().getNombre(), 45, 440, 0); reporte.contenido.roundRectangle(250, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 440, 0); reporte.contenido.roundRectangle(440, 450, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getEntrego(), 440, 440, 0); } ///2 if (miAlmacen.getTipoMovimiento() == 1) { reporte.contenido.roundRectangle(45, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getEntrego(), 45, 20, 0); reporte.contenido.roundRectangle(250, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 20, 0); reporte.contenido.roundRectangle(440, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getUsuario().getEmpleado().getNombre(), 440, 20, 0); } else { reporte.contenido.roundRectangle(45, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "ENTREGA: " + almacen.getUsuario().getEmpleado().getNombre(), 45, 20, 0); reporte.contenido.roundRectangle(250, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "AUTORIZA: ", 250, 20, 0); reporte.contenido.roundRectangle(440, 30, 130, 1, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "RECIBE: " + almacen.getEntrego(), 440, 20, 0); } /// reporte.finTexto(); reporte.contenido.setFontAndSize(bf, 12); //agregamos renglones vacios para dejar un espacio(tabla) reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; int centro = Element.ALIGN_CENTER; tabla.addCell(reporte.celda("N", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("#", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("N Parte", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Descripcin", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Med", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Cant", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); if (tabla.getNumberOfColumns() > 6) { tabla.addCell(reporte.celda("Costo c/u", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Total", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); }
From source file:Almacen.Reporte2.java
public void cabecera(PDF reporte, BaseFont bf, PdfPTable tabla, String titulo1, int op) { Session session = HibernateUtil.getSessionFactory().openSession(); try {/* w w w. j av a 2s. c o m*/ reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, con.getEmpresa(), 35, 755, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); String titulo = titulo1; if (op == 1) { if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) titulo += " del " + t_fecha1.getText(); if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) titulo += " al " + t_fecha2.getText(); } reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, titulo, 35, 745, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 570, 745, 0); reporte.finTexto(); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; if (op == 1) { for (int a = 0; a < tabla.getNumberOfColumns(); a++) { tabla.addCell(reporte.celda(t_datos.getColumnName(a), font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } } if (op == 2) { for (int a = 0; a < tabla.getNumberOfColumns(); a++) { tabla.addCell(reporte.celda(t_datos1.getColumnName(a), font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } } } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); }
From source file:Almacen.Reporte2.java
public void cabecera1(PDF reporte, BaseFont bf, PdfPTable tabla, String titulo1, int op) { Session session = HibernateUtil.getSessionFactory().openSession(); try {// w ww . ja v a 2 s.c o m reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, con.getEmpresa(), 35, 755, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); String titulo = titulo1; reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, titulo, 35, 745, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 570, 745, 0); reporte.finTexto(); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; for (int a = 0; a < tabla.getNumberOfColumns(); a++) { tabla.addCell(reporte.celda(t_datos2.getColumnName(a), font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); }
From source file:bouttime.report.bracketsheet.Bracket16BracketSheetReport.java
License:Open Source License
@Override protected boolean drawBracket(PdfContentByte cb, BaseFont bf, Dao dao, Group group, boolean doBoutNumbers) throws DocumentException, IOException { float leftMargin = 65; if (doBoutNumbers) { BracketSheetUtil.drawMatBox(cb, bf, matBoxStartX, matBoxStartY, matBoxWidth, matBoxHeight, matBoxTopPad, matBoxBottomPad, 1, 0, (group != null) ? group.getMat() : "", 90); }/*from w w w . j a v a 2 s .co m*/ BracketSheetUtil.drawTournamentHeader(cb, bf, matBoxStartX, 35, dao, 90); if (group != null) { RoundRobinBracketSheetUtil.drawTitle(cb, bf, 35, cb.getPdfDocument().getPageSize().getHeight() / 2, group, 90); } Wrestler w1 = null; Wrestler w2 = null; Wrestler w3 = null; Wrestler w4 = null; Wrestler w5 = null; Wrestler w6 = null; Wrestler w7 = null; Wrestler w8 = null; Wrestler w9 = null; Wrestler w10 = null; Wrestler w11 = null; Wrestler w12 = null; Wrestler w13 = null; Wrestler w14 = null; Wrestler w15 = null; Wrestler w16 = null; Wrestler wa = null; if (group != null) { w1 = group.getWrestlerAtSeed(1); w2 = group.getWrestlerAtSeed(2); w3 = group.getWrestlerAtSeed(3); w4 = group.getWrestlerAtSeed(4); w5 = group.getWrestlerAtSeed(5); w6 = group.getWrestlerAtSeed(6); w7 = group.getWrestlerAtSeed(7); w8 = group.getWrestlerAtSeed(8); w9 = group.getWrestlerAtSeed(9); w10 = group.getWrestlerAtSeed(10); w11 = group.getWrestlerAtSeed(11); w12 = group.getWrestlerAtSeed(12); w13 = group.getWrestlerAtSeed(13); w14 = group.getWrestlerAtSeed(14); w15 = group.getWrestlerAtSeed(15); w16 = group.getWrestlerAtSeed(16); } float xStart = leftMargin + 30; float x = xStart; float yStart = 395; float y = yStart; float length = 150; float height = 30; BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w1 != null) ? w1.getString4Bracket() : "", 90, (w1 != null) ? w1.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w16 != null) ? w16.getString4Bracket() : "", 90, (w16 != null) ? w16.isScratched() : false); Bout b = (group != null) ? group.getBout(Bout.ROUND_1, 1) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w9 != null) ? w9.getString4Bracket() : "", 90, (w9 != null) ? w9.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w8 != null) ? w8.getString4Bracket() : "", 90, (w8 != null) ? w8.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 2) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w5 != null) ? w5.getString4Bracket() : "", 90, (w5 != null) ? w5.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w12 != null) ? w12.getString4Bracket() : "", 90, (w12 != null) ? w12.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 3) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w13 != null) ? w13.getString4Bracket() : "", 90, (w13 != null) ? w13.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w4 != null) ? w4.getString4Bracket() : "", 90, (w4 != null) ? w4.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 4) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w3 != null) ? w3.getString4Bracket() : "", 90, (w3 != null) ? w3.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w14 != null) ? w14.getString4Bracket() : "", 90, (w14 != null) ? w14.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 5) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w11 != null) ? w11.getString4Bracket() : "", 90, (w11 != null) ? w11.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w6 != null) ? w6.getString4Bracket() : "", 90, (w6 != null) ? w6.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 6) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w7 != null) ? w7.getString4Bracket() : "", 90, (w7 != null) ? w7.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w10 != null) ? w10.getString4Bracket() : "", 90, (w10 != null) ? w10.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 7) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 2, y + 2, 10, (w15 != null) ? w15.getString4Bracket() : "", 90, (w15 != null) ? w15.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 9, y + 2, 10, (w2 != null) ? w2.getString4Bracket() : "", 90, (w2 != null) ? w2.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 8) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 10, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); // Round 2 x = xStart + (height / 2); y = yStart + length; float round2height = height * 2; float round2length = (length / 5) * 2; // 40% BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 15, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "D", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 5), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 15, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "E", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 5), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 15, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "F", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 5), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 15, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "G", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 5), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } // Round 4 x = xStart + (height / 2) + (round2height / 2); y = yStart + length + round2length; float round4height = round2height * 2; float round4length = round2length; BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round4height / 2) - 10, y + (round4length / 2), 10, 5, 2, 12, 1, 0, "B", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round4height / 2) + 10), y + ((round4length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round4height); BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round4height / 2) - 10, y + (round4length / 2), 10, 5, 2, 12, 1, 0, "C", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round4height / 2) + 10), y + ((round4length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } // Round 6 x = xStart + (height / 2) + (round2height / 2) + (round4height / 2); y = yStart + length + round2length + round4length; float round6height = round4height * 2; float round6length = round4length; b = (group != null) ? group.getBout(Bout.ROUND_6, 1) : null; BracketSheetUtil.drawFishTailUp(cb, x, y, round6length, round6height, 1, 0); if (b != null) { wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round6height + 10, y + 8, 10, wa.getLastName(), 90, wa.isScratched()); } } x = x + (round6height / 2); y = y + round6length; float finalLength = (round6length / 3) * 3; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); float fontsize = 8; float mid = y + (finalLength / 2); x += 15; // padding below the line BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "Champion", 90); y -= 50; BracketSheetUtil.drawBoutLabel(cb, bf, x - 50, y + 10, 10, 5, 2, 12, 1, 0, "A", 90); if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x, y, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 18, y + 58, 10, wa.getLastName(), 90); } } ///////////////////////////// // Draw consolation/back side ///////////////////////////// // Round 2 float consYStart = yStart - round2length; float consXStart = xStart + (height / 2); x = consXStart; y = consYStart; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 5) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 6) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 7) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 8) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } // Round 3 float consRound3height = (round2height / 5) * 4; // 80% fontsize = 8; x = consXStart + (round2height / 2); y = consYStart - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 3, y + round2length + 3, fontsize, "Loser G", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { if (b != null) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound3height / 3), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize, "Loser F", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound3height / 3), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (round2height * 2) + ((round2height / 5) * 4); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 3, y + round2length + 3, fontsize, "Loser E", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound3height / 3), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize, "Loser D", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound3height / 3), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } // Round 4 float consRound4height = (consRound3height * 2) - ((round2height / 5) * 2); // minus 40% x = consXStart + (round2height / 2) + (consRound3height / 2); y = consYStart - round2length - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound4height / 2), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (consRound3height * 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (consRound4height / 2), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } // Round 5 float consRound5height = (consRound4height * 2) - ((consRound4height / 5) * 3); // minus 60% x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2); y = consYStart - round2length - round2length - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound5height + 3, y + round2length + 3, fontsize, "Loser B", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound5height / 2) - 12, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "X", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound5height / 2) + 12), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + consRound5height + ((consRound5height / 5) * 2); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize, "Loser C", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound5height / 2) - 12, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "Y", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound5height / 2) + 12), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } // Round 6 float consRound6height = (consRound5height * 2) - ((consRound5height / 5) * 3); // 60% x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2) + (consRound5height / 2); y = y - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound6height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound6height / 2) - 12, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "Z", 90); b = (group != null) ? group.getBout(Bout.ROUND_6, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound6height / 2) + 12), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 12, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound6height + 10, y + round2length - 12, 10, wa.getLastName(), 90); } } x = x + (consRound6height / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "3rd Place", 90); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 18, y + round2length - 12, 10, wa.getLastName(), 90); } } // 2nd place challenge if (dao.isSecondPlaceChallengeEnabled()) { float challengeX = 530; float challengeY = 670; x = challengeX; y = challengeY; float height2 = height; // 66% b = (group != null) ? group.getBout(Bout.ROUND_7, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height2 / 6), y + (length / 8), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 3, y + 8, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x + height2 + 10, y + 8, 10, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, height2, 1, 0); fontsize = 8; BracketSheetUtil.drawString(cb, bf, x, y - 30, fontsize, "Loser A", 90); BracketSheetUtil.drawString(cb, bf, x + height2, y - 37, fontsize, "Winner Z", 90); x += (height2 / 2); y = y + round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 3, y + 5, 10, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "2nd Challenge", 90); } if (dao.isFifthPlaceEnabled()) { float fifthX = 530; float fifthY = 150; x = fifthX; y = fifthY; float height2 = height; // 66% float height5th = (height / 3) * 2; // 66% b = (group != null) ? group.getBout(Bout.ROUND_6, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height2 / 6), y + (length / 8), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 6, 10, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + height2 + 10, y + round2length - 6, 10, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, height2, 1, 0); fontsize = 8; BracketSheetUtil.drawString(cb, bf, x, y + round2length + 3, fontsize, "Loser X", 90); BracketSheetUtil.drawString(cb, bf, x + height2, y + round2length + 3, fontsize, "Loser Y", 90); x += (height2 / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + finalLength - 12, 10, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "5th Place", 90); } return true; }
From source file:bouttime.report.bracketsheet.Bracket32BracketSheetReport.java
License:Open Source License
@Override protected boolean drawBracket(PdfContentByte cb, BaseFont bf, Dao dao, Group group, boolean doBoutNumbers) throws DocumentException, IOException { float leftMargin = 65; if (doBoutNumbers) { BracketSheetUtil.drawMatBox(cb, bf, matBoxStartX, matBoxStartY, matBoxWidth, matBoxHeight, matBoxTopPad, matBoxBottomPad, 1, 0, (group != null) ? group.getMat() : "", 90); }// ww w. j a va 2 s. c om BracketSheetUtil.drawTournamentHeader(cb, bf, matBoxStartX, 35, dao, 90); if (group != null) { RoundRobinBracketSheetUtil.drawTitle(cb, bf, 35, cb.getPdfDocument().getPageSize().getHeight() / 2, group, 90); } Wrestler w1 = null; Wrestler w2 = null; Wrestler w3 = null; Wrestler w4 = null; Wrestler w5 = null; Wrestler w6 = null; Wrestler w7 = null; Wrestler w8 = null; Wrestler w9 = null; Wrestler w10 = null; Wrestler w11 = null; Wrestler w12 = null; Wrestler w13 = null; Wrestler w14 = null; Wrestler w15 = null; Wrestler w16 = null; Wrestler w17 = null; Wrestler w18 = null; Wrestler w19 = null; Wrestler w20 = null; Wrestler w21 = null; Wrestler w22 = null; Wrestler w23 = null; Wrestler w24 = null; Wrestler w25 = null; Wrestler w26 = null; Wrestler w27 = null; Wrestler w28 = null; Wrestler w29 = null; Wrestler w30 = null; Wrestler w31 = null; Wrestler w32 = null; Wrestler wa = null; if (group != null) { w1 = group.getWrestlerAtSeed(1); w2 = group.getWrestlerAtSeed(2); w3 = group.getWrestlerAtSeed(3); w4 = group.getWrestlerAtSeed(4); w5 = group.getWrestlerAtSeed(5); w6 = group.getWrestlerAtSeed(6); w7 = group.getWrestlerAtSeed(7); w8 = group.getWrestlerAtSeed(8); w9 = group.getWrestlerAtSeed(9); w10 = group.getWrestlerAtSeed(10); w11 = group.getWrestlerAtSeed(11); w12 = group.getWrestlerAtSeed(12); w13 = group.getWrestlerAtSeed(13); w14 = group.getWrestlerAtSeed(14); w15 = group.getWrestlerAtSeed(15); w16 = group.getWrestlerAtSeed(16); w17 = group.getWrestlerAtSeed(17); w18 = group.getWrestlerAtSeed(18); w19 = group.getWrestlerAtSeed(19); w20 = group.getWrestlerAtSeed(20); w21 = group.getWrestlerAtSeed(21); w22 = group.getWrestlerAtSeed(22); w23 = group.getWrestlerAtSeed(23); w24 = group.getWrestlerAtSeed(24); w25 = group.getWrestlerAtSeed(25); w26 = group.getWrestlerAtSeed(26); w27 = group.getWrestlerAtSeed(27); w28 = group.getWrestlerAtSeed(28); w29 = group.getWrestlerAtSeed(29); w30 = group.getWrestlerAtSeed(30); w31 = group.getWrestlerAtSeed(31); w32 = group.getWrestlerAtSeed(32); } int fontSize = 7; float xStart = leftMargin + 7; float x = xStart; float yStart = 425; float y = yStart; float length = 120; float height = 16; float boutNumHeight = 12; float boutNumWidth = 12; float boutNumXdiff = 2; float boutNumYdiff = length / 2; float boutNumTopPad = 2; float boutNumBotPad = 2; int boutNumFontSize = 8; BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w1 != null) ? w1.getString4Bracket() : "", 90, (w1 != null) ? w1.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w32 != null) ? w32.getString4Bracket() : "", 90, (w32 != null) ? w32.isScratched() : false); Bout b = (group != null) ? group.getBout(Bout.ROUND_1, 1) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w17 != null) ? w17.getString4Bracket() : "", 90, (w17 != null) ? w17.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w16 != null) ? w16.getString4Bracket() : "", 90, (w16 != null) ? w16.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 2) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w9 != null) ? w9.getString4Bracket() : "", 90, (w9 != null) ? w9.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w24 != null) ? w24.getString4Bracket() : "", 90, (w24 != null) ? w24.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 3) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w25 != null) ? w25.getString4Bracket() : "", 90, (w25 != null) ? w25.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w8 != null) ? w8.getString4Bracket() : "", 90, (w8 != null) ? w8.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 4) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w5 != null) ? w5.getString4Bracket() : "", 90, (w5 != null) ? w5.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w28 != null) ? w28.getString4Bracket() : "", 90, (w28 != null) ? w28.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 5) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w21 != null) ? w21.getString4Bracket() : "", 90, (w21 != null) ? w21.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w12 != null) ? w12.getString4Bracket() : "", 90, (w12 != null) ? w12.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 6) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w13 != null) ? w13.getString4Bracket() : "", 90, (w13 != null) ? w13.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w20 != null) ? w20.getString4Bracket() : "", 90, (w20 != null) ? w20.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 7) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w29 != null) ? w29.getString4Bracket() : "", 90, (w29 != null) ? w29.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w4 != null) ? w4.getString4Bracket() : "", 90, (w4 != null) ? w4.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 8) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w3 != null) ? w3.getString4Bracket() : "", 90, (w3 != null) ? w3.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w30 != null) ? w30.getString4Bracket() : "", 90, (w30 != null) ? w30.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 9) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w19 != null) ? w19.getString4Bracket() : "", 90, (w19 != null) ? w19.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w14 != null) ? w14.getString4Bracket() : "", 90, (w14 != null) ? w14.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 10) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w11 != null) ? w11.getString4Bracket() : "", 90, (w11 != null) ? w11.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w22 != null) ? w22.getString4Bracket() : "", 90, (w22 != null) ? w22.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 11) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w27 != null) ? w27.getString4Bracket() : "", 90, (w27 != null) ? w27.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w6 != null) ? w6.getString4Bracket() : "", 90, (w6 != null) ? w6.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 12) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w7 != null) ? w7.getString4Bracket() : "", 90, (w7 != null) ? w7.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w26 != null) ? w26.getString4Bracket() : "", 90, (w26 != null) ? w26.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 13) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w23 != null) ? w23.getString4Bracket() : "", 90, (w23 != null) ? w23.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w10 != null) ? w10.getString4Bracket() : "", 90, (w10 != null) ? w10.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 14) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w15 != null) ? w15.getString4Bracket() : "", 90, (w15 != null) ? w15.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w18 != null) ? w18.getString4Bracket() : "", 90, (w18 != null) ? w18.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 15) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 1, y + 2, fontSize, (w31 != null) ? w31.getString4Bracket() : "", 90, (w31 != null) ? w31.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 6, y + 2, fontSize, (w2 != null) ? w2.getString4Bracket() : "", 90, (w2 != null) ? w2.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 16) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff, y + boutNumYdiff, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 1, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 1, 0); // Round 2 x = xStart + (height / 2); y = yStart + length; float round2height = height * 2; float round2length = (length / 5) * 2; // 40% float boutNumYdiff2 = (round2length / 2) + 8; float boutNumXdiff2 = (round2height / 2) + 2; float boutNumWidth2 = 12; float boutNumHeight2 = 12; float boutNumTopPad2 = 2; float boutNumBotPad2 = 2; int boutNumFontSize2 = 8; int boutLabelFontSize = 8; float boutLabelRadius = 6; float boutLabelXdiff2 = (round2height / 2) - 7; float boutLabelYdiff2 = (round2length / 2) + 13; float boutLabelBotPad2 = 2; float boutLabelTopPad2 = 3; BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "H", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "I", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "J", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "K", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "L", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 5) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "M", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 6) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "N", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 7) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff2, y + boutLabelYdiff2, boutLabelRadius, boutLabelTopPad2, boutLabelBotPad2, boutLabelFontSize, 1, 0, "O", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 8) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } // Round 4 x = xStart + (height / 2) + (round2height / 2); y = yStart + length + round2length; float round4height = round2height * 2; float round4length = round2length; float boutNumYdiff4 = round4length / 2; float boutNumXdiff4 = (round4height / 2) + 12; float boutLabelXdiff4 = (round4height / 4); float boutLabelYdiff4 = (round4length / 2) + 7; float boutLabelBotPad4 = 2; float boutLabelTopPad4 = 4; boutLabelFontSize = 10; boutLabelRadius = 8; boutNumFontSize = 10; boutNumWidth = 15; boutNumHeight = 15; BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff4, y + boutLabelYdiff4, boutLabelRadius, boutLabelTopPad4, boutLabelBotPad4, boutLabelFontSize, 1, 0, "D", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff4, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round4height); BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff4, y + boutLabelYdiff4, boutLabelRadius, boutLabelTopPad4, boutLabelBotPad4, boutLabelFontSize, 1, 0, "E", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff4, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round4height); BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff4, y + boutLabelYdiff4, boutLabelRadius, boutLabelTopPad4, boutLabelBotPad4, boutLabelFontSize, 1, 0, "F", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff4, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round4height); BracketSheetUtil.drawFishTailUp(cb, x, y, round4length, round4height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff4, y + boutLabelYdiff4, boutLabelRadius, boutLabelTopPad4, boutLabelBotPad4, boutLabelFontSize, 1, 0, "G", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff4, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round4height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } // Round 6 x = xStart + (height / 2) + (round2height / 2) + (round4height / 2); y = yStart + length + round2length + round4length; float round6height = round4height * 2; float round6length = round4length; float boutNumYdiff6 = round6length / 2; float boutNumXdiff6 = (round6height / 4) * 3; float boutLabelXdiff6 = (round6height / 4); float boutLabelYdiff6 = (round6length / 2) + 7; float boutLabelBotPad6 = 2; float boutLabelTopPad6 = 4; boutLabelFontSize = 10; boutLabelRadius = 8; boutNumFontSize = 10; boutNumWidth = 15; boutNumHeight = 15; BracketSheetUtil.drawFishTailUp(cb, x, y, round6length, round6height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff6, y + boutLabelYdiff6, boutLabelRadius, boutLabelTopPad6, boutLabelBotPad6, boutLabelFontSize, 1, 0, "B", 90); b = (group != null) ? group.getBout(Bout.ROUND_6, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff6, y + boutNumYdiff6, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round6height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round6height); BracketSheetUtil.drawFishTailUp(cb, x, y, round6length, round6height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff6, y + boutLabelYdiff6, boutLabelRadius, boutLabelTopPad6, boutLabelBotPad6, boutLabelFontSize, 1, 0, "C", 90); b = (group != null) ? group.getBout(Bout.ROUND_6, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff6, y + boutNumYdiff6, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round6height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } // Round 8 x = xStart + (height / 2) + (round2height / 2) + (round4height / 2) + (round6height / 2); y = yStart + length + round2length + round4length + round6length; float round8height = round6height * 2; float round8length = round6length; float boutNumYdiff8 = (round8length / 2) - 5; float boutNumXdiff8 = (round8height / 3) * 2; boutNumFontSize = 12; boutNumWidth = 20; boutNumHeight = 20; boutNumTopPad = 0; boutNumBotPad = 5; BracketSheetUtil.drawFishTailUp(cb, x, y, round8length, round8height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_8, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff8, y + boutNumYdiff8, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 3, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round8height + 10, y + 8, fontSize, wa.getLastName(), 90, wa.isScratched()); } } BracketSheetUtil.drawBoutLabel(cb, bf, x + (round8height / 3), y + boutNumYdiff8 + 8, 10, 5, 2, 12, 1, 0, "A", 90); x = x + (round8height / 2); y = y + round8length; float finalLength = (round6length / 3) * 3; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); float fontsize = 8; float mid = y + (finalLength / 2); x += 15; // padding below the line BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "Champion", 90); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 18, y + 8, fontSize, wa.getLastName(), 90); } } //y -= 50; ///////////////////////////// // Draw consolation/back side ///////////////////////////// // Round 2 float consYStart = yStart - round2length; float consXStart = xStart + (height / 2); boutNumYdiff2 = 5; boutNumXdiff2 = (height / 2) + 2; x = consXStart; y = consYStart; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 9) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 10) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 11) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 12) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 13) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 14) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 15) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 16) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff2, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 3 float consRound3height = (round2height / 5) * 4; // 80% float boutNumXdiff3 = (consRound3height / 4); fontsize = 8; x = consXStart + (round2height / 2); y = consYStart - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 5, y + round2length + 3, fontsize - 1, "Loser O", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 1, y + round2length + 3, fontsize - 1, "Loser N", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (round2height * 2) + ((round2height / 5) * 4); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 5, y + round2length + 3, fontsize - 1, "Loser M", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 1, y + round2length + 3, fontsize - 1, "Loser L", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (round2height * 2) + ((round2height / 5) * 4); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 5, y + round2length + 3, fontsize - 1, "Loser K", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 5) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 1, y + round2length + 3, fontsize - 1, "Loser J", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 6) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (round2height * 2) + ((round2height / 5) * 4); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 5, y + round2length + 3, fontsize - 1, "Loser I", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 7) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 1, y + round2length + 3, fontsize - 1, "Loser H", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 8) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff3, y + boutNumYdiff2, boutNumWidth2, boutNumHeight2, boutNumTopPad2, boutNumBotPad2, boutNumFontSize2, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 6, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 4 float consRound4height = (consRound3height * 2) - ((round2height / 5) * 2); // minus 40% boutNumXdiff4 = (consRound4height / 4); x = consXStart + (round2height / 2) + (consRound3height / 2); y = consYStart - round2length - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 5) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound3height * 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 6) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound3height * 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 7) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound3height * 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_4, 8) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff4, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 5 float consRound5height = (consRound4height * 2) - ((consRound4height / 5) * 3); // minus 60% float boutNumXdiff5 = (consRound5height / 3); x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2); y = consYStart - round2length - round2length - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound5height + 3, y + round2length + 3, fontsize - 1, "Loser E", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff5, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + consRound5height + ((consRound5height / 5) * 2); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize - 1, "Loser D", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff5, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound5height * 3) + ((consRound5height / 6) * 2); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound5height + 3, y + round2length + 3, fontsize - 1, "Loser G", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff5, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + consRound5height + ((consRound5height / 5) * 2); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound5height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize - 1, "Loser F", 90); b = (group != null) ? group.getBout(Bout.ROUND_5, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff5, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound5height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 6 float consRound6height = (consRound5height * 2) - ((consRound5height / 5) * 3); // 60% boutNumXdiff6 = (consRound6height / 3); boutNumYdiff6 = round2height / 3; x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2) + (consRound5height / 2); y = y - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound6height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_6, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff6, y + boutNumYdiff6, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound6height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound6height * 2) + ((consRound6height / 5) * 7); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound6height, 1, 0); b = (group != null) ? group.getBout(Bout.ROUND_6, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff6, y + boutNumYdiff6, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound6height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 7 float consRound7height = (consRound6height * 2) - ((consRound6height / 5) * 3); // 60% float boutNumXdiff7 = (consRound7height / 3) * 2; float boutLabelXdiff7 = (consRound7height / 3); x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2) + (consRound5height / 2) + (consRound6height / 2); y = y - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound7height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + consRound7height + 3, y + round2length + 3, fontsize - 1, "Loser C", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff7, y + boutNumYdiff2 + 10, 10, 5, 2, 12, 1, 0, "X", 90); b = (group != null) ? group.getBout(Bout.ROUND_7, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff7, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound7height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + consRound7height + ((consRound7height / 5) * 2); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound7height, 1, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize - 1, "Loser B", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff7, y + boutNumYdiff2 + 10, 10, 5, 2, 12, 1, 0, "Y", 90); b = (group != null) ? group.getBout(Bout.ROUND_7, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff7, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound7height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } // Round 8 float consRound8height = (consRound7height * 2) - ((consRound7height / 5) * 3); // 60% boutNumXdiff8 = (consRound8height / 3) * 2; float boutLabelXdiff8 = (consRound8height / 3); x = consXStart + (round2height / 2) + (consRound3height / 2) + (consRound4height / 2) + (consRound5height / 2) + (consRound6height / 2) + (consRound7height / 2); y = y - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound8height, 1, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + boutLabelXdiff8, y + boutNumYdiff2 + 10, 10, 5, 2, 12, 1, 0, "Z", 90); b = (group != null) ? group.getBout(Bout.ROUND_8, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + boutNumXdiff8, y + boutNumYdiff2, boutNumWidth, boutNumHeight, boutNumTopPad, boutNumBotPad, boutNumFontSize, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 1, y + round2length - 12, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound8height + 7, y + round2length - 12, fontSize, wa.getLastName(), 90); } } x = x + (consRound8height / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "3rd Place", 90); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 18, y + finalLength - 12, fontSize, wa.getLastName(), 90); } } // 2nd place challenge if (dao.isSecondPlaceChallengeEnabled()) { float challengeX = 540; float challengeY = 700; x = challengeX; y = challengeY; float height2 = height + 15; b = (group != null) ? group.getBout(Bout.ROUND_9, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height2 / 6), y + (length / 8), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 3, y + 8, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x + height2 + 10, y + 8, fontSize, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, height2, 1, 0); fontsize = 8; BracketSheetUtil.drawString(cb, bf, x, y - 30, fontsize - 1, "Loser A", 90); BracketSheetUtil.drawString(cb, bf, x + height2, y - 37, fontsize - 1, "Winner Z", 90); x += (height2 / 2); y = y + round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "2nd Challenge", 90); } // 5th place challenge if (dao.isFifthPlaceEnabled()) { float fifthX = 540; float fifthY = 100; float height2 = height + 15; x = fifthX; y = fifthY; float height5th = height2; b = (group != null) ? group.getBout(Bout.ROUND_8, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height5th / 6), y + (length / 8), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + round2length - 6, fontSize, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + height2 + 10, y + round2length - 6, fontSize, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, height2, 1, 0); fontsize = 8; BracketSheetUtil.drawString(cb, bf, x, y + round2length + 3, fontsize - 1, "Loser X", 90); BracketSheetUtil.drawString(cb, bf, x + height2, y + round2length + 3, fontsize - 1, "Loser Y", 90); x += (height2 / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 1, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + finalLength - 12, fontSize, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 8; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "5th Place", 90); } return true; }
From source file:bouttime.report.bracketsheet.Bracket4BracketSheetReport.java
License:Open Source License
@Override protected boolean drawBracket(PdfContentByte cb, BaseFont bf, Dao dao, Group group, boolean doBoutNumbers) throws DocumentException, IOException { if (doBoutNumbers) { BracketSheetUtil.drawMatBox(cb, bf, matBoxStartX, matBoxStartY, matBoxWidth, matBoxHeight, matBoxTopPad, matBoxBottomPad, 1, 0, (group != null) ? group.getMat() : "", 90); }/*from w ww .j a va 2 s . c o m*/ BracketSheetUtil.drawTournamentHeader(cb, bf, matBoxStartX, 35, dao, 90); if (group != null) { RoundRobinBracketSheetUtil.drawTitle(cb, bf, 35, cb.getPdfDocument().getPageSize().getHeight() / 2, group, 90); } List<Wrestler> wList = null; Wrestler w1 = null; Wrestler w2 = null; Wrestler w3 = null; Wrestler w4 = null; Wrestler wa = null; if (group != null) { w1 = group.getWrestlerAtSeed(1); w2 = group.getWrestlerAtSeed(2); w3 = group.getWrestlerAtSeed(3); w4 = group.getWrestlerAtSeed(4); } float xStart = leftMargin + 30; float x = xStart; float yStart = 290; float y = yStart; float length = 250; float height = 120; BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w1 != null) ? w1.getString4Bracket() : "", 90, (w1 != null) ? w1.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w4 != null) ? w4.getString4Bracket() : "", 90, (w4 != null) ? w4.isScratched() : false); Bout b = (group != null) ? group.getBout(Bout.ROUND_1, 1) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w3 != null) ? w3.getString4Bracket() : "", 90, (w3 != null) ? w3.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w2 != null) ? w2.getString4Bracket() : "", 90, (w2 != null) ? w2.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 2) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); x = xStart + (height / 2); y = yStart + length; float round2height = height * 2; float round2length = length / 2; BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 2, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 1) : null; if (b != null) { wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 10, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 20, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } } x = x + (round2height / 2); y = y + round2length; float finalLength = (round2length / 3) * 3; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); float fontsize = 12; float mid = y + (finalLength / 2); x += 15; // padding below the line BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "Champion", 90); y -= 50; b = (group != null) ? group.getBout(Bout.ROUND_2, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x, y, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 20, y + 58, 12, wa.getLastName(), 90); } } BracketSheetUtil.drawBoutLabel(cb, bf, x - 50, y + 10, 10, 5, 2, 12, 1, 0, "A", 90); // Draw consolation bracket float consYStart = yStart - round2length; float consXStart = xStart + (height / 2); x = consXStart; y = consYStart; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 2, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 2) : null; if (b != null) { wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 10, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 20, y + round2length - 12, 12, wa.getLastName(), 90); } } x = x + (round2height / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 12; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "3rd Place", 90); if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x, consYStart + 30, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 20, y + round2length - 12, 12, wa.getLastName(), 90); } } BracketSheetUtil.drawBoutLabel(cb, bf, x - 50, consYStart + 40, 10, 5, 2, 12, 1, 0, "Z", 90); if (dao.isSecondPlaceChallengeEnabled()) { float challengeX = 500; float challengeY = 550; x = challengeX; y = challengeY; height = height / 2; b = (group != null) ? group.getBout(Bout.ROUND_3, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 3), y + (length / 4), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 5, y + 8, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x + height + 14, y + 8, 12, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, height, 2, 0); fontsize = 10; BracketSheetUtil.drawString(cb, bf, x, y - 40, fontsize, "Loser A", 90); BracketSheetUtil.drawString(cb, bf, x + height, y - 47, fontsize, "Winner Z", 90); x += (height / 2); y = y + round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 3, y + 5, 12, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 10; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "2nd Challenge", 90); } return true; }
From source file:bouttime.report.bracketsheet.Bracket8BracketSheetReport.java
License:Open Source License
@Override protected boolean drawBracket(PdfContentByte cb, BaseFont bf, Dao dao, Group group, boolean doBoutNumbers) throws DocumentException, IOException { float leftMargin = 65; if (doBoutNumbers) { BracketSheetUtil.drawMatBox(cb, bf, matBoxStartX, matBoxStartY, matBoxWidth, matBoxHeight, matBoxTopPad, matBoxBottomPad, 1, 0, (group != null) ? group.getMat() : "", 90); }//from w ww . j av a 2 s. c o m BracketSheetUtil.drawTournamentHeader(cb, bf, matBoxStartX, 35, dao, 90); if (group != null) { RoundRobinBracketSheetUtil.drawTitle(cb, bf, 35, cb.getPdfDocument().getPageSize().getHeight() / 2, group, 90); } Wrestler w1 = null; Wrestler w2 = null; Wrestler w3 = null; Wrestler w4 = null; Wrestler w5 = null; Wrestler w6 = null; Wrestler w7 = null; Wrestler w8 = null; Wrestler wa = null; if (group != null) { w1 = group.getWrestlerAtSeed(1); w2 = group.getWrestlerAtSeed(2); w3 = group.getWrestlerAtSeed(3); w4 = group.getWrestlerAtSeed(4); w5 = group.getWrestlerAtSeed(5); w6 = group.getWrestlerAtSeed(6); w7 = group.getWrestlerAtSeed(7); w8 = group.getWrestlerAtSeed(8); } float xStart = leftMargin + 30; float x = xStart; float yStart = 355; float y = yStart; float length = 200; float height = 60; BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w1 != null) ? w1.getString4Bracket() : "", 90, (w1 != null) ? w1.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w8 != null) ? w8.getString4Bracket() : "", 90, (w8 != null) ? w8.isScratched() : false); Bout b = (group != null) ? group.getBout(Bout.ROUND_1, 1) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w5 != null) ? w5.getString4Bracket() : "", 90, (w5 != null) ? w5.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w4 != null) ? w4.getString4Bracket() : "", 90, (w4 != null) ? w4.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 2) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w3 != null) ? w3.getString4Bracket() : "", 90, (w3 != null) ? w3.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w6 != null) ? w6.getString4Bracket() : "", 90, (w6 != null) ? w6.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 3) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); x = x + (2 * height); BracketSheetUtil.drawString(cb, bf, x - 5, y + 5, 12, (w7 != null) ? w7.getString4Bracket() : "", 90, (w7 != null) ? w7.isScratched() : false); BracketSheetUtil.drawString(cb, bf, x + height + 12, y + 5, 12, (w2 != null) ? w2.getString4Bracket() : "", 90, (w2 != null) ? w2.isScratched() : false); b = (group != null) ? group.getBout(Bout.ROUND_1, 4) : null; if ((b != null) && !b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height / 2) - 8, y + (length / 2), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } BracketSheetUtil.drawFishTailUp(cb, x, y, length, height, 2, 0); BracketSheetUtil.drawHorizontalLine(cb, x, y, height, 2, 0); // Round 2 x = xStart + (height / 2); y = yStart + length; float round2height = height * 2; float round2length = (length / 5) * 2; // 40% BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 2, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 10, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "B", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 10), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 7, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 15, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, round2height, 2, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (round2height / 2) - 10, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "C", 90); b = (group != null) ? group.getBout(Bout.ROUND_2, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2) + 10), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 7, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round2height + 15, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } } // Round 4 - championship bout b = (group != null) ? group.getBout(Bout.ROUND_4, 1) : null; x = xStart + (height / 2) + (round2height / 2); y = yStart + length + round2length; float round3height = round2height * 2; float round3length = round2length; BracketSheetUtil.drawFishTailUp(cb, x, y, round3length, round3height, 2, 0); if (b != null) { wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 7, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x + round3height + 15, y + 8, 12, wa.getLastName(), 90, wa.isScratched()); } } x = x + (round3height / 2); y = y + round3length; float finalLength = (round3length / 3) * 3; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); float fontsize = 12; float mid = y + (finalLength / 2); x += 15; // padding below the line BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "Champion", 90); y -= 50; BracketSheetUtil.drawBoutLabel(cb, bf, x - 50, y + 10, 10, 5, 2, 12, 1, 0, "A", 90); if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x, y, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawString(cb, bf, x - 20, y + 58, 12, wa.getLastName(), 90); } } ///////////////////////////// // Draw consolation/back side ///////////////////////////// // Round 2 float consYStart = yStart - round2length; float consXStart = xStart + (height / 2); x = consXStart; y = consYStart; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 2, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 7, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 15, y + round2length - 12, 12, wa.getLastName(), 90); } } x = x + (2 * round2height); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, round2height, 2, 0); b = (group != null) ? group.getBout(Bout.ROUND_2, 4) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((round2height / 2)), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 7, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + round2height + 15, y + round2length - 12, 12, wa.getLastName(), 90); } } // Round 3 float consRound3height = (round2height / 5) * 4; // 80% fontsize = 10; x = consXStart + (round2height / 2); y = consYStart - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 2, 0); BracketSheetUtil.drawString(cb, bf, x + consRound3height + 3, y + round2length + 3, fontsize, "Loser C", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound3height / 2) - 12, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "X", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound3height / 2) + 12), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 7, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 15, y + round2length - 12, 12, wa.getLastName(), 90); } } x = x + round2height + (round2height / 5); BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound3height, 2, 0); BracketSheetUtil.drawString(cb, bf, x + 3, y + round2length + 3, fontsize, "Loser B", 90); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound3height / 2) - 12, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "Y", 90); b = (group != null) ? group.getBout(Bout.ROUND_3, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound3height / 2) + 12), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 7, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound3height + 15, y + round2length - 12, 12, wa.getLastName(), 90); } } // Round 4 float consRound4height = (consRound3height * 2) - ((round2height / 5) * 2); // minus 40% x = consXStart + (round2height / 2) + (consRound3height / 2); y = consYStart - round2length - round2length; BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, consRound4height, 2, 0); BracketSheetUtil.drawBoutLabel(cb, bf, x + (consRound4height / 2) - 25, y + (round2length / 2), 10, 5, 2, 12, 1, 0, "Z", 90); b = (group != null) ? group.getBout(Bout.ROUND_4, 2) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + ((consRound4height / 2) + 25), y + ((round2length / 2)) - 10, 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 7, y + round2length - 12, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + consRound4height + 15, y + round2length - 12, 12, wa.getLastName(), 90); } } x = x + (consRound4height / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 12; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "3rd Place", 90); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 20, y + round2length - 12, 12, wa.getLastName(), 90); } } if (dao.isSecondPlaceChallengeEnabled()) { float challengeX = 530; float challengeY = 620; x = challengeX; y = challengeY; float height2nd = (height / 3) * 2; // 66% b = (group != null) ? group.getBout(Bout.ROUND_5, 1) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height2nd / 4), y + (length / 4), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 5, y + 8, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x + height2nd + 14, y + 8, 12, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailUp(cb, x, y, round2length, height2nd, 2, 0); fontsize = 10; BracketSheetUtil.drawString(cb, bf, x, y - 40, fontsize, "Loser A", 90); BracketSheetUtil.drawString(cb, bf, x + height2nd, y - 47, fontsize, "Winner Z", 90); x += (height2nd / 2); y = y + round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_LEFT, x - 3, y + 5, 12, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 10; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "2nd Challenge", 90); } if (dao.isFifthPlaceEnabled()) { if ((group != null) && (group.getNumWrestlers() <= 5)) { // do nothing, since no 5th place bout } else { // We can't be sure that we DON'T need the 5th place bout float fifthX = 530; float fifthY = 150; x = fifthX; y = fifthY; float height5th = (height / 3) * 2; // 66% b = (group != null) ? group.getBout(Bout.ROUND_4, 3) : null; if (b != null) { if (!b.isBye() && doBoutNumbers) { BracketSheetUtil.drawBoutNum(cb, bf, x + (height5th / 4), y + (length / 8), 20, 20, 0, 6, 12, 1, 0, b.getBoutNum(), 90); } wa = b.getRed(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 5, y + round2length - 8, 12, wa.getLastName(), 90); } wa = b.getGreen(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x + height5th + 14, y + round2length - 8, 12, wa.getLastName(), 90); } } BracketSheetUtil.drawFishTailDown(cb, x, y, round2length, height5th, 2, 0); fontsize = 10; BracketSheetUtil.drawString(cb, bf, x, y + round2length + 3, fontsize, "Loser X", 90); BracketSheetUtil.drawString(cb, bf, x + height5th, y + round2length + 3, fontsize, "Loser Y", 90); x += (height5th / 2); y = y - round2length; BracketSheetUtil.drawVerticalLine(cb, x, y, finalLength, 2, 0); if (b != null) { wa = b.getWinner(); if (wa != null) { BracketSheetUtil.drawStringAligned(cb, bf, PdfContentByte.ALIGN_RIGHT, x - 3, y + finalLength - 12, 12, wa.getLastName(), 90); } } x += 15; // padding below the line mid = y + (finalLength / 2); fontsize = 10; BracketSheetUtil.drawStringCentered(cb, bf, x, mid, fontsize, "5th Place", 90); } } return true; }
From source file:com.innoviu.signature.Signature.java
public static void main(String[] args) { boolean isEncrypted = false; boolean isFailed = false; try {/*from ww w . ja va2 s.c o m*/ if (args.length < 2) { throw new FileNotFoundException(); } PdfReader reader = new PdfReader(args[0]); isEncrypted = reader.isEncrypted(); String suffix = ".pdf"; if (isEncrypted) { System.out.println("Encrypted"); String[] cmd = { "pdftk", args[0], "output", args[0] + ".pdftk.pdf" }; try { Process proc = Runtime.getRuntime().exec(cmd); proc.waitFor(); } catch (Exception e) { System.out.println("Exception is:" + e); } reader = new PdfReader(args[0] + ".pdftk.pdf"); suffix = ".dec.pdf"; } PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(args[0] + suffix)); PdfContentByte over = stamper.getOverContent(1); String type = args[2]; int xpos = 0; //int xpos = (type == "in") ? 120 : 10; if ("in".equals(type)) { xpos = 0; } else { xpos = 120; } over.setColorFill(BaseColor.WHITE); over.rectangle(xpos + 10, 8, 120, 8); over.fill(); over.beginText(); BaseFont bf_times = BaseFont.createFont(BaseFont.TIMES_ROMAN, "Cp1252", false); over.setFontAndSize(bf_times, 6); over.setColorFill(BaseColor.BLACK); over.showTextAligned(PdfContentByte.ALIGN_RIGHT, args[1], 120 + xpos, 10, 0); over.endText(); stamper.close(); if (isEncrypted) { File file = new File(args[0] + ".pdftk.pdf"); file.delete(); } } catch (FileNotFoundException e) { isFailed = true; e.printStackTrace(); } catch (DocumentException e) { isFailed = true; e.printStackTrace(); } catch (IOException e) { isFailed = true; e.printStackTrace(); } finally { if (isEncrypted) { maintain(args[0]); } else if (isFailed) { fail(args[0]); } else { } } }