/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); radioDBv2PUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("radioDBv2PU") .createEntityManager(); musicGroupQuery = java.beans.Beans.isDesignTime() ? null : radioDBv2PUEntityManager.createQuery("SELECT m FROM MusicGroup m"); musicGroupList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( musicGroupQuery.getResultList()); jScrollPane1 = new javax.swing.JScrollPane(); BandsTable = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel(); deleteBand = new javax.swing.JButton(); addBand = new javax.swing.JButton(); editBand = new javax.swing.JButton(); exit = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Εγγραφή σε Μάθημα"); BandsTable.setColumnSelectionAllowed(true); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, musicGroupList, BandsTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${name}")); columnBinding.setColumnName("Επωνυμία"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${formationDate}")); columnBinding.setColumnName("Ημ/νία δημιουργίας"); columnBinding.setColumnClass(java.util.Date.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane1.setViewportView(BandsTable); BandsTable.getColumnModel() .getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jLabel1.setFont(new java.awt.Font("DejaVu Sans", 0, 18)); // NOI18N jLabel1.setText("Πίνακας Συγκροτημάτων"); deleteBand.setText("Διαγραφή"); deleteBand.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteBandActionPerformed(evt); } }); addBand.setText("Προσθήκη"); addBand.setToolTipText(""); addBand.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addBandActionPerformed(evt); } }); editBand.setText("Επεξεργασία"); editBand.setToolTipText(""); editBand.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editBandActionPerformed(evt); } }); exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit.png"))); // NOI18N exit.setToolTipText("Έξοδος"); exit.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(26, 26, 26) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(158, 158, 158) .addComponent(jLabel1)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(addBand) .addGap(37, 37, 37) .addComponent(deleteBand) .addGap(38, 38, 38) .addComponent(editBand)) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE) .addComponent( exit, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(addBand) .addComponent(editBand) .addComponent(deleteBand)) .addComponent( exit, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(30, Short.MAX_VALUE))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); EntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); Query = java.beans.Beans.isDesignTime() ? null : EntityManager.createQuery("SELECT a FROM Actividad a"); List = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( Query.getResultList()); panel_EditarAct = new javax.swing.JPanel(); lbl_EditarAct = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); lbl_nombre = new javax.swing.JLabel(); tf_nombre = new javax.swing.JTextField(); lbl_codigo = new javax.swing.JLabel(); tf_codigo = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); btn_cancelar = new javax.swing.JButton(); btn_eliminar = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); tf_valor = new javax.swing.JTextField(); lbl_valor = new javax.swing.JLabel(); lbl_filtro = new javax.swing.JLabel(); list_filtros = new javax.swing.JComboBox(); btn_buscar = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); panel_EditarAct.setBackground(new java.awt.Color(0, 153, 255)); panel_EditarAct.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_EditarAct.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_EditarAct.setForeground(new java.awt.Color(255, 255, 255)); lbl_EditarAct.setText("Eliminar Actividad"); javax.swing.GroupLayout panel_EditarActLayout = new javax.swing.GroupLayout(panel_EditarAct); panel_EditarAct.setLayout(panel_EditarActLayout); panel_EditarActLayout.setHorizontalGroup( panel_EditarActLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_EditarActLayout .createSequentialGroup() .addGap(139, 139, 139) .addComponent(lbl_EditarAct) .addContainerGap(141, Short.MAX_VALUE))); panel_EditarActLayout.setVerticalGroup( panel_EditarActLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_EditarActLayout .createSequentialGroup() .addContainerGap() .addComponent(lbl_EditarAct) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbl_nombre.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_nombre.setText("Nombre:"); tf_nombre.setEditable(false); tf_nombre.setBackground(new java.awt.Color(0, 153, 255)); tf_nombre.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_nombre.setForeground(new java.awt.Color(255, 255, 255)); tf_nombre.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tf_nombreActionPerformed(evt); } }); tf_nombre.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { tf_nombreFocusLost(evt); } }); tf_nombre.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_nombreKeyTyped(evt); } }); lbl_codigo.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_codigo.setText("Código:"); tf_codigo.setEditable(false); tf_codigo.setBackground(new java.awt.Color(0, 153, 255)); tf_codigo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_codigo.setForeground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(47, 47, 47) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbl_nombre) .addComponent(lbl_codigo)) .addGap(32, 32, 32) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_codigo) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_nombre) .addComponent( tf_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(24, 24, 24))); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_cancelar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cancelar.setText("Cancelar"); btn_cancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelarActionPerformed(evt); } }); btn_eliminar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/trash.png"))); // NOI18N btn_eliminar.setText("Eliminar"); btn_eliminar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_eliminarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addGap(23, 23, 23) .addComponent(btn_eliminar) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE) .addComponent(btn_cancelar) .addGap(19, 19, 19))); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent(btn_cancelar) .addGap(0, 0, Short.MAX_VALUE)) .addComponent( btn_eliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel3.setBackground(new java.awt.Color(204, 204, 204)); jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel3.setForeground(new java.awt.Color(204, 204, 255)); tf_valor.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_valorKeyTyped(evt); } }); lbl_valor.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_valor.setText("Valor:"); lbl_filtro.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_filtro.setText("Buscar por:"); list_filtros.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"Código", "Descripción"})); list_filtros.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { list_filtrosActionPerformed(evt); } }); list_filtros.addFocusListener( new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { list_filtrosFocusGained(evt); } }); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_buscarActionPerformed(evt); } }); btn_buscar.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { btn_buscarFocusLost(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addComponent(lbl_filtro) .addGap(18, 18, 18) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26) .addComponent(lbl_valor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btn_buscar) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_filtro) .addComponent(lbl_valor) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_buscar)) .addContainerGap())); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, List, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codActividad}")); columnBinding.setColumnName("Actividad"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nombre}")); columnBinding.setColumnName("Nombre"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTable.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { masterTableMouseClicked(evt); } }); jScrollPane1.setViewportView(masterTable); if (masterTable.getColumnModel().getColumnCount() > 0) { masterTable.getColumnModel().getColumn(0).setPreferredWidth(15); } javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(37, 37, 37) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 519, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( panel_EditarAct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup( layout .createSequentialGroup() .addGap(148, 148, 148) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 39, Short.MAX_VALUE)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1)) .addGap(71, 71, 71))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( panel_EditarAct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(23, Short.MAX_VALUE))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(javaproject.Main.class) .getContext() .getResourceMap(DivisionData.class); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory( resourceMap.getString("entityManager.persistenceUnit")) .createEntityManager(); // NOI18N query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("query.query")); // NOI18N list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); stationNumberLabel = new javax.swing.JLabel(); address1Label = new javax.swing.JLabel(); address2Label = new javax.swing.JLabel(); telephoneLabel = new javax.swing.JLabel(); stationNameLabel = new javax.swing.JLabel(); stationNumberField = new javax.swing.JTextField(); address1Field = new javax.swing.JTextField(); address2Field = new javax.swing.JTextField(); telephoneField = new javax.swing.JTextField(); stationNameField = new javax.swing.JTextField(); saveButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); newButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); FormListener formListener = new FormListener(); setName("Form"); // NOI18N masterScrollPane.setName("masterScrollPane"); // NOI18N masterTable.setName("masterTable"); // NOI18N org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${stationNumber}")); columnBinding.setColumnName("Station Number"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${address1}")); columnBinding.setColumnName("Address1"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${address2}")); columnBinding.setColumnName("Address2"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${telephone}")); columnBinding.setColumnName("Telephone"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${stationName}")); columnBinding.setColumnName("Station Name"); columnBinding.setColumnClass(String.class); bindingGroup.addBinding(jTableBinding); masterScrollPane.setViewportView(masterTable); stationNumberLabel.setText(resourceMap.getString("stationNumberLabel.text")); // NOI18N stationNumberLabel.setName("stationNumberLabel"); // NOI18N address1Label.setText(resourceMap.getString("address1Label.text")); // NOI18N address1Label.setName("address1Label"); // NOI18N address2Label.setText(resourceMap.getString("address2Label.text")); // NOI18N address2Label.setName("address2Label"); // NOI18N telephoneLabel.setText(resourceMap.getString("telephoneLabel.text")); // NOI18N telephoneLabel.setName("telephoneLabel"); // NOI18N stationNameLabel.setText(resourceMap.getString("stationNameLabel.text")); // NOI18N stationNameLabel.setName("stationNameLabel"); // NOI18N stationNumberField.setName("stationNumberField"); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.stationNumber}"), stationNumberField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), stationNumberField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); address1Field.setName("address1Field"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.address1}"), address1Field, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), address1Field, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); address2Field.setName("address2Field"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.address2}"), address2Field, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), address2Field, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); telephoneField.setName("telephoneField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.telephone}"), telephoneField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), telephoneField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); stationNameField.setName("stationNameField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.stationName}"), stationNameField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), stationNameField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N saveButton.setName("saveButton"); // NOI18N saveButton.addActionListener(formListener); refreshButton.setText(resourceMap.getString("refreshButton.text")); // NOI18N refreshButton.setName("refreshButton"); // NOI18N refreshButton.addActionListener(formListener); newButton.setText(resourceMap.getString("newButton.text")); // NOI18N newButton.setName("newButton"); // NOI18N newButton.addActionListener(formListener); deleteButton.setText(resourceMap.getString("deleteButton.text")); // NOI18N deleteButton.setName("deleteButton"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), deleteButton, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); deleteButton.addActionListener(formListener); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addComponent(newButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveButton) .addContainerGap()) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(stationNumberLabel) .addComponent(address1Label) .addComponent(address2Label) .addComponent(telephoneLabel) .addComponent(stationNameLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( stationNumberField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent( address1Field, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent( address2Field, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent( telephoneField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent( stationNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)) .addContainerGap()) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addContainerGap())); layout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteButton, newButton, refreshButton, saveButton}); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(stationNumberLabel) .addComponent( stationNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(address1Label) .addComponent( address1Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(address2Label) .addComponent( address2Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(telephoneLabel) .addComponent( telephoneField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(stationNameLabel) .addComponent( stationNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(refreshButton) .addComponent(deleteButton) .addComponent(newButton)) .addContainerGap())); bindingGroup.bind(); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory( "com.javaswingmaven_T08_Database_Access_jar_1.0-SNAPSHOTPU") .createEntityManager(); customerQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM Customer c"); customers = ObservableCollections.observableList( java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : customerQuery.getResultList()); jScrollPane1 = new javax.swing.JScrollPane(); customersTbl = new javax.swing.JTable(); addBtn = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, customers, customersTbl); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${customerId}")); columnBinding.setColumnName("Customer Id"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${name}")); columnBinding.setColumnName("Name"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${addressline1}")); columnBinding.setColumnName("Addressline1"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${addressline2}")); columnBinding.setColumnName("Addressline2"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${city}")); columnBinding.setColumnName("City"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${state}")); columnBinding.setColumnName("State"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${phone}")); columnBinding.setColumnName("Phone"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fax}")); columnBinding.setColumnName("Fax"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${email}")); columnBinding.setColumnName("Email"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${creditLimit}")); columnBinding.setColumnName("Credit Limit"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${discountCode}")); columnBinding.setColumnName("Discount Code"); columnBinding.setColumnClass(com.javaswingmaven.models.DiscountCode.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${zip}")); columnBinding.setColumnName("Zip"); columnBinding.setColumnClass(com.javaswingmaven.models.MicroMarket.class); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane1.setViewportView(customersTbl); addBtn.setText("Add"); addBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addBtnActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addGap(180, 180, 180) .addComponent(addBtn) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent( jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(addBtn))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT m FROM MovimientoStock m"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); detalleOrdenCompraQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT d FROM DetalleOrdenCompra d"); detalleOrdenCompraList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : detalleOrdenCompraQuery.getResultList(); empleadoQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT e FROM Empleado e"); empleadoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : empleadoQuery.getResultList(); ordenCompraQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT o FROM OrdenCompra o"); ordenCompraList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : ordenCompraQuery.getResultList(); jPanel3 = new javax.swing.JPanel(); lbl_registrarC = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); lbl_nombre = new javax.swing.JLabel(); cantidadMinimaLabel = new javax.swing.JLabel(); tf_articulo = new javax.swing.JTextField(); tf_cantidad = new javax.swing.JTextField(); cantidadMinimaLabel1 = new javax.swing.JLabel(); tf_fecha = new javax.swing.JTextField(); lbl_nombre1 = new javax.swing.JLabel(); tf_codigo = new javax.swing.JTextField(); jPanel6 = new javax.swing.JPanel(); btn_cancelar3 = new javax.swing.JButton(); btn_guardar = new javax.swing.JButton(); btn_modificar = new javax.swing.JButton(); btn_eliminar = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); lbl_valor = new javax.swing.JLabel(); tf_valor = new javax.swing.JTextField(); lbl_filtro = new javax.swing.JLabel(); list_filtros = new javax.swing.JComboBox(); btn_buscar = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); FormListener formListener = new FormListener(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel3.setBackground(new java.awt.Color(0, 153, 255)); jPanel3.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_registrarC.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_registrarC.setForeground(new java.awt.Color(255, 255, 255)); lbl_registrarC.setText("Modificar/Eliminar Extraccion de Articulo:"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addGap(89, 89, 89) .addComponent(lbl_registrarC) .addContainerGap(120, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_registrarC) .addContainerGap())); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbl_nombre.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_nombre.setText("Articulo:"); cantidadMinimaLabel.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N cantidadMinimaLabel.setText("Cantidad:"); tf_articulo.setEnabled(false); tf_cantidad.setEnabled(false); tf_cantidad.addFocusListener(formListener); tf_cantidad.addKeyListener(formListener); cantidadMinimaLabel1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N cantidadMinimaLabel1.setText("Fecha:"); tf_fecha.setEnabled(false); lbl_nombre1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_nombre1.setText("Codigo:"); tf_codigo.setEnabled(false); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbl_nombre) .addComponent(cantidadMinimaLabel) .addComponent(cantidadMinimaLabel1) .addComponent(lbl_nombre1)) .addGap(42, 42, 42) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( tf_articulo, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE) .addComponent( tf_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tf_fecha)) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(13, 13, 13) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_nombre1) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( tf_articulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_nombre, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cantidadMinimaLabel) .addComponent( tf_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cantidadMinimaLabel1) .addComponent( tf_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel6.setBackground(new java.awt.Color(204, 204, 204)); jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_cancelar3.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cancelar3.setText("Cancelar"); btn_cancelar3.addActionListener(formListener); btn_guardar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.png"))); // NOI18N btn_guardar.setText("Guardar"); btn_guardar.setEnabled(false); btn_guardar.addActionListener(formListener); btn_modificar.setText("Modificar"); btn_modificar.setEnabled(false); btn_modificar.addActionListener(formListener); btn_eliminar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/trash.png"))); // NOI18N btn_eliminar.setText("Eliminar"); btn_eliminar.setEnabled(false); btn_eliminar.addActionListener(formListener); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel6Layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_modificar) .addGap(29, 29, 29) .addComponent(btn_guardar) .addGap(28, 28, 28) .addComponent(btn_eliminar) .addGap(33, 33, 33) .addComponent(btn_cancelar3) .addGap(34, 34, 34))); jPanel6Layout.setVerticalGroup( jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel6Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_cancelar3) .addComponent( btn_guardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_modificar) .addComponent( btn_eliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbl_valor.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_valor.setText("Valor:"); tf_valor.addKeyListener(formListener); lbl_filtro.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_filtro.setText("Buscar por:"); list_filtros.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"Código", "Articulo"})); list_filtros.addMouseListener(formListener); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener(formListener); btn_buscar.addFocusListener(formListener); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addGap(36, 36, 36) .addComponent(lbl_filtro) .addGap(18, 18, 18) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_valor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btn_buscar) .addGap(36, 36, 36))); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_filtro) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_valor) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_buscar)) .addContainerGap())); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoMovimiento}")); columnBinding.setColumnName("Codigo Movimiento"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoArticulo.nombre}")); columnBinding.setColumnName("Articulo"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${cantidad}")); columnBinding.setColumnName("Cantidad"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fechaHora}")); columnBinding.setColumnName("Fecha Hora"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTable.addMouseListener(formListener); jScrollPane1.setViewportView(masterTable); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) .addGroup( layout .createSequentialGroup() .addGap(146, 146, 146) .addComponent( jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE) .addComponent( jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(43, 43, 43))); bindingGroup.bind(); pack(); }
/** Initialize ConditionsPanel components */ private void initConditionsPanel() { // set selected matrix dimension to "2D" setupConditionsPanel.getEcmDimensionComboBox().setSelectedIndex(0); setupConditionsPanel.getjTabbedPane1().setEnabled(false); // set current and previous conditions indexes conditionIndex = 0; previousConditionIndex = -1; conditionsPanel.getAddButton().setEnabled(false); // init conditionJList (create new empty list) (conditions are NOT retrieved from DB) plateConditionBindingList = ObservableCollections.observableList(new ArrayList<PlateCondition>()); // autobind cell line // autobind seeding density Binding binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.seedingDensity"), setupConditionsPanel.getSeedingDensityTextField(), BeanProperty.create("text"), "seedingdensitybinding"); bindingGroup.addBinding(binding); // autobind seeding time binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.seedingTime"), setupConditionsPanel.getSeedingTimeTextField(), BeanProperty.create("text"), "seedingtimebinding"); bindingGroup.addBinding(binding); // autobind growth medium binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.growthMedium"), setupConditionsPanel.getGrowthMediumComboBox(), BeanProperty.create("selectedItem"), "growthmediumbinding"); bindingGroup.addBinding(binding); // autobind serum binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.serum"), setupConditionsPanel.getSerumComboBox(), BeanProperty.create("selectedItem"), "celllineserumbinding"); bindingGroup.addBinding(binding); // autobind serum concentration binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.serumConcentration"), setupConditionsPanel.getSerumConcentrationTextField(), BeanProperty.create("text"), "celllineserumconcentrationbinding"); bindingGroup.addBinding(binding); // autobind cell line type binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.cellLine.cellLineType"), setupConditionsPanel.getCellLineComboBox(), BeanProperty.create("selectedItem"), "celllinetypebinding"); bindingGroup.addBinding(binding); // autobind assay medium // autobind medium binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.assayMedium.medium"), treatmentsController.getTreatmentsPanel().getAssayMediumComboBox(), BeanProperty.create("selectedItem"), "assaymediumbinding"); bindingGroup.addBinding(binding); // autobind serum binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.assayMedium.serum"), treatmentsController.getTreatmentsPanel().getSerumComboBox(), BeanProperty.create("selectedItem"), "assayserumbinding"); bindingGroup.addBinding(binding); // autobind serum concentration binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.assayMedium.serumConcentration"), treatmentsController.getTreatmentsPanel().getSerumConcentrationTextField(), BeanProperty.create("text"), "assayserumconcentrationbinding"); bindingGroup.addBinding(binding); // autobind volume binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.assayMedium.volume"), treatmentsController.getTreatmentsPanel().getMediumVolumeTextField(), BeanProperty.create("text"), "assayvolumebinding"); bindingGroup.addBinding(binding); // autobind matrix dimension binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, conditionsPanel.getConditionsJList(), BeanProperty.create("selectedElement.matrixDimension"), setupConditionsPanel.getEcmDimensionComboBox(), BeanProperty.create("selectedItem"), "matrixdimensionbinding"); bindingGroup.addBinding(binding); bindingGroup.bind(); // init conditionListBinding JListBinding conditionListBinding = SwingBindings.createJListBinding( AutoBinding.UpdateStrategy.READ_WRITE, plateConditionBindingList, conditionsPanel.getConditionsJList()); bindingGroup.addBinding(conditionListBinding); bindingGroup.bind(); // create and init the first condition (Condition 1) PlateCondition firstCondition = createFirstCondition(); // add Condition 1 to the list plateConditionBindingList.add(firstCondition); // set cell renderer for conditionJList conditionsPanel.getConditionsJList().setCellRenderer(new ConditionsSetupListRenderer()); /** add mouse listeners */ // if Condition validation is OK, update previous condition and user input fields conditionsPanel .getConditionsJList() .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { conditionsPanel.getAddButton().setEnabled(true); int selectedIndex = conditionsPanel.getConditionsJList().getSelectedIndex(); if (selectedIndex != -1) { // add mouse listener and enable tabbed pane on the right (only once, for // Condition 1) if (selectedIndex == 0) { setupExperimentController.addMouseListener(); setupConditionsPanel.getjTabbedPane1().setEnabled(true); } if (previousConditionIndex < plateConditionBindingList.size() && previousConditionIndex != -1) { // check if validation of condition is OK if (setupExperimentController.validateCondition( plateConditionBindingList.get(previousConditionIndex))) { // update fields of previous condition updateCondition(previousConditionIndex); // update and reset fields for the assay-ecm panel assayEcmController.updateAssayEcmInputFields( plateConditionBindingList.get(selectedIndex)); // assayEcmPanelController.resetAssayEcmInputFields(plateConditionBindingList.get(locationToIndex)); // keep source and destination lists sync: show actual treatment collection treatmentsController.updateLists( plateConditionBindingList.get(selectedIndex)); } } previousConditionIndex = selectedIndex; } } } }); // add an empty list of rectangles for Condition 1 setupExperimentController.onNewConditionAdded(firstCondition); // disable the Remove Button conditionsPanel.getRemoveButton().setEnabled(false); /** add action listeners */ // add a new Condition to the List // each new Condition is init through values selected from the previously created one! conditionsPanel .getAddButton() .addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // create and init a new Condition PlateCondition newCondition = new PlateCondition(); initNewCondition(newCondition); // add the new Condition to the list plateConditionBindingList.add(newCondition); // add a new empty list of rectangles for the just added Condition setupExperimentController.onNewConditionAdded(newCondition); // after a new condition is added enable the remove button if (!conditionsPanel.getRemoveButton().isEnabled()) { conditionsPanel.getRemoveButton().setEnabled(true); } } }); // remove a Condition from the list conditionsPanel .getRemoveButton() .addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (conditionsPanel.getConditionsJList().getSelectedValue() != null) { // empty the list of rectangles for this Condition and reset to null the Condition // of the associated wells setupExperimentController.onConditionToRemove( (PlateCondition) (conditionsPanel.getConditionsJList().getSelectedValue())); // remove the Condition from the list int selectedIndex = conditionsPanel.getConditionsJList().getSelectedIndex(); PlateCondition conditionToRemove = plateConditionBindingList.get(selectedIndex); // if the condition to remove is the last one, decrease previous condition index if (plateConditionBindingList.indexOf(conditionToRemove) == plateConditionBindingList.size() - 1) { previousConditionIndex = plateConditionBindingList.size() - 2; } // remove condition from the list plateConditionBindingList.remove(conditionToRemove); // select first condition after removing conditionsPanel.getConditionsJList().setSelectedIndex(0); // if there's only one condition left, disable again the remove button if (plateConditionBindingList.size() == 1) { conditionsPanel.getRemoveButton().setEnabled(false); } } } }); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); rolQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT r FROM Rol r"); rolList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( rolQuery.getResultList()); usuarioQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT u FROM Usuario u"); usuarioList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( usuarioQuery.getResultList()); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); tf_idEmpleado = new javax.swing.JTextField(); tf_nombreUsuario = new javax.swing.JTextField(); tf_apellidoUsuario = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); btn_guardar = new javax.swing.JButton(); btn_cancelar = new javax.swing.JButton(); panel_editarUsuario = new javax.swing.JPanel(); lbl_editarUsuario = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); masterTableUsuario = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); list_filtros = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); tf_valor = new javax.swing.JTextField(); btn_buscar = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); rolTable = new javax.swing.JTable(); btn_agregarRol = new javax.swing.JButton(); btn_limpiar = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); btn_limpiar1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setResizable(false); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setForeground(new java.awt.Color(204, 204, 255)); jLabel1.setFont(new java.awt.Font("Candara", 0, 16)); // NOI18N jLabel1.setText("Código:"); jLabel3.setFont(new java.awt.Font("Candara", 0, 16)); // NOI18N jLabel3.setText("Nombre:"); tf_idEmpleado.setEnabled(false); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTableUsuario, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.codigoEmpleado}"), tf_idEmpleado, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); tf_nombreUsuario.setEnabled(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTableUsuario, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.empleado.nombre}"), tf_nombreUsuario, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); tf_apellidoUsuario.setEnabled(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTableUsuario, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.empleado.apellido}"), tf_apellidoUsuario, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N jLabel5.setText("Datos del Usuario"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(37, 37, 37) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(10, 10, 10) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( tf_nombreUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_idEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_apellidoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(43, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(8, 8, 8) .addComponent(jLabel5) .addGap(10, 10, 10) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent( tf_idEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent( tf_nombreUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( tf_apellidoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(32, Short.MAX_VALUE))); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_guardar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.png"))); // NOI18N btn_guardar.setText("Modificar"); btn_guardar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_guardarActionPerformed(evt); } }); btn_cancelar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/excluded.png"))); // NOI18N btn_cancelar.setText("Salir"); btn_cancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addGap(25, 25, 25) .addComponent(btn_guardar) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE) .addComponent(btn_cancelar) .addGap(34, 34, 34))); jPanel2Layout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_cancelar, btn_guardar}); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( btn_guardar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( btn_cancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_editarUsuario.setBackground(new java.awt.Color(0, 153, 255)); panel_editarUsuario.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_editarUsuario.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_editarUsuario.setForeground(new java.awt.Color(255, 255, 255)); lbl_editarUsuario.setText("Editar Usuario"); javax.swing.GroupLayout panel_editarUsuarioLayout = new javax.swing.GroupLayout(panel_editarUsuario); panel_editarUsuario.setLayout(panel_editarUsuarioLayout); panel_editarUsuarioLayout.setHorizontalGroup( panel_editarUsuarioLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, panel_editarUsuarioLayout .createSequentialGroup() .addContainerGap(141, Short.MAX_VALUE) .addComponent(lbl_editarUsuario) .addGap(138, 138, 138))); panel_editarUsuarioLayout.setVerticalGroup( panel_editarUsuarioLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_editarUsuarioLayout .createSequentialGroup() .addContainerGap() .addComponent(lbl_editarUsuario) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, usuarioList, masterTableUsuario); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoEmpleado}")); columnBinding.setColumnName("Codigo"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${empleado.nombre}")); columnBinding.setColumnName("Nombre"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${empleado.apellido}")); columnBinding.setColumnName("Apellido"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTableUsuario.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { masterTableUsuarioMouseClicked(evt); } }); jScrollPane2.setViewportView(masterTableUsuario); jPanel3.setBackground(new java.awt.Color(204, 204, 204)); jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel3.setForeground(new java.awt.Color(204, 204, 255)); jLabel2.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N jLabel2.setText("Buscar por:"); list_filtros.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"Código", "Nombre", "Apellido"})); list_filtros.addFocusListener( new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { list_filtrosFocusGained(evt); } }); jLabel4.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N jLabel4.setText("Valor:"); tf_valor.addKeyListener( new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { tf_valorKeyPressed(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { tf_valorKeyTyped(evt); } }); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_buscarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(40, 40, 40) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE) .addComponent(btn_buscar) .addGap(23, 23, 23))); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_buscar)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, rolList, rolTable); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${idRol}")); columnBinding.setColumnName("Código"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nombre}")); columnBinding.setColumnName("Nombre"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); rolTable.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { rolTableMouseClicked(evt); } }); jScrollPane1.setViewportView(rolTable); if (rolTable.getColumnModel().getColumnCount() > 0) { rolTable.getColumnModel().getColumn(0).setMinWidth(60); rolTable.getColumnModel().getColumn(0).setPreferredWidth(60); rolTable.getColumnModel().getColumn(0).setMaxWidth(60); } btn_agregarRol.setText("Mostrar Roles"); btn_agregarRol.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_agregarRolActionPerformed(evt); } }); btn_limpiar.setText("Sacar Todos"); btn_limpiar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_limpiarActionPerformed(evt); } }); jLabel6.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N jLabel6.setText("Roles"); btn_limpiar1.setText("Sacar Rol"); btn_limpiar1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_limpiar1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(20, 20, 20) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_agregarRol) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( btn_limpiar1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( btn_limpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(27, 27, 27) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addGap(138, 138, 138) .addComponent(jLabel6))) .addGap(0, 0, Short.MAX_VALUE))) .addGap(28, 28, 28)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(80, 80, 80) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 519, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup( layout .createSequentialGroup() .addGap(108, 108, 108) .addComponent( panel_editarUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(163, 163, 163))); layout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_agregarRol, btn_limpiar}); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( panel_editarUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup( layout .createSequentialGroup() .addGap(12, 12, 12) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addComponent(jLabel6) .addGap(10, 10, 10) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_agregarRol) .addComponent(btn_limpiar) .addComponent(btn_limpiar1)))) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.linkSize( javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btn_agregarRol, btn_limpiar}); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * Este método é invocado pelo construtor e seu objetivo é inicializar o form. WARNING: Não * modifique este código. O seu conteúdo é automaticamente regerado pelo editor visual do * formulário. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); listTipoContrato = ObservableCollections.observableList(new TipoContratoDao().listAll()); tipoContratoBean = new br.com.etec.model.TipoContrato(); paneltitulo = new javax.swing.JPanel(); lblTitulo = new javax.swing.JLabel(); panelTable = new javax.swing.JPanel(); scrollTable = new javax.swing.JScrollPane(); tbTipoContrato = new javax.swing.JTable(); tbTipoContrato .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (tbTipoContrato.getSelectedRow() != -1) { tipoContratoBean = listTipoContrato.get(tbTipoContrato.getSelectedRow()); btnAlterar.setEnabled(Boolean.TRUE); btnExcluir.setEnabled(Boolean.TRUE); } else { tipoContratoBean = null; btnAlterar.setEnabled(Boolean.FALSE); btnExcluir.setEnabled(Boolean.FALSE); } } }); panelDados = new javax.swing.JPanel(); btnPrimeiro = new javax.swing.JButton(); btnAnterior = new javax.swing.JButton(); btnProximo = new javax.swing.JButton(); btnUltimo = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); lblRecordInfo = new javax.swing.JTextArea(); lblId = new javax.swing.JLabel(); txtId = new javax.swing.JTextField(); lblNome = new javax.swing.JLabel(); btnAlterar = new javax.swing.JButton(); btnSalvar = new javax.swing.JButton(); btnCancelar = new javax.swing.JButton(); txtNome = new javax.swing.JTextField(); btnIncluir = new javax.swing.JButton(); btnExcluir = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); getContentPane().setLayout(new java.awt.GridBagLayout()); paneltitulo.setPreferredSize(new java.awt.Dimension(1198, 40)); paneltitulo.setLayout(new java.awt.GridBagLayout()); lblTitulo.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N lblTitulo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblTitulo.setText("Tipos de Contrato"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(20, 20, 0, 20); paneltitulo.add(lblTitulo, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(10, 20, 10, 20); getContentPane().add(paneltitulo, gridBagConstraints); panelTable.setLayout(new java.awt.GridBagLayout()); tbTipoContrato.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, listTipoContrato, tbTipoContrato); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}")); columnBinding.setColumnName("Id"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nome}")); columnBinding.setColumnName("Nome"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); scrollTable.setViewportView(tbTipoContrato); tbTipoContrato .getColumnModel() .getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); tbTipoContrato.getColumnModel().getColumn(0).setResizable(false); tbTipoContrato.getColumnModel().getColumn(0).setPreferredWidth(50); tbTipoContrato.getColumnModel().getColumn(1).setResizable(false); tbTipoContrato.getColumnModel().getColumn(1).setPreferredWidth(250); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipady = 160; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; panelTable.add(scrollTable, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(10, 20, 10, 20); getContentPane().add(panelTable, gridBagConstraints); panelDados.setLayout(new java.awt.GridBagLayout()); btnPrimeiro.setText("|<<"); btnPrimeiro.setToolTipText("Primeiro Registro"); btnPrimeiro.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrimeiroActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 2; gridBagConstraints.ipadx = 10; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(11, 38, 0, 0); panelDados.add(btnPrimeiro, gridBagConstraints); btnAnterior.setText("<"); btnAnterior.setToolTipText("Registro Anterior"); btnAnterior.setMaximumSize(new java.awt.Dimension(53, 23)); btnAnterior.setMinimumSize(new java.awt.Dimension(53, 23)); btnAnterior.setPreferredSize(new java.awt.Dimension(53, 23)); btnAnterior.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAnteriorActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 7; gridBagConstraints.ipadx = 10; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(11, 6, 0, 0); panelDados.add(btnAnterior, gridBagConstraints); btnProximo.setText(">"); btnProximo.setToolTipText("Próximo Registro"); btnProximo.setMaximumSize(new java.awt.Dimension(53, 23)); btnProximo.setMinimumSize(new java.awt.Dimension(53, 23)); btnProximo.setPreferredSize(new java.awt.Dimension(53, 23)); btnProximo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnProximoActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 13; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 11; gridBagConstraints.ipadx = 10; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(11, 6, 0, 0); panelDados.add(btnProximo, gridBagConstraints); btnUltimo.setText(">>|"); btnUltimo.setToolTipText("Último Registro"); btnUltimo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnUltimoActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 32; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 65; gridBagConstraints.ipadx = 12; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(11, 6, 0, 0); panelDados.add(btnUltimo, gridBagConstraints); lblRecordInfo.setEditable(false); lblRecordInfo.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background")); lblRecordInfo.setColumns(20); lblRecordInfo.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N lblRecordInfo.setLineWrap(true); lblRecordInfo.setRows(2); lblRecordInfo.setDisabledTextColor(new java.awt.Color(0, 0, 0)); lblRecordInfo.setEnabled(false); jScrollPane2.setViewportView(lblRecordInfo); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = 98; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 311; gridBagConstraints.ipady = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 10, 0, 10); panelDados.add(jScrollPane2, gridBagConstraints); lblId.setText("Id:"); lblId.setToolTipText(""); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(13, 77, 0, 0); panelDados.add(lblId, gridBagConstraints); txtId.setDisabledTextColor(new java.awt.Color(0, 0, 0)); txtId.setEnabled(false); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tbTipoContrato, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.id}"), txtId, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 55; gridBagConstraints.gridheight = 2; gridBagConstraints.ipadx = 178; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); panelDados.add(txtId, gridBagConstraints); lblNome.setText("Nome:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(6, 60, 0, 0); panelDados.add(lblNome, gridBagConstraints); btnAlterar.setText("Alterar"); btnAlterar.setActionCommand("ListarCargoView.alterar"); btnAlterar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAlterarActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 10; gridBagConstraints.ipadx = 18; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(16, 10, 0, 0); panelDados.add(btnAlterar, gridBagConstraints); btnSalvar.setText("Salvar"); btnSalvar.setActionCommand("ListarCargoView.salvar"); btnSalvar.setEnabled(false); btnSalvar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSalvarActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 5; gridBagConstraints.ipadx = 10; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(6, 88, 0, 0); panelDados.add(btnSalvar, gridBagConstraints); btnCancelar.setText("Cancelar"); btnCancelar.setActionCommand("ListarCargoView.cancelar"); btnCancelar.setEnabled(false); btnCancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCancelarActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 8; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 25; gridBagConstraints.ipadx = 10; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); panelDados.add(btnCancelar, gridBagConstraints); txtNome.setDisabledTextColor(new java.awt.Color(0, 0, 0)); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tbTipoContrato, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.nome}"), txtNome, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 97; gridBagConstraints.gridheight = 2; gridBagConstraints.ipadx = 243; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 10); panelDados.add(txtNome, gridBagConstraints); btnIncluir.setText("Incluir"); btnIncluir.setActionCommand("incluir"); btnIncluir.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnIncluirActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 3; gridBagConstraints.ipadx = 22; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(16, 38, 0, 0); panelDados.add(btnIncluir, gridBagConstraints); btnExcluir.setText("Excluir"); btnExcluir.setActionCommand("ListarCargoView.excluir"); btnExcluir.setPreferredSize(new java.awt.Dimension(65, 23)); btnExcluir.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnExcluirActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 23; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 64; gridBagConstraints.ipadx = 20; gridBagConstraints.ipady = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(16, 10, 0, 0); panelDados.add(btnExcluir, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(10, 20, 20, 20); getContentPane().add(panelDados, gridBagConstraints); bindingGroup.bind(); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 610) / 2, (screenSize.height - 576) / 2, 610, 576); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT a FROM AuditoriaSistema a"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); jPanel1 = new javax.swing.JPanel(); list_filtros = new javax.swing.JComboBox(); lbl_filtro = new javax.swing.JLabel(); btn_buscar = new javax.swing.JButton(); tf_valor = new javax.swing.JTextField(); lbl_valor = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); panel_auditoria = new javax.swing.JPanel(); lbl_auditoria = new javax.swing.JLabel(); btn_cerrar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Ver Auditoría de Sistema"); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); list_filtros.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Entidad", "Acción", "Usuario", "Fecha"})); list_filtros.addFocusListener( new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { list_filtrosFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { list_filtrosFocusLost(evt); } }); lbl_filtro.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_filtro.setText("Buscar por:"); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_buscarActionPerformed(evt); } }); btn_buscar.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { btn_buscarFocusLost(evt); } }); tf_valor.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_valorKeyTyped(evt); } }); lbl_valor.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_valor.setText("Valor:"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(18, 18, 18) .addComponent(lbl_filtro) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(79, 79, 79) .addComponent(lbl_valor) .addGap(18, 18, 18) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE) .addComponent( btn_buscar, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_buscar) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_valor) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_filtro)) .addContainerGap())); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, jTable2); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoAuditoria}")); columnBinding.setColumnName("Auditoria"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${usuario}")); columnBinding.setColumnName("Usuario"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fechaHora}")); columnBinding.setColumnName("Fecha Hora"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${accion}")); columnBinding.setColumnName("Accion"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tabla}")); columnBinding.setColumnName("Tabla"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${antes}")); columnBinding.setColumnName("Antes"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${despues}")); columnBinding.setColumnName("Despues"); columnBinding.setColumnClass(String.class); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane2.setViewportView(jTable2); if (jTable2.getColumnModel().getColumnCount() > 0) { jTable2.getColumnModel().getColumn(0).setPreferredWidth(30); jTable2.getColumnModel().getColumn(2).setPreferredWidth(75); jTable2.getColumnModel().getColumn(3).setPreferredWidth(50); jTable2.getColumnModel().getColumn(4).setPreferredWidth(50); jTable2.getColumnModel().getColumn(5).setPreferredWidth(100); jTable2.getColumnModel().getColumn(6).setPreferredWidth(100); } panel_auditoria.setBackground(new java.awt.Color(0, 153, 255)); panel_auditoria.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_auditoria.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_auditoria.setForeground(new java.awt.Color(255, 255, 255)); lbl_auditoria.setText("Auditoría de Sistema"); javax.swing.GroupLayout panel_auditoriaLayout = new javax.swing.GroupLayout(panel_auditoria); panel_auditoria.setLayout(panel_auditoriaLayout); panel_auditoriaLayout.setHorizontalGroup( panel_auditoriaLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, panel_auditoriaLayout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_auditoria) .addGap(162, 162, 162))); panel_auditoriaLayout.setVerticalGroup( panel_auditoriaLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_auditoriaLayout .createSequentialGroup() .addContainerGap() .addComponent(lbl_auditoria) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); btn_cerrar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cerrar.setText("Cancelar"); btn_cerrar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cerrarActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(20, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 958, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(21, 21, 21)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( panel_auditoria, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(198, 198, 198)))) .addGroup( layout .createSequentialGroup() .addGap(422, 422, 422) .addComponent( btn_cerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(18, 18, 18) .addComponent( panel_auditoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(btn_cerrar) .addGap(33, 33, 33))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** Controller for the preview panel. Allows you to edit attributes of the tag. */ public class PreviewPanel extends JPanel { private DomModel model; @ModelElement("tags") private TreeModel treeModel; @ModelElement("attributes") private List<Attribute> attributes = ObservableCollections.observableList(new ArrayList<Attribute>()); private DomModel document; @Bind("contentWrapper") private JPanel contentWrapper; @ModelElement("tagRenderer") private TagTreeRenderer tagTreeRenderer = new TagTreeRenderer(); public void compose() { treeModel = DomModelUtils.toTreeModel(model); try { document = Binder.bind(this, true); } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } DomConverter.toSwing(model); if (model.getController() != null) { Binder.bind(model, model.getController()); } JComponent root = model.getRootTag().getChildByName("body").getComponent(); contentWrapper.add(root); } /** Adds new attribute to the attributes list. */ public void add() { Attribute attr = new Attribute(); attributes.add(attr); } /** * Gets the selected node in the tags tree and applies all attributes fro the attributes list to * it. Do nothing if no node is selected. */ public void apply() { JTree tree = (JTree) document.getTagById("tagsTree").getComponent(); if (tree.getSelectionPath() != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent(); Tag tag = (Tag) node.getUserObject(); for (Attribute attr : attributes) { tag.setAttribute(attr.getName(), attr.getValue()); } tag.applyAttributes(tag.getComponent()); } } /** * Updates attributes list on node selection change in the tags tree. Loads attributes of the * selected node into the attributes list. Just clears attributes if no node is selected. * * @param e */ public void onTagChange(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { TreePath path = e.getNewLeadSelectionPath(); attributes.clear(); if (path.getPathCount() >= 1) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Tag tag = (Tag) node.getUserObject(); for (String name : tag.getAttributes().keySet()) { Attribute attr = new Attribute(); attr.setName(name); attr.setValue(tag.getAttribute(name)); attributes.add(attr); } } } } public List<Attribute> getAttributes() { return attributes; } public void setAttributes(List<Attribute> attributes) { this.attributes = attributes; } public DomModel getModel() { return model; } public void setModel(DomModel model) { this.model = model; } }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); reservaRenderizar1 = new renderizar.ReservaRenderizar(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT r FROM Reserva r"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : query.getResultList(); reservaQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT r FROM Reserva r"); reservaList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( reservaQuery.getResultList()); jPanel1 = new javax.swing.JPanel(); btn_cancelar = new javax.swing.JButton(); btn_generar = new javax.swing.JButton(); panel_generarFact = new javax.swing.JPanel(); lbl_generarFact = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); tf_categoria = new javax.swing.JTextField(); tf_codigo = new javax.swing.JTextField(); tf_nomApe = new javax.swing.JTextField(); lbl_cedula = new javax.swing.JLabel(); tf_cedula = new javax.swing.JTextField(); lbl_codigo = new javax.swing.JLabel(); tf_habitacion = new javax.swing.JTextField(); lbl_habitación = new javax.swing.JLabel(); lbl_nomApe = new javax.swing.JLabel(); lbl_categoria = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); tf_valor = new javax.swing.JTextField(); lbl_valor = new javax.swing.JLabel(); lbl_filtro = new javax.swing.JLabel(); list_filtros = new javax.swing.JComboBox(); btn_buscar = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_cancelar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cancelar.setText("Cancelar"); btn_cancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelarActionPerformed(evt); } }); btn_generar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/table.png"))); // NOI18N btn_generar.setText("Generar"); btn_generar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_generarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(26, 26, 26) .addComponent(btn_generar) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE) .addComponent(btn_cancelar) .addGap(28, 28, 28))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addComponent(btn_cancelar) .addGap(0, 0, Short.MAX_VALUE)) .addComponent( btn_generar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); panel_generarFact.setBackground(new java.awt.Color(0, 153, 255)); panel_generarFact.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_generarFact.setFont(new java.awt.Font("Corbel", 1, 27)); // NOI18N lbl_generarFact.setForeground(new java.awt.Color(255, 255, 255)); lbl_generarFact.setText("Generar Factura"); javax.swing.GroupLayout panel_generarFactLayout = new javax.swing.GroupLayout(panel_generarFact); panel_generarFact.setLayout(panel_generarFactLayout); panel_generarFactLayout.setHorizontalGroup( panel_generarFactLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_generarFactLayout .createSequentialGroup() .addGap(223, 223, 223) .addComponent(lbl_generarFact) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_generarFactLayout.setVerticalGroup( panel_generarFactLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_generarFactLayout .createSequentialGroup() .addContainerGap() .addComponent(lbl_generarFact) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); tf_categoria.setEditable(false); tf_categoria.setBackground(new java.awt.Color(0, 153, 255)); tf_categoria.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_categoria.setForeground(new java.awt.Color(255, 255, 255)); tf_codigo.setEditable(false); tf_codigo.setBackground(new java.awt.Color(0, 153, 255)); tf_codigo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_codigo.setForeground(new java.awt.Color(255, 255, 255)); tf_nomApe.setEditable(false); tf_nomApe.setBackground(new java.awt.Color(0, 153, 255)); tf_nomApe.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_nomApe.setForeground(new java.awt.Color(255, 255, 255)); lbl_cedula.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_cedula.setText("Cédula:"); tf_cedula.setEditable(false); tf_cedula.setBackground(new java.awt.Color(0, 153, 255)); tf_cedula.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_cedula.setForeground(new java.awt.Color(255, 255, 255)); lbl_codigo.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_codigo.setText("Código Reserva:"); tf_habitacion.setEditable(false); tf_habitacion.setBackground(new java.awt.Color(0, 153, 255)); tf_habitacion.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tf_habitacion.setForeground(new java.awt.Color(255, 255, 255)); lbl_habitación.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_habitación.setText("Habitación:"); lbl_nomApe.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_nomApe.setText("Nombre/Apellido:"); lbl_categoria.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N lbl_categoria.setText("Categoría:"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addGap(46, 46, 46) .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent(lbl_codigo) .addGap(18, 18, 18) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent( lbl_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( tf_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent(lbl_habitación) .addGap(42, 42, 42) .addComponent( tf_habitacion, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_categoria) .addGap(31, 31, 31) .addComponent( tf_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent( lbl_nomApe, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( tf_nomApe, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(51, 51, 51))); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_codigo) .addComponent( tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_habitación) .addComponent( tf_habitacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_categoria) .addComponent( tf_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(31, 31, 31) .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_cedula) .addComponent( tf_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_nomApe) .addComponent( tf_nomApe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(27, Short.MAX_VALUE))); jPanel3.setBackground(new java.awt.Color(204, 204, 204)); jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel3.setForeground(new java.awt.Color(204, 204, 255)); tf_valor.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_valorKeyTyped(evt); } }); lbl_valor.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_valor.setText("Valor:"); lbl_filtro.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_filtro.setText("Buscar por:"); list_filtros.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Cedula", "Nombre", "Apellido", "Habitación", "CheckIn", "CheckOut"})); list_filtros.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { list_filtrosFocusLost(evt); } }); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_buscarActionPerformed(evt); } }); btn_buscar.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { btn_buscarFocusLost(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addGap(29, 29, 29) .addComponent(lbl_filtro) .addGap(18, 18, 18) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(78, 78, 78) .addComponent(lbl_valor) .addGap(18, 18, 18) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE) .addComponent(btn_buscar) .addGap(53, 53, 53))); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_filtro) .addComponent(lbl_valor) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_buscar)) .addContainerGap())); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, reservaList, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoReserva}")); columnBinding.setColumnName(" Reserva"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${numHabitacion.numero}")); columnBinding.setColumnName(" Habitacion"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${numHabitacion.codigoCategoria.nombre}")); columnBinding.setColumnName("Categoría"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${checkIn}")); columnBinding.setColumnName("Check In"); columnBinding.setColumnClass(java.util.Date.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${checkOut}")); columnBinding.setColumnName("Check Out"); columnBinding.setColumnClass(java.util.Date.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoCliente.cedula}")); columnBinding.setColumnName("CI Cliente"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoCliente.nombre}")); columnBinding.setColumnName("Nombre"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codigoCliente.apellido}")); columnBinding.setColumnName("Apellido"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTable.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { masterTableMouseClicked(evt); } }); jScrollPane1.setViewportView(masterTable); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(30, 30, 30) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 744, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addGap(58, 58, 58) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING, false) .addComponent( panel_generarFact, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel3, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE))))) .addGroup( layout .createSequentialGroup() .addGap(239, 239, 239) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(32, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( panel_generarFact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(19, Short.MAX_VALUE))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("celciusPU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT b FROM Bolsters b"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); rangeLabel = new javax.swing.JLabel(); sizeLabel = new javax.swing.JLabel(); smvLabel = new javax.swing.JLabel(); rangeField = new javax.swing.JTextField(); sizeField = new javax.swing.JTextField(); smvField = new javax.swing.JTextField(); saveButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); newButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); jComboBox1 = new javax.swing.JComboBox(); FormListener formListener = new FormListener(); setBackground(new java.awt.Color(204, 204, 204)); setMinimumSize(new java.awt.Dimension(400, 400)); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${range}")); columnBinding.setColumnName("Range"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${size}")); columnBinding.setColumnName("Size ( diameter X length )"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${smv}")); columnBinding.setColumnName("Smv"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterScrollPane.setViewportView(masterTable); rangeLabel.setText("Range:"); sizeLabel.setText("Size:"); smvLabel.setText("Smv:"); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.range}"), rangeField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), rangeField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.size}"), sizeField, org.jdesktop.beansbinding.BeanProperty.create("text_ON_ACTION_OR_FOCUS_LOST")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), sizeField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.smv}"), smvField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), smvField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); saveButton.setText("Save"); saveButton.addActionListener(formListener); refreshButton.setText("Refresh"); refreshButton.addActionListener(formListener); newButton.setText("New"); newButton.addActionListener(formListener); deleteButton.setText("Delete"); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), deleteButton, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); deleteButton.addActionListener(formListener); jComboBox1.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"", "Classic", "Super", "Other"})); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, rangeField, org.jdesktop.beansbinding.ELProperty.create("${text}"), jComboBox1, org.jdesktop.beansbinding.BeanProperty.create("selectedItem")); bindingGroup.addBinding(binding); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addComponent(newButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveButton)) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rangeLabel) .addComponent(sizeLabel) .addComponent(smvLabel)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( sizeField, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE) .addComponent( smvField, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addComponent( jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED, 28, Short.MAX_VALUE) .addComponent( rangeField, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteButton, newButton, refreshButton, saveButton}); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rangeLabel) .addComponent( rangeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sizeLabel) .addComponent( sizeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(smvLabel) .addComponent( smvField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(refreshButton) .addComponent(deleteButton) .addComponent(newButton)) .addContainerGap())); rangeField.setVisible(false); bindingGroup.bind(); }
// public SolaList<NepaliYearBean> getNepaliYears() { // if (years == null) { // years = new SolaList<NepaliYearBean>(); // } // return years; // } public ObservableList<Integer> getNepaliYears() { if (years == null) { years = ObservableCollections.observableList(new ArrayList<Integer>()); } return years; }
public SysRegStatusBean() { super(); statusList = ObservableCollections.observableList(new LinkedList<SysRegStatusBean>()); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); informerecepcionQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT i FROM Informerecepcion i"); informerecepcionList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : informerecepcionQuery.getResultList(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT o FROM OrdenCompra o"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); detalleOrdenCompraQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT d FROM DetalleOrdenCompra d"); detalleOrdenCompraList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : detalleOrdenCompraQuery.getResultList(); panel_BuscarPS = new javax.swing.JPanel(); lbl_BuscarPS = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); lbl_valor = new javax.swing.JLabel(); tf_valor = new javax.swing.JTextField(); lbl_filtro = new javax.swing.JLabel(); list_filtros = new javax.swing.JComboBox(); btn_buscar = new javax.swing.JButton(); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); jPanel4 = new javax.swing.JPanel(); btn_cancelar = new javax.swing.JButton(); btn_imprimir = new javax.swing.JButton(); masterScrollPane1 = new javax.swing.JScrollPane(); masterTableDetalle = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); panel_BuscarPS.setBackground(new java.awt.Color(0, 153, 255)); panel_BuscarPS.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_BuscarPS.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_BuscarPS.setForeground(new java.awt.Color(255, 255, 255)); lbl_BuscarPS.setText("Ordenes de Compra"); javax.swing.GroupLayout panel_BuscarPSLayout = new javax.swing.GroupLayout(panel_BuscarPS); panel_BuscarPS.setLayout(panel_BuscarPSLayout); panel_BuscarPSLayout.setHorizontalGroup( panel_BuscarPSLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( panel_BuscarPSLayout .createSequentialGroup() .addGap(156, 156, 156) .addComponent(lbl_BuscarPS) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_BuscarPSLayout.setVerticalGroup( panel_BuscarPSLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, panel_BuscarPSLayout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_BuscarPS) .addContainerGap())); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbl_valor.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_valor.setText("Valor:"); tf_valor.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_valorKeyTyped(evt); } }); lbl_filtro.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_filtro.setText("Buscar por:"); list_filtros.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"Codigo", "Proveedor", "Articulo"})); list_filtros.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { list_filtrosMouseClicked(evt); } }); list_filtros.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { list_filtrosActionPerformed(evt); } }); btn_buscar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/zoom.png"))); // NOI18N btn_buscar.setText("Buscar"); btn_buscar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_buscarActionPerformed(evt); } }); btn_buscar.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { btn_buscarFocusLost(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(36, 36, 36) .addComponent(lbl_filtro) .addGap(18, 18, 18) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE) .addComponent(lbl_valor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btn_buscar) .addGap(36, 36, 36))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_filtro) .addComponent( list_filtros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_valor) .addComponent( tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_buscar)) .addContainerGap())); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${codOrden}")); columnBinding.setColumnName("Cod Orden"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codProveedor.razonSocial}")); columnBinding.setColumnName("Proveedor"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fecha}")); columnBinding.setColumnName("Fecha"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTable.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { masterTableMouseClicked(evt); } }); masterScrollPane.setViewportView(masterTable); jPanel4.setBackground(new java.awt.Color(204, 204, 204)); jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_cancelar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cancelar.setText("Cancelar"); btn_cancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelarActionPerformed(evt); } }); btn_imprimir.setText("Imprimir"); btn_imprimir.setEnabled(false); btn_imprimir.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_imprimirActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel4Layout .createSequentialGroup() .addGap(85, 85, 85) .addComponent(btn_imprimir) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 100, Short.MAX_VALUE) .addComponent(btn_cancelar) .addGap(25, 25, 25))); jPanel4Layout.setVerticalGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel4Layout .createSequentialGroup() .addContainerGap(25, Short.MAX_VALUE) .addGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_imprimir) .addComponent(btn_cancelar)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); masterTableDetalle.setEnabled(false); jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, detalleOrdenCompraList, masterTableDetalle); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${codArticulo.nombre}")); columnBinding.setColumnName("Articulo"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${cantidadPedida}")); columnBinding.setColumnName("Cantidad Pedida"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${cantidadRecibida}")); columnBinding.setColumnName("Cantidad Recibida"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterTableDetalle.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { masterTableDetalleMouseClicked(evt); } }); masterScrollPane1.setViewportView(masterTableDetalle); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( panel_BuscarPS, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addGap(10, 10, 10) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( masterScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup( layout .createSequentialGroup() .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addComponent(masterScrollPane1)) .addContainerGap()) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(120, 120, 120))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addComponent( panel_BuscarPS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent( masterScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
private void initDataList() { this.listTipoContrato = ObservableCollections.observableList(new ArrayList<TipoContrato>()); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); myTableRenderer1 = new misc.MyTableRenderer(); playList2 = playList1; songQuery = em.createQuery("SELECT pls.songid FROM PlayListSong pls WHERE pls.playlistid=:playlist") .setParameter("playlist", playList2); songList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( songQuery.getResultList()); songList.add(new Song(-1L)); playListSongQuery = em.createQuery("SELECT pls FROM PlayListSong pls WHERE pls.playlistid=:playlist") .setParameter("playlist", playList2); playListSongList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( playListSongQuery.getResultList()); albumSongQuery = albumSongQuery = em.createQuery( "SELECT albsong FROM AlbumSong albsong WHERE albsong.songid IN :songlist") .setParameter("songlist", songList); albumSongList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( albumSongQuery.getResultList()); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); newButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); saveButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); myTableRenderer1.setText("myTableRenderer2"); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Διαχείριση Λίστας"); jLabel2.setText("Περιγραφή:"); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, playList2, org.jdesktop.beansbinding.ELProperty.create("${name}"), jTextField1, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jTextField1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel10.setText("Λίστα Τραγουδιών"); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, albumSongList, jTable1); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${songid.title}")); columnBinding.setColumnName("Τίτλος"); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${albumid}")); columnBinding.setColumnName("Καλλιτέχνης / Συγκρότημα"); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${songid.duration}")); columnBinding.setColumnName("Διάρκεια"); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane1.setViewportView(jTable1); if (jTable1.getColumnModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(1).setCellRenderer(myTableRenderer1); } newButton.setText("Εισαγωγή τραγουδιού"); newButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newButtonActionPerformed(evt); } }); deleteButton.setText("Διαγραφή τραγουδιού"); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jTable1, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), deleteButton, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); deleteButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteButtonActionPerformed(evt); } }); saveButton.setText("Αποθήκευση"); saveButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveButtonActionPerformed(evt); } }); cancelButton.setText("Ακύρωση"); cancelButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); jLabel4.setText("Ημερομηνία δημιουργίας:"); jTextField2.setFocusable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, playList2, org.jdesktop.beansbinding.ELProperty.create("${creationdate}"), jTextField2, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jTextField2.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(saveButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED) .addComponent(cancelButton)) .addGroup( layout .createSequentialGroup() .addComponent(newButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED) .addComponent(deleteButton)) .addGroup( layout .createSequentialGroup() .addComponent(jLabel4) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent( jTextField2, javax.swing.GroupLayout .PREFERRED_SIZE, 100, javax.swing.GroupLayout .PREFERRED_SIZE) .addComponent( jTextField1, javax.swing.GroupLayout .PREFERRED_SIZE, 268, javax.swing.GroupLayout .PREFERRED_SIZE)))) .addGap(0, 0, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(jLabel2) .addGap(0, 539, Short.MAX_VALUE)) .addComponent(jScrollPane1)) .addContainerGap())))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap() .addComponent( jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent( jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent( jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jLabel10) .addGap(18, 18, 18) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newButton) .addComponent(deleteButton)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(cancelButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); bindingGroup.bind(); pack(); setLocationRelativeTo(null); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("proyectoPU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT p FROM Proveedor p"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); categoriaArticuloQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM CategoriaArticulo c"); categoriaArticuloList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : categoriaArticuloQuery.getResultList(); jPanel1 = new javax.swing.JPanel(); tf_telef = new javax.swing.JTextField(); tf_email = new javax.swing.JTextField(); lbl_direccion = new javax.swing.JLabel(); lbl_ruc = new javax.swing.JLabel(); tf_ruc = new javax.swing.JTextField(); tf_cedula = new javax.swing.JTextField(); lbl_email = new javax.swing.JLabel(); tf_direccion = new javax.swing.JTextField(); lbl_razonSocial = new javax.swing.JLabel(); lbl_telef = new javax.swing.JLabel(); tf_razonSocial = new javax.swing.JTextField(); lbl_apellido1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); combotipo = new javax.swing.JComboBox(); lbl_cedula1 = new javax.swing.JLabel(); lbl_telef1 = new javax.swing.JLabel(); combo_cat = new javax.swing.JComboBox(); jPanel2 = new javax.swing.JPanel(); btn_cancelar = new javax.swing.JButton(); btn_guardar = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); lbl_registrarC = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); tf_telef.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_telefKeyTyped(evt); } }); tf_email.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tf_emailActionPerformed(evt); } }); tf_email.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_emailKeyTyped(evt); } }); lbl_direccion.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_direccion.setText("Dirección:"); lbl_ruc.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_ruc.setText("RUC:"); tf_ruc.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tf_rucActionPerformed(evt); } }); tf_ruc.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { tf_rucFocusLost(evt); } }); tf_ruc.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_rucKeyTyped(evt); } }); tf_cedula.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tf_cedulaActionPerformed(evt); } }); tf_cedula.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { tf_cedulaFocusLost(evt); } }); tf_cedula.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_cedulaKeyTyped(evt); } }); lbl_email.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_email.setText("Email:"); tf_direccion.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_direccionKeyTyped(evt); } }); lbl_razonSocial.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_razonSocial.setText("Razon Social:"); lbl_telef.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_telef.setText("Teléfono:"); tf_razonSocial.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tf_razonSocialActionPerformed(evt); } }); tf_razonSocial.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { tf_razonSocialKeyTyped(evt); } }); lbl_apellido1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_apellido1.setText("Tipo"); jLabel1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N jLabel1.setText("'N': Natural o 'J': Juridico"); combotipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"N", "J"})); combotipo.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { combotipoMouseClicked(evt); } }); combotipo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { combotipoActionPerformed(evt); } }); lbl_cedula1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_cedula1.setText("Cedula:"); lbl_telef1.setFont(new java.awt.Font("Candara", 0, 14)); // NOI18N lbl_telef1.setText("Categoria Proveedor:"); org.jdesktop.swingbinding.JComboBoxBinding jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, categoriaArticuloList, combo_cat); bindingGroup.addBinding(jComboBoxBinding); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbl_razonSocial) .addComponent(lbl_ruc) .addComponent(lbl_apellido1) .addComponent(lbl_cedula1) .addComponent(lbl_telef1)) .addGap(32, 32, 32) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( tf_razonSocial, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( jPanel1Layout .createSequentialGroup() .addComponent( combotipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED) .addComponent(jLabel1)) .addComponent( tf_ruc, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(49, 49, 49) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent(lbl_email) .addComponent(lbl_direccion))) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout .createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED) .addComponent(lbl_telef)))) .addComponent( combo_cat, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 75, Short.MAX_VALUE) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( tf_telef, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(20, 20, 20))); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addGap(19, 19, 19) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_apellido1) .addComponent(jLabel1) .addComponent( combotipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_email) .addComponent(lbl_razonSocial) .addComponent( tf_razonSocial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( tf_ruc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_ruc) .addComponent(lbl_direccion) .addComponent( tf_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(21, 21, 21) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( tf_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_cedula1) .addComponent( tf_telef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_telef)) .addGap(18, 18, 18) .addGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( combo_cat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_telef1)) .addContainerGap(36, Short.MAX_VALUE))); jPanel2.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); btn_cancelar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N btn_cancelar.setText("Cancelar"); btn_cancelar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelarActionPerformed(evt); } }); btn_guardar.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.png"))); // NOI18N btn_guardar.setText("Guardar"); btn_guardar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_guardarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addGap(34, 34, 34) .addComponent(btn_guardar) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE) .addComponent(btn_cancelar) .addGap(34, 34, 34))); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent(btn_cancelar) .addGap(0, 0, Short.MAX_VALUE)) .addComponent( btn_guardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel3.setBackground(new java.awt.Color(0, 153, 255)); jPanel3.setBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); lbl_registrarC.setFont(new java.awt.Font("Corbel", 1, 30)); // NOI18N lbl_registrarC.setForeground(new java.awt.Color(255, 255, 255)); lbl_registrarC.setText("Crear Proveedor"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addGap(128, 128, 128) .addComponent(lbl_registrarC) .addContainerGap(226, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addComponent(lbl_registrarC) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addGap(64, 64, 64) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) .addGroup( layout .createSequentialGroup() .addGap(132, 132, 132) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addGap(20, 20, 20) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29) .addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32))); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
private void initData() { MyBean[] beans = new MyBean[] {new MyBean("first"), new MyBean("second"), new MyBean("third")}; beanList = ObservableCollections.observableList(Arrays.asList(beans)); // wrap a navigation object around the list navigation = new Navigation(beanList); }
/** Initialize cell Line panel */ private void initCellLinePanel() { // init cellLineJCombo cellLineTypeBindingList = ObservableCollections.observableList(cellLineService.findAllCellLineTypes()); JComboBoxBinding jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, cellLineTypeBindingList, setupConditionsPanel.getCellLineComboBox()); bindingGroup.addBinding(jComboBoxBinding); // init growth medium JCombo mediumBindingList = ObservableCollections.observableList(cellLineService.findAllGrowthMedia()); jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, mediumBindingList, setupConditionsPanel.getGrowthMediumComboBox()); bindingGroup.addBinding(jComboBoxBinding); // init serum JCombo serumBindingList = ObservableCollections.observableList(cellLineService.findAllSera()); jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, serumBindingList, setupConditionsPanel.getSerumComboBox()); bindingGroup.addBinding(jComboBoxBinding); // init the other serum ComboBox jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, serumBindingList, treatmentsController.getTreatmentsPanel().getSerumComboBox()); bindingGroup.addBinding(jComboBoxBinding); // init assay medium JCombo (it's actually in the treatment panel, but ca not be bind before // since the mediumBindingList would still be null) jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, mediumBindingList, treatmentsController.getTreatmentsPanel().getAssayMediumComboBox()); bindingGroup.addBinding(jComboBoxBinding); bindingGroup.bind(); /** add action listeners */ /** insert a new cell line Type in the DB if it's not present yet */ setupConditionsPanel .getAddCellLineButton() .addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!setupConditionsPanel.getCellLineNameTextField().getText().isEmpty()) { CellLineType newCellLineType = new CellLineType(); newCellLineType.setName( setupConditionsPanel.getCellLineNameTextField().getText()); try { // insert cell line to DB saveCellLineType(newCellLineType); // add the new cell line to the list cellLineTypeBindingList.add(newCellLineType); setupConditionsPanel.getCellLineNameTextField().setText(""); showMessage( "Cell line inserted to DB!", "cell line saved", JOptionPane.INFORMATION_MESSAGE); } catch (PersistenceException exception) { LOG.error(exception.getMessage()); showMessage( "Cell Line already present in DB!", "", JOptionPane.WARNING_MESSAGE); setupConditionsPanel.getCellLineNameTextField().setText(""); setupConditionsPanel.getCellLineNameTextField().requestFocusInWindow(); } } else { showMessage( "Please insert a name for the cell line!", "", JOptionPane.WARNING_MESSAGE); setupConditionsPanel.getCellLineNameTextField().requestFocusInWindow(); } } }); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); tesisUpecPUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("tesisUpecPU") .createEntityManager(); cursoPostgradoQuery = java.beans.Beans.isDesignTime() ? null : tesisUpecPUEntityManager.createQuery("SELECT c FROM CursoPostgrado c"); cursoPostgradoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( cursoPostgradoQuery.getResultList()); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jPanel5 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel5 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Gestionar Curso Postgrado"); setResizable(false); addWindowListener( new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel1.setBackground(new java.awt.Color(30, 76, 89)); jPanel2.setBackground(new java.awt.Color(30, 76, 89)); jLabel1.setIcon( new javax.swing.ImageIcon(getClass().getResource("/imagenes/banergrande.jpg"))); // NOI18N jPanel4.setBackground(new java.awt.Color(255, 255, 255)); jPanel4.setBorder( javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(30, 76, 89))); jLabel3.setIcon( new javax.swing.ImageIcon( getClass().getResource("/imagenes/gestioncursopostgrado.jpg"))); // NOI18N jLabel3.setText("jLabel3"); jLabel2.setText("Tipo de Curso Postgrado:"); jLabel4.setText("Descripción:"); jTextField1.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { jTextField1KeyTyped(evt); } }); jTextArea1.setColumns(20); jTextArea1.setRows(5); jTextArea1.addKeyListener( new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { jTextArea1KeyTyped(evt); } }); jScrollPane1.setViewportView(jTextArea1); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel4Layout .createSequentialGroup() .addGap(26, 26, 26) .addGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 432, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( jPanel4Layout .createSequentialGroup() .addGap(10, 10, 10) .addGroup( jPanel4Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel4)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( jPanel4Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane1) .addComponent( jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)))) .addContainerGap(72, Short.MAX_VALUE))); jPanel4Layout.setVerticalGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel4Layout .createSequentialGroup() .addContainerGap() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent( jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(46, Short.MAX_VALUE))); jPanel5.setBackground(new java.awt.Color(255, 255, 255)); jPanel5.setBorder( javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(30, 76, 89))); jButton1.setText("Insertar"); jButton1.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jButton1MousePressed(evt); } }); jButton2.setText("Modificar"); jButton2.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jButton2MousePressed(evt); } }); jButton3.setText("Eliminar"); jButton3.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jButton3MousePressed(evt); } }); jButton5.setText("Cancelar"); jButton5.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jButton5MousePressed(evt); } }); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel5Layout .createSequentialGroup() .addGap(111, 111, 111) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3) .addGap(18, 18, 18) .addComponent(jButton5) .addContainerGap(99, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup( jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel5Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1) .addComponent(jButton3) .addComponent(jButton5)) .addContainerGap(13, Short.MAX_VALUE))); jPanel3.setBackground(new java.awt.Color(255, 255, 255)); jPanel3.setBorder( javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(30, 76, 89))); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cursoPostgradoList, jTable1); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${tipoPostgrado}")); columnBinding.setColumnName("Tipo de Postgrado"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${descripcionPostgrado}")); columnBinding.setColumnName("Descripción"); columnBinding.setColumnClass(String.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane2.setViewportView(jTable1); jLabel5.setText("Cudorso Postgrado:"); org.jdesktop.swingbinding.JComboBoxBinding jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cursoPostgradoList, jComboBox1); bindingGroup.addBinding(jComboBoxBinding); jButton4.setText("Buscar"); jButton4.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jButton4MousePressed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addContainerGap() .addComponent(jLabel5) .addGap(18, 18, 18) .addComponent( jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(51, 51, 51) .addComponent(jButton4) .addContainerGap(103, Short.MAX_VALUE)) .addComponent( jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel3Layout .createSequentialGroup() .addGap(20, 20, 20) .addGroup( jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent( jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4)) .addGap(18, 18, 18) .addComponent( jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel1Layout .createSequentialGroup() .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 629, javax.swing.GroupLayout.PREFERRED_SIZE)); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); mainPanel = new javax.swing.JPanel(); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); idLabel = new javax.swing.JLabel(); imeLabel = new javax.swing.JLabel(); prezimeLabel = new javax.swing.JLabel(); adresaLabel = new javax.swing.JLabel(); brojlicneLabel = new javax.swing.JLabel(); sifraotiskaLabel = new javax.swing.JLabel(); idField = new javax.swing.JTextField(); imeField = new javax.swing.JTextField(); prezimeField = new javax.swing.JTextField(); adresaField = new javax.swing.JTextField(); brojlicneField = new javax.swing.JTextField(); sifraotiskaField = new javax.swing.JTextField(); saveButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); newButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem newRecordMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenuItem deleteRecordMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); javax.swing.JMenuItem saveMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenuItem refreshMenuItem = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JSeparator(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); statusPanel = new javax.swing.JPanel(); javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator(); statusMessageLabel = new javax.swing.JLabel(); statusAnimationLabel = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance( fingerprintapplication.FingerprintApplication.class) .getContext() .getResourceMap(FingerprintView.class); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory( resourceMap.getString("entityManager.persistenceUnit")) .createEntityManager(); // NOI18N query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("query.query")); // NOI18N list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); mainPanel.setName("mainPanel"); // NOI18N masterScrollPane.setName("masterScrollPane"); // NOI18N masterTable.setName("masterTable"); // NOI18N org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}")); columnBinding.setColumnName("Id"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${ime}")); columnBinding.setColumnName("Ime"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${prezime}")); columnBinding.setColumnName("Prezime"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${adresa}")); columnBinding.setColumnName("Adresa"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${brojlicne}")); columnBinding.setColumnName("Brojlicne"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${sifraotiska}")); columnBinding.setColumnName("Sifraotiska"); columnBinding.setColumnClass(String.class); bindingGroup.addBinding(jTableBinding); masterScrollPane.setViewportView(masterTable); idLabel.setText(resourceMap.getString("idLabel.text")); // NOI18N idLabel.setName("idLabel"); // NOI18N imeLabel.setText(resourceMap.getString("imeLabel.text")); // NOI18N imeLabel.setName("imeLabel"); // NOI18N prezimeLabel.setText(resourceMap.getString("prezimeLabel.text")); // NOI18N prezimeLabel.setName("prezimeLabel"); // NOI18N adresaLabel.setText(resourceMap.getString("adresaLabel.text")); // NOI18N adresaLabel.setName("adresaLabel"); // NOI18N brojlicneLabel.setText(resourceMap.getString("brojlicneLabel.text")); // NOI18N brojlicneLabel.setName("brojlicneLabel"); // NOI18N sifraotiskaLabel.setText(resourceMap.getString("sifraotiskaLabel.text")); // NOI18N sifraotiskaLabel.setName("sifraotiskaLabel"); // NOI18N idField.setName("idField"); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.id}"), idField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), idField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); imeField.setName("imeField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.ime}"), imeField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), imeField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); prezimeField.setName("prezimeField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.prezime}"), prezimeField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), prezimeField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); adresaField.setName("adresaField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.adresa}"), adresaField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), adresaField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); brojlicneField.setName("brojlicneField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.brojlicne}"), brojlicneField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), brojlicneField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); sifraotiskaField.setName("sifraotiskaField"); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.sifraotiska}"), sifraotiskaField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue(null); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), sifraotiskaField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance( fingerprintapplication.FingerprintApplication.class) .getContext() .getActionMap(FingerprintView.class, this); saveButton.setAction(actionMap.get("save")); // NOI18N saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N saveButton.setName("saveButton"); // NOI18N refreshButton.setAction(actionMap.get("refresh")); // NOI18N refreshButton.setText(resourceMap.getString("refreshButton.text")); // NOI18N refreshButton.setName("refreshButton"); // NOI18N newButton.setAction(actionMap.get("newRecord")); // NOI18N newButton.setText(resourceMap.getString("newButton.text")); // NOI18N newButton.setName("newButton"); // NOI18N deleteButton.setAction(actionMap.get("deleteRecord")); // NOI18N deleteButton.setText(resourceMap.getString("deleteButton.text")); // NOI18N deleteButton.setName("deleteButton"); // NOI18N javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( mainPanelLayout .createSequentialGroup() .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout .createSequentialGroup() .addComponent(newButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveButton)) .addGroup( mainPanelLayout .createSequentialGroup() .addContainerGap() .addGroup( mainPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(idLabel) .addComponent(imeLabel) .addComponent(prezimeLabel) .addComponent(adresaLabel) .addComponent(brojlicneLabel) .addComponent(sifraotiskaLabel)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( idField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) .addComponent( imeField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) .addComponent( prezimeField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) .addComponent( adresaField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) .addComponent( brojlicneField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) .addComponent( sifraotiskaField, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE))) .addGroup( mainPanelLayout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE))) .addContainerGap())); mainPanelLayout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteButton, newButton, refreshButton, saveButton}); mainPanelLayout.setVerticalGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( mainPanelLayout .createSequentialGroup() .addContainerGap() .addComponent( masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(idLabel) .addComponent( idField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(imeLabel) .addComponent( imeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(prezimeLabel) .addComponent( prezimeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(adresaLabel) .addComponent( adresaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(brojlicneLabel) .addComponent( brojlicneField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sifraotiskaLabel) .addComponent( sifraotiskaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(refreshButton) .addComponent(deleteButton) .addComponent(newButton)) .addContainerGap())); menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N newRecordMenuItem.setAction(actionMap.get("newRecord")); // NOI18N newRecordMenuItem.setText(resourceMap.getString("newRecordMenuItem.text")); // NOI18N newRecordMenuItem.setName("newRecordMenuItem"); // NOI18N fileMenu.add(newRecordMenuItem); deleteRecordMenuItem.setAction(actionMap.get("deleteRecord")); // NOI18N deleteRecordMenuItem.setText(resourceMap.getString("deleteRecordMenuItem.text")); // NOI18N deleteRecordMenuItem.setName("deleteRecordMenuItem"); // NOI18N fileMenu.add(deleteRecordMenuItem); jSeparator1.setName("jSeparator1"); // NOI18N fileMenu.add(jSeparator1); saveMenuItem.setAction(actionMap.get("save")); // NOI18N saveMenuItem.setText(resourceMap.getString("saveMenuItem.text")); // NOI18N saveMenuItem.setName("saveMenuItem"); // NOI18N fileMenu.add(saveMenuItem); refreshMenuItem.setAction(actionMap.get("refresh")); // NOI18N refreshMenuItem.setText(resourceMap.getString("refreshMenuItem.text")); // NOI18N refreshMenuItem.setName("refreshMenuItem"); // NOI18N fileMenu.add(refreshMenuItem); jSeparator2.setName("jSeparator2"); // NOI18N fileMenu.add(jSeparator2); exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); statusPanel.setName("statusPanel"); // NOI18N statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N statusMessageLabel.setName("statusMessageLabel"); // NOI18N statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N progressBar.setName("progressBar"); // NOI18N javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel); statusPanel.setLayout(statusPanelLayout); statusPanelLayout.setHorizontalGroup( statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE) .addGroup( statusPanelLayout .createSequentialGroup() .addContainerGap() .addComponent(statusMessageLabel) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 277, Short.MAX_VALUE) .addComponent( progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(statusAnimationLabel) .addContainerGap())); statusPanelLayout.setVerticalGroup( statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( statusPanelLayout .createSequentialGroup() .addComponent( statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(statusMessageLabel) .addComponent(statusAnimationLabel) .addComponent( progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3))); setComponent(mainPanel); setMenuBar(menuBar); setStatusBar(statusPanel); bindingGroup.bind(); } // </editor-fold>//GEN-END:initComponents
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("databasePU") .createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM Customers c"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList( query.getResultList()); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); moneyScrollPane = new javax.swing.JScrollPane(); moneyTable = new javax.swing.JTable(); productScrollPane = new javax.swing.JScrollPane(); productTable = new javax.swing.JTable(); monthComboBox = new javax.swing.JComboBox(); yearField = new javax.swing.JFormattedTextField(); filterButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); exportButton = new javax.swing.JButton(); infoLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setName("Form"); // NOI18N masterScrollPane.setName("masterScrollPane"); // NOI18N masterTable.setName("masterTable"); // NOI18N org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create( "${company} (№ ${contractNum}, ${dateStr})")); columnBinding.setColumnName("${company} (№ ${contractNum}, ${dateStr})"); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${customerId}")); columnBinding.setColumnName("Customer Id"); columnBinding.setColumnClass(Integer.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${startSaldo}")); columnBinding.setColumnName("Start Saldo"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); masterScrollPane.setViewportView(masterTable); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(database.DatabaseApp.class) .getContext() .getResourceMap(CustomerCardsDialog.class); masterTable .getColumnModel() .getColumn(0) .setHeaderValue(resourceMap.getString("masterTable.columnModel.title2")); // NOI18N masterTable.getColumnModel().getColumn(1).setMinWidth(0); masterTable.getColumnModel().getColumn(1).setPreferredWidth(0); masterTable.getColumnModel().getColumn(1).setMaxWidth(0); masterTable .getColumnModel() .getColumn(1) .setHeaderValue(resourceMap.getString("masterTable.columnModel.title0")); // NOI18N masterTable.getColumnModel().getColumn(2).setMinWidth(0); masterTable.getColumnModel().getColumn(2).setPreferredWidth(0); masterTable.getColumnModel().getColumn(2).setMaxWidth(0); masterTable .getColumnModel() .getColumn(2) .setHeaderValue(resourceMap.getString("masterTable.columnModel.title1")); // NOI18N moneyScrollPane.setName("moneyScrollPane"); // NOI18N moneyTable.setName("moneyTable"); // NOI18N org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement.customerMoneyList}"); jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, eLProperty, moneyTable); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${transactionDate}")); columnBinding.setColumnName("Transaction Date"); columnBinding.setColumnClass(java.util.Date.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${cash}")); columnBinding.setColumnName("Cash"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nonCash}")); columnBinding.setColumnName("Non Cash"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tick}")); columnBinding.setColumnName("Tick"); columnBinding.setColumnClass(Boolean.class); columnBinding.setEditable(false); jTableBinding.setSourceUnreadableValue(java.util.Collections.emptyList()); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); moneyScrollPane.setViewportView(moneyTable); moneyTable .getColumnModel() .getColumn(0) .setHeaderValue(resourceMap.getString("moneyTable.columnModel.title0")); // NOI18N moneyTable .getColumnModel() .getColumn(1) .setHeaderValue(resourceMap.getString("moneyTable.columnModel.title1")); // NOI18N moneyTable .getColumnModel() .getColumn(2) .setHeaderValue(resourceMap.getString("moneyTable.columnModel.title2")); // NOI18N moneyTable .getColumnModel() .getColumn(3) .setHeaderValue(resourceMap.getString("moneyTable.columnModel.title3")); // NOI18N productScrollPane.setName("productScrollPane"); // NOI18N productTable.setName("productTable"); // NOI18N eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement.customerProductList}"); jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, eLProperty, productTable); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${transactionDate}")); columnBinding.setColumnName("Transaction Date"); columnBinding.setColumnClass(java.util.Date.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${prodId}")); columnBinding.setColumnName("Prod Id"); columnBinding.setColumnClass(database.Products.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${placeId}")); columnBinding.setColumnName("Place Id"); columnBinding.setColumnClass(database.Places.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tonnage}")); columnBinding.setColumnName("Tonnage"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${price}")); columnBinding.setColumnName("Price"); columnBinding.setColumnClass(Double.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${price * tonnage}")); columnBinding.setColumnName("Price * tonnage"); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding( org.jdesktop.beansbinding.ELProperty.create("${distributorId}")); columnBinding.setColumnName("Distributor Id"); columnBinding.setColumnClass(database.Distributors.class); columnBinding.setEditable(false); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tick}")); columnBinding.setColumnName("Tick"); columnBinding.setColumnClass(Boolean.class); columnBinding.setEditable(false); jTableBinding.setSourceUnreadableValue(java.util.Collections.emptyList()); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); productScrollPane.setViewportView(productTable); productTable .getColumnModel() .getColumn(0) .setHeaderValue(resourceMap.getString("productTable.columnModel.title0")); // NOI18N productTable .getColumnModel() .getColumn(1) .setHeaderValue(resourceMap.getString("productTable.columnModel.title1")); // NOI18N productTable .getColumnModel() .getColumn(2) .setHeaderValue(resourceMap.getString("productTable.columnModel.title2")); // NOI18N productTable .getColumnModel() .getColumn(3) .setHeaderValue(resourceMap.getString("productTable.columnModel.title3")); // NOI18N productTable .getColumnModel() .getColumn(4) .setHeaderValue(resourceMap.getString("productTable.columnModel.title4")); // NOI18N productTable .getColumnModel() .getColumn(5) .setHeaderValue(resourceMap.getString("productTable.columnModel.title5")); // NOI18N productTable .getColumnModel() .getColumn(6) .setHeaderValue(resourceMap.getString("productTable.columnModel.title6")); // NOI18N productTable .getColumnModel() .getColumn(7) .setHeaderValue(resourceMap.getString("productTable.columnModel.title7")); // NOI18N monthComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" })); monthComboBox.setName("monthComboBox"); // NOI18N yearField.setFormatterFactory( new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("yyyy")))); yearField.setName("yearField"); // NOI18N filterButton.setText(resourceMap.getString("filterButton.text")); // NOI18N filterButton.setName("filterButton"); // NOI18N filterButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { filterButtonActionPerformed(evt); } }); cancelButton.setText(resourceMap.getString("cancelButton.text")); // NOI18N cancelButton.setName("cancelButton"); // NOI18N cancelButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); exportButton.setIcon(resourceMap.getIcon("exportButton.icon")); // NOI18N exportButton.setText(resourceMap.getString("exportButton.text")); // NOI18N exportButton.setName("exportButton"); // NOI18N exportButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportButtonActionPerformed(evt); } }); infoLabel.setText(resourceMap.getString("infoLabel.text")); // NOI18N infoLabel.setName("infoLabel"); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent( moneyScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE) .addGap(26, 26, 26) .addComponent( productScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addComponent( masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup( layout .createSequentialGroup() .addComponent( yearField, javax.swing.GroupLayout .PREFERRED_SIZE, 83, javax.swing.GroupLayout .PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(filterButton) .addPreferredGap( javax.swing.LayoutStyle .ComponentPlacement.UNRELATED) .addComponent( cancelButton, javax.swing.GroupLayout .PREFERRED_SIZE, 86, javax.swing.GroupLayout .PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addComponent( monthComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, 193, javax.swing.GroupLayout .PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle .ComponentPlacement.RELATED, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exportButton))) .addComponent(infoLabel)) .addGap(49, 49, 49))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( monthComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(exportButton)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cancelButton) .addComponent( yearField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(filterButton)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(infoLabel))) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( moneyScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE) .addComponent(productScrollPane, 0, 0, Short.MAX_VALUE)) .addContainerGap())); bindingGroup.bind(); pack(); } // </editor-fold>//GEN-END:initComponents