List of usage examples for com.itextpdf.text Rectangle BOTTOM
int BOTTOM
To view the source code for com.itextpdf.text Rectangle BOTTOM.
Click Source Link
Rectangle
. From source file:Servicios.SmLogistics.java
private void b_inventario_formatoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_inventario_formatoActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma);/*w w w .jav a2 s . co m*/ Session session = HibernateUtil.getSessionFactory().openSession(); try { BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); Orden ord = (Orden) session.get(Orden.class, orden_act.getIdOrden()); session.beginTransaction().begin(); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); PDF reporte = new PDF(); Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); File folder = new File("reportes/" + ord.getIdOrden()); folder.mkdirs(); reporte.Abrir2(PageSize.LETTER, "Inventario de Tractocamin", "reportes/" + ord.getIdOrden() + "/" + valor + "-invTRacto.pdf"); reporte.agregaObjeto(reporte.crearImagen("imagenes/empresa300115.jpg", 00, -32, 17)); reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); reporte.contenido.roundRectangle(30, 710, 550, 60, 5); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, con.getEmpresa(), 305, 755, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "HOLAJATERIA Y PINTURA EN GENERAL", 305, 743, 0); reporte.texto("FECHA: " + ord.getFecha().toString(), bf, BaseColor.BLACK, 7, 495, 743); reporte.contenido.rectangle(527, 742, 50, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "COMPRA Y VENTA DE REFACCIONES", 305, 733, 0); reporte.texto("SEGURO: ", bf, BaseColor.BLACK, 8, 487, 733); reporte.contenido.rectangle(527, 732, 50, 0); reporte.texto("OT: " + ord.getIdOrden(), bf, BaseColor.BLACK, 8, 511, 723); reporte.contenido.rectangle(527, 722, 50, 0); String cliente = ord.getClientes().getNombre(); if (cliente.length() > 58) cliente = cliente.substring(0, 58); reporte.texto("ASEGURADO: " + cliente, bf, BaseColor.BLACK, 7, 135, 723); reporte.contenido.rectangle(190, 722, 288, 0); if (ord.getNoSerie() != null) reporte.texto("SERIE: " + ord.getNoSerie(), bf, BaseColor.BLACK, 7, 38, 713); else reporte.texto("SERIE: ", bf, BaseColor.BLACK, 7, 38, 713); reporte.contenido.rectangle(65, 712, 72, 0); reporte.texto("MARCA: " + ord.getMarca().getMarcaNombre(), bf, BaseColor.BLACK, 7, 145, 713); reporte.contenido.rectangle(177, 712, 145, 0); reporte.texto("TIPO: " + ord.getTipo().getTipoNombre(), bf, BaseColor.BLACK, 7, 330, 713); reporte.contenido.rectangle(352, 712, 125, 0); if (ord.getModelo() != null) reporte.texto("MODELO: " + ord.getModelo(), bf, BaseColor.BLACK, 7, 488, 713); else reporte.texto("MODELO: ", bf, BaseColor.BLACK, 7, 488, 713); reporte.finTexto(); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); float tam[] = new float[] { 350, 50, 50, 200, 350, 50, 50, 200 }; Font font = new Font(Font.FontFamily.HELVETICA, 7, Font.BOLD); PdfPTable tabla = reporte.crearTabla(8, tam, 100, Element.ALIGN_LEFT); BaseColor cabecera = BaseColor.GRAY; BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; tabla.addCell(reporte.celda("INVENTARIO DE UNIDADES", font, BaseColor.LIGHT_GRAY, centro, 8, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("DESCRIPCIN", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("SI", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("NO", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("OBSERVACIONES", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("DESCRIPCIN", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("SI", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("NO", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("OBSERVACIONES", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); //agregamos los renglones String descripcion[][] = { { "I SECCIN FRENTE", "EXTINGUIDOR" }, { "DEFENSA O ALMA", "LUZ INTERIOR" }, { "CUBIERTAS DEFENSA", "PALANCA VELOCIDADES" }, { "COFRE", "SELECTOR VELOCIDADES" }, { "BISAGRA COFRE", "VESTIDURA" }, { "SALPICADERAS", "III DORMITORIO EXT." }, { "BISELES", "TOLDO" }, { "FAROS", "DEFLECTOR TOLDO" }, { "DIRECCIONALES", "CONCHA LATERALES" }, { "MOLDURAS", "LIENZO COSTADO" }, { "PARRILLA", "PUERTA COST. SUP." }, { "EMBLEMAS", "PUERTA COST. INF." }, { "EXT. SALPICADERA", "MANIJA CHAPA" }, { "II CABINA EXT.", "PASAMANOS" }, { "ZEPPELIN", "DEFLECTOR LATERAL" }, { "CORNETA AIRE ELECT.", "LIENZO TRASERO" }, { "PARABRISAS Y HULE", "INTERIOR" }, { "BRAZOS Y PLUMAS IMP.", "CORTINA" }, { "DEFLECTOR TOLDO", "COLCHN" }, { "ESPEJO LATERAL", "CALEFACCIN" }, { "PUERTAS", "LUZ INTERIOR" }, { "CRISTAL PUERTA", "VESTIDURA" }, { "MANIJA", "GATO Y HERRAMIENTA" }, { "PASAMANOS", "LLAVE DE RUEDAS" }, { "DEFLECTOR LATERAL", "SEALES EMERGENCIA" }, { "CRISTAL MEDALLN", "IV ACCCESORIOS Y MOTOR" }, { "INTERIOR", "CAJA BATERIA Y TAPA" }, { "TOLDO", "ACUMULADOR" }, { "CONSOLA TOLDO", "TANQUES COMBUSTIBLE" }, { "CONSOLA TABLERO", "ESTRIBOS TANQUES" }, { "APARATOS TABLERO", "FALDONES TANQUES" }, { "RELOJ", "TANQUES AIRE" }, { "CONTROLES TABLERO", "PUNTA ESCAPE" }, { "GUANTERA", "MALLA SILENCIADOR" }, { "CENICERO", "SILENCIADOR" }, { "ENCENDEDOR", "QUINTA RUEDA" }, { "C.B.", "EJE DEL." }, { "RADIO ESTREO", "MUELLES DEL." }, { "BOCINAS", "BRAZOS DE DIRECCIN" }, { "VOLANTE", "CAJA DE DIRECCIN" }, { "PALANCA DIRECCIONALES", "CONDENSADOR" }, { "ASIENTOS", "ENFRIADOR DE AIRE" }, { "CINTURONES SEGURIDAD", "POST ENFRIADOR" }, { "MANIJAS", "RADIADOR" }, { "TOLVA RADIADOR", "ALTERNADOR" }, { "MANGUERAS", "BANDAS DE MOTOR" }, { "VENTILADOR/FAN CLUTCH", "BAYONETA ACEITE DE MOTOR" }, { "DAMPER", "TURBO" }, { "TAPA DISTRIBUCIN", "DEPSITO AGUA" }, { "POLEA DE MARCAS", "FRENO MOTOR" }, { "BOMBA INYECCIN", "GPS" }, { "TARJETA IAVE", "CARDAN" }, { "COMPUTADORA", "YUGO" }, { "COMPRESOR A/C", "CRUCETA" }, { "COMPRESOR AIRE", "INTERDIFERENCIALES" }, { "BOMBA DIRECCIN HID.", "DIFERENCIAL(1)(2)" }, { "DEPSITO DIRECCIN HID.", "FLECHA DIFERENCIALES" }, { "BAYONETA ACEITE HID.", "SUSPENSIN TRASERA" }, { "PURIFICADOR", "C?MARAS DE AIRE" }, { "MONO BLOCK", "TOMA DE FUERZA VOLTEO" }, { "CARTER", "TANQUE ACEITE HID. VOLTEO" }, { "CONCHA MOTOR", "SOPORTE SILENCIADOR" }, { "MARCHA", "ENGOMADOS" }, { "CLUTCH", "PLACA DELANTERA" }, { "CAMPANA TRANSMISIN", "PLACA TRASERA" }, { "TRANSMISIN", "KILOMETRAJE" }, { "BOMBA DE AGUA", "LODERAS INTERNAS" }, { "BOMBA DE ACEITE", "LODERAS TRASERAS" }, }; for (int i = 0; i < 68; i++) { tabla.addCell( reporte.celda(descripcion[i][0], font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell( reporte.celda(descripcion[i][1], font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); } tabla.addCell(reporte.celda(" ", font, contenido, centro, 0, 1, Rectangle.NO_BORDER)); tabla.addCell(reporte.celda(" ", font, contenido, centro, 7, 1, Rectangle.BOTTOM)); tabla.addCell(reporte.celda("herramientas:", font, contenido, derecha, 0, 1, Rectangle.NO_BORDER)); tabla.addCell(reporte.celda(" ", font, contenido, centro, 7, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(" ", font, contenido, derecha, 0, 1, Rectangle.NO_BORDER)); tabla.addCell(reporte.celda(" ", font, contenido, centro, 7, 1, Rectangle.RECTANGLE)); reporte.agregaObjeto(tabla); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); //reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, con.getEmpresa(), 305, 755, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.rectangle(527, 712, 50, 0); reporte.contenido.roundRectangle(30, 440, 550, 150, 5); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "COMBUSTIBLE", 530, 520, 270);//445 reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "LLANTAS", 200, 575, 0);//400 reporte.contenido.rectangle(70, 30, 215, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "NOMBRE Y FIRMA DEL CLIENTE", 185, 20, 0); reporte.contenido.rectangle(320, 30, 215, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_CENTER, "OPERADOR DE GRUA", 430, 20, 0); reporte.finTexto(); //*****agregamos los tanques de combustible reporte.agregaObjeto(reporte.crearImagen("imagenes/nivel.jpg", 350, -145, 25)); reporte.agregaObjeto(reporte.crearImagen("imagenes/llantas.jpg", -125, -145, 65)); reporte.cerrar(); reporte.visualizar2("reportes/" + ord.getIdOrden() + "/" + valor + "-invTRacto.pdf"); } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto"); } if (session != null) if (session.isOpen()) session.close(); }
From source file:Valuacion.valuacion.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: //h=new Herramientas(user, 0); //h.session(sessionPrograma); Session session = HibernateUtil.getSessionFactory().openSession(); try {/*w w w. j av a 2 s . c o m*/ DecimalFormat formatoPorcentaje = new DecimalFormat("#,##0.00"); DecimalFormat formatoDecimal = new DecimalFormat("####0.0"); formatoPorcentaje.setMinimumFractionDigits(2); session.beginTransaction().begin(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); //Orden ord=buscaApertura(); PDF reporte = new PDF(); Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); File folder = new File("reportes/" + ord.getIdOrden()); folder.mkdirs(); reporte.Abrir(PageSize.LETTER, "Valuacin", "reportes/" + ord.getIdOrden() + "/" + valor + "-valuacion.pdf"); Font font = new Font(Font.FontFamily.HELVETICA, 7, Font.NORMAL); BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; float tam[] = new float[] { 15, 15, 60, 140, 14, 14, 14, 14, 14, 14, 25 }; PdfPTable tabla = reporte.crearTabla(11, tam, 100, Element.ALIGN_LEFT); cabecera(reporte, bf, tabla); int ren = 0; double dm = 0d, cam = 0d, min = 0d, med = 0d, max = 0d, pin = 0d, tot = 0d; for (int i = 0; i < t_datos.getRowCount(); i++) { if (t_datos.getValueAt(i, 38).toString().compareTo("e") != 0) { double suma = 0d; double v = 0.0d; tabla.addCell(reporte.celda("" + t_datos.getValueAt(i, 10).toString(), font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(t_datos.getValueAt(i, 11).toString(), font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(t_datos.getValueAt(i, 2).toString(), font, contenido, izquierda, 0, 0, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(t_datos.getValueAt(i, 3).toString(), font, contenido, izquierda, 0, 0, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 4) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 4).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 4).toString()); dm += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 8) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 8).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 8).toString()); cam += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 5) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 5).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 5).toString()); min += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 6) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 6).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 6).toString()); med += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 7) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 7).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 7).toString()); max += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getValueAt(i, 9) != null) { v = Double.parseDouble(t_datos.getValueAt(i, 9).toString()) * Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell( reporte.celda(new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).toString(), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma += Double.parseDouble(t_datos.getValueAt(i, 9).toString()); pin += v; } else tabla.addCell(reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); suma *= ord.getCompania().getImporteHora(); suma *= Double.parseDouble(t_datos.getValueAt(i, 10).toString()); tabla.addCell(reporte.celda(formatoPorcentaje.format(suma), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tot += suma; /*if(ren==38) { reporte.agregaObjeto(tabla); reporte.writer.newPage(); tabla=reporte.crearTabla(11, tam, 100, Element.ALIGN_LEFT); cabecera(reporte, bf, tabla); ren=-1; } ren++;*/ } } Double tot_horas = dm + cam + min + med + max + pin; tabla.addCell(reporte.celda( "Costo M.O:$" + formatoPorcentaje.format(ord.getCompania().getImporteHora()) + " Total de Horas:" + formatoDecimal.format(tot_horas), font, contenido, derecha, 4, 1, Rectangle.RIGHT)); tabla.addCell(reporte.celda("" + formatoDecimal.format(dm), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("" + formatoDecimal.format(cam), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("" + formatoDecimal.format(min), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("" + formatoDecimal.format(med), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("" + formatoDecimal.format(max), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("" + formatoDecimal.format(pin), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(formatoPorcentaje.format(tot), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(" ", font, contenido, izquierda, 4, 1, Rectangle.NO_BORDER)); tabla.addCell(reporte.celda(" ", font, contenido, izquierda, 7, 1, Rectangle.TOP)); tabla.setHeaderRows(2); PdfPTable tabla1 = reporte.crearTabla(11, tam, 100, Element.ALIGN_LEFT); tabla1.addCell(reporte.celda("OBSERVACIONES", font, contenido, izquierda, 11, 1, Rectangle.NO_BORDER)); tabla1.addCell(reporte.celda(" ", font, contenido, izquierda, 11, 1, Rectangle.BOTTOM)); tabla1.addCell(reporte.celda(" ", font, contenido, izquierda, 11, 1, Rectangle.BOTTOM)); tabla1.addCell(reporte.celda(" ", font, contenido, izquierda, 11, 1, Rectangle.BOTTOM)); tabla1.addCell(reporte.celda(" ", font, contenido, izquierda, 11, 1, Rectangle.BOTTOM)); reporte.agregaObjeto(tabla); reporte.agregaObjeto(tabla1); reporte.cerrar(); reporte.visualizar("reportes/" + ord.getIdOrden() + "/" + valor + "-valuacion.pdf"); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto."); } if (session != null) if (session.isOpen()) { session.flush(); session.clear(); session.close(); } }
From source file:WeeklyReport.Sections.Commodities.java
public PdfPTable byCommodityTable() { PdfPTable table = new PdfPTable(2); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);/*from ww w . j ava 2 s .com*/ table.setSpacingBefore(10f); cell = new PdfPCell(new Phrase("Quotes by Commodity", SUBHEADING_FONT)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); cell.setPaddingBottom(10f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); Map<String, String> m = new CargoTypeData().quotesByCommodity(); m.entrySet().stream().forEach((entry) -> { cell = new PdfPCell(new Phrase(entry.getKey(), TEXT_FONT)); cell.setColspan(1); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); cell = new PdfPCell(new Phrase(entry.getValue(), TEXT_FONT)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); }); return table; }
From source file:WeeklyReport.Sections.Declines.java
public PdfPTable declinesByCommodityTable() { PdfPTable table = new PdfPTable(2); cell = new PdfPCell(new Phrase("Commodities Declined by Cubic Meter & Trade Lane", SUBHEADING_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3);/* www .java2 s. c o m*/ cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Commodity", COLUMN_HEADER)); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Trade Lane")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Cubic Meters")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); Map<Double, Map<String, String>> mp = DECLINES_BY_COMMODITY_CLASS; mp.entrySet().stream().forEach((mapEntry) -> { Map<String, String> mp1 = mapEntry.getValue(); mp1.entrySet().stream().forEach((secondMapEntry) -> { cell = new PdfPCell(new Phrase(String.valueOf(secondMapEntry.getValue()), TEXT_FONT)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(String.valueOf(secondMapEntry.getValue()), TEXT_FONT)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(String.valueOf(mapEntry.getKey()), TEXT_FONT)); cell.setBorder(Rectangle.TOP); table.addCell(cell); }); }); return table; }
From source file:WeeklyReport.Sections.RegionalQuoteData.java
public PdfPTable regionalAnalysis() { PdfPTable table = new PdfPTable(1); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);//from w w w .j a va 2 s . c om table.setSpacingBefore(10f); cell = new PdfPCell(new Phrase("Regional Quote Data", SECTION_HEADING)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); cell.setPaddingBottom(10f); table.addCell(cell); String pending = null; if (PENDING_RESPONSE == 1) { pending = PENDING_RESPONSE + " is pending further action."; } else { pending = PENDING_RESPONSE + " are pending further action."; } cell = new PdfPCell(new Phrase("In week " + new ReportingDates().reportPeriod() + " a total of " + new CustomerQuoteData().totalNAQuotes() + " quotes were generated through RQS to North American customers (not including Canada). Of these quotes there were " + DECLINES + " declines, " + BOOKINGS + " bookings, and " + FEEDBACK + " received customer feedback, and " + pending, TEXT_FONT)); cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); return table; }
From source file:WeeklyReport.Sections.RegionalQuoteData.java
public PdfPTable southeastTable() { PdfPTable table = new PdfPTable(4); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);//from w w w .j a v a 2s . c om cell = new PdfPCell(new Phrase("South East", SUBHEADING_FONT)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(4); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); cell = new PdfPCell(new Phrase("Company Name", COLUMN_HEADER)); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Trade Lane", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Unit Count", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Cubic Meters", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); Map<Map<String, String>, Map<String, String>> m = SOUTH_EAST_QUOTES; m.entrySet().stream().map((entry) -> { Map<String, String> m1 = entry.getKey(); m1.entrySet().stream().map((pair) -> { companyCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); return pair; }).forEach((pair) -> { tradeCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); }); return entry; }).map((entry) -> { companyCell.setColspan(1); tradeCell.setColspan(1); return entry; }).map((entry) -> { companyCell.setBorder(Rectangle.BOTTOM); tradeCell.setBorder(Rectangle.BOTTOM); return entry; }).map((entry) -> { table.addCell(companyCell); table.addCell(tradeCell); Map<String, String> m1 = entry.getValue(); m1.entrySet().stream().map((pair) -> { unitCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); return pair; }).forEach((pair) -> { cubicMetersCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); }); return entry; }).map((_item) -> { unitCell.setColspan(1); cubicMetersCell.setColspan(1); return _item; }).map((_item) -> { unitCell.setHorizontalAlignment(Element.ALIGN_RIGHT); cubicMetersCell.setHorizontalAlignment(Element.ALIGN_RIGHT); return _item; }).map((_item) -> { unitCell.setBorder(Rectangle.BOTTOM); cubicMetersCell.setBorder(Rectangle.BOTTOM); return _item; }).forEach((_item) -> { table.addCell(unitCell); table.addCell(cubicMetersCell); }); return table; }
From source file:WeeklyReport.Sections.RegionalQuoteData.java
public PdfPTable northEastTable() { PdfPTable table = new PdfPTable(4); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);/*from w ww.j av a 2 s. c o m*/ table.setSpacingBefore(10f); cell = new PdfPCell(new Phrase("North East", SUBHEADING_FONT)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(4); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); cell = new PdfPCell(new Phrase("Company Name", COLUMN_HEADER)); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Trade Lane", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Unit Count", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Cubic Meters", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); Map<Map<String, String>, Map<String, String>> m = NORTH_EAST_QUOTES; m.entrySet().stream().map((entry) -> { Map<String, String> m1 = entry.getKey(); m1.entrySet().stream().map((pair) -> { companyCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); return pair; }).forEach((pair) -> { tradeCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); }); return entry; }).map((entry) -> { companyCell.setColspan(1); tradeCell.setColspan(1); return entry; }).map((entry) -> { companyCell.setBorder(Rectangle.BOTTOM); tradeCell.setBorder(Rectangle.BOTTOM); return entry; }).map((entry) -> { table.addCell(companyCell); table.addCell(tradeCell); Map<String, String> m1 = entry.getValue(); m1.entrySet().stream().map((pair) -> { unitCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); return pair; }).forEach((pair) -> { cubicMetersCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); }); return entry; }).map((_item) -> { unitCell.setColspan(1); cubicMetersCell.setColspan(1); return _item; }).map((_item) -> { unitCell.setHorizontalAlignment(Element.ALIGN_RIGHT); cubicMetersCell.setHorizontalAlignment(Element.ALIGN_RIGHT); return _item; }).map((_item) -> { unitCell.setBorder(Rectangle.BOTTOM); cubicMetersCell.setBorder(Rectangle.BOTTOM); return _item; }).forEach((_item) -> { table.addCell(unitCell); table.addCell(cubicMetersCell); }); return table; }
From source file:WeeklyReport.Sections.RegionalQuoteData.java
public PdfPTable midWestTable() { PdfPTable table = new PdfPTable(4); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);//from w w w . j a v a2 s. co m table.setSpacingBefore(10f); cell = new PdfPCell(new Phrase("Mid West", SUBHEADING_FONT)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(4); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); cell = new PdfPCell(new Phrase("Company Name", COLUMN_HEADER)); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Trade Lane", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Unit Count", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Cubic Meters", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); Map<Map<String, String>, Map<String, String>> m = MID_WEST_QUOTES; m.entrySet().stream().map((entry) -> { Map<String, String> m1 = entry.getKey(); m1.entrySet().stream().map((pair) -> { companyCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); return pair; }).forEach((pair) -> { tradeCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); }); return entry; }).map((entry) -> { companyCell.setColspan(1); tradeCell.setColspan(1); return entry; }).map((entry) -> { companyCell.setBorder(Rectangle.BOTTOM); tradeCell.setBorder(Rectangle.BOTTOM); return entry; }).map((entry) -> { table.addCell(companyCell); table.addCell(tradeCell); Map<String, String> m1 = entry.getValue(); m1.entrySet().stream().map((pair) -> { unitCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); return pair; }).forEach((pair) -> { cubicMetersCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); }); return entry; }).map((_item) -> { unitCell.setColspan(1); cubicMetersCell.setColspan(1); return _item; }).map((_item) -> { unitCell.setHorizontalAlignment(Element.ALIGN_RIGHT); cubicMetersCell.setHorizontalAlignment(Element.ALIGN_RIGHT); return _item; }).map((_item) -> { unitCell.setBorder(Rectangle.BOTTOM); cubicMetersCell.setBorder(Rectangle.BOTTOM); return _item; }).forEach((_item) -> { table.addCell(unitCell); table.addCell(cubicMetersCell); }); return table; }
From source file:WeeklyReport.Sections.RegionalQuoteData.java
public PdfPTable westCoastTable() { PdfPTable table = new PdfPTable(4); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);//w ww .j a va 2 s . c o m table.setSpacingBefore(10f); cell = new PdfPCell(new Phrase("West Coast", SUBHEADING_FONT)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(4); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); cell = new PdfPCell(new Phrase("Company Name", COLUMN_HEADER)); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Trade Lane", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Unit Count", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); cell = new PdfPCell(new Phrase("Cubic Meters", COLUMN_HEADER)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5f); cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidthBottom(2f); table.addCell(cell); Map<Map<String, String>, Map<String, String>> m = WEST_COAST_QUOTES; m.entrySet().stream().map((entry) -> { Map<String, String> m1 = entry.getKey(); m1.entrySet().stream().map((pair) -> { companyCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); return pair; }).forEach((pair) -> { tradeCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); }); return entry; }).map((entry) -> { companyCell.setColspan(1); tradeCell.setColspan(1); return entry; }).map((entry) -> { companyCell.setBorder(Rectangle.BOTTOM); tradeCell.setBorder(Rectangle.BOTTOM); return entry; }).map((entry) -> { table.addCell(companyCell); table.addCell(tradeCell); Map<String, String> m1 = entry.getValue(); m1.entrySet().stream().map((pair) -> { unitCell = new PdfPCell(new Phrase(String.valueOf(pair.getKey()), TEXT_FONT)); return pair; }).forEach((pair) -> { cubicMetersCell = new PdfPCell(new Phrase(String.valueOf(pair.getValue()), TEXT_FONT)); }); return entry; }).map((_item) -> { unitCell.setColspan(1); cubicMetersCell.setColspan(1); return _item; }).map((_item) -> { unitCell.setHorizontalAlignment(Element.ALIGN_RIGHT); cubicMetersCell.setHorizontalAlignment(Element.ALIGN_RIGHT); return _item; }).map((_item) -> { unitCell.setBorder(Rectangle.BOTTOM); cubicMetersCell.setBorder(Rectangle.BOTTOM); return _item; }).forEach((_item) -> { table.addCell(unitCell); table.addCell(cubicMetersCell); }); return table; }
From source file:WeeklyReport.WeeklyPDF.java
public static PdfPTable header() { PdfPTable table = new PdfPTable(1); table.setHorizontalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100f);//from ww w. j a v a 2s .c om cell = new PdfPCell(new Phrase("RQS Report", HEADING_FONT)); cell.setColspan(1); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); cell = new PdfPCell(new Phrase("Week: " + new ReportingDates().reportPeriod(), SUBHEADING_FONT)); cell.setColspan(1); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); return table; }