This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected void agregarDato(Cell celda, Object dato) { | |
| if (dato instanceof BigDecimal) { | |
| BigDecimal d = (BigDecimal) dato; | |
| celda.setCellValue(d.doubleValue()); | |
| } | |
| if (dato instanceof Integer) { | |
| Integer i = (Integer) dato; | |
| celda.setCellValue(i); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected void crearEncabezado(Row fila, Class claseDatos) { | |
| Field[] campos = claseDatos.getDeclaredFields(); | |
| int numCelda = 0; | |
| for (Field campo : campos) { | |
| ColumnaReporte columna = campo.getAnnotation(ColumnaReporte.class); | |
| if (columna != null) { | |
| Cell celda = fila.createCell(numCelda); | |
| celda.setCellValue(columna.nombreColumna()); | |
| numCelda++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package mx.ticom.autoreporte.anotaciones; | |
| import java.lang.annotation.ElementType; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.RetentionPolicy; | |
| import java.lang.annotation.Target; | |
| @Retention(RetentionPolicy.RUNTIME) | |
| @Target(ElementType.FIELD) | |
| public @interface ColumnaReporte { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hash.databaseio.fuentesitext; | |
| import com.itextpdf.io.font.FontProgram; | |
| import com.itextpdf.io.font.FontProgramFactory; | |
| import com.itextpdf.io.font.PdfEncodings; | |
| import com.itextpdf.io.font.constants.StandardFonts; | |
| import com.itextpdf.kernel.font.PdfFont; | |
| import com.itextpdf.kernel.font.PdfFontFactory; | |
| import com.itextpdf.kernel.pdf.PdfDocument; | |
| import com.itextpdf.kernel.pdf.PdfWriter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hash.databaseio.doclistener; | |
| import javax.swing.JOptionPane; | |
| import javax.swing.JPasswordField; | |
| import javax.swing.SwingUtilities; | |
| import javax.swing.event.DocumentEvent; | |
| import javax.swing.event.DocumentListener; | |
| /** | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hash.databaseio.doclistener; | |
| import java.awt.GridBagConstraints; | |
| import java.awt.GridBagLayout; | |
| import javax.swing.JLabel; | |
| import javax.swing.JPanel; | |
| import javax.swing.JPasswordField; | |
| /** | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hash.databaseio.doclistener; | |
| import java.awt.EventQueue; | |
| import javax.swing.JFrame; | |
| import javax.swing.UIManager; | |
| import javax.swing.UnsupportedLookAndFeelException; | |
| public class App { | |
| public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void callMethod(Object objeto, String nombreMetodo) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { | |
| Method metodo = objeto.getClass().getMethod(nombreMetodo); | |
| metodo.invoke(objeto); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void callSetter(Object objeto, String nombreCampo, Object valor) throws IntrospectionException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { | |
| PropertyDescriptor descriptor; | |
| descriptor = new PropertyDescriptor(nombreCampo, objeto.getClass()); | |
| descriptor.getWriteMethod().invoke(objeto, valor); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Object callGetter(Object obj, String fieldName) throws IntrospectionException, llegalAccessException, IllegalArgumentException, InvocationTargetException { | |
| PropertyDescriptor pd; | |
| pd = new PropertyDescriptor(fieldName, obj.getClass()); | |
| return pd.getReadMethod().invoke(obj); | |
| } |