Estaba en medio de cosas y movi archivos
Estoy avanzando a la venta, pero se me ocurrio mover unos archivos porque.... puedo? Me molestaba tanta cosa en el index XD aparte mejore el migrate.sh y cree un dump.sh para mas comodidad de exportar los cambios a la base de datos
This commit is contained in:
@@ -87,6 +87,8 @@ import xyz.danielcortes.controllers.trabajador.telefono.TrabajadorTelefonoViewCo
|
||||
import xyz.danielcortes.controllers.trabajador.usuario.UsuarioCreateController;
|
||||
import xyz.danielcortes.controllers.trabajador.usuario.UsuarioUpdateController;
|
||||
import xyz.danielcortes.controllers.trabajador.usuario.UsuarioViewController;
|
||||
import xyz.danielcortes.controllers.vender.VenderSearchController;
|
||||
import xyz.danielcortes.controllers.vender.VenderVenderController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Usuario;
|
||||
@@ -148,6 +150,8 @@ import xyz.danielcortes.views.trabajador.TrabajadorViewPanel;
|
||||
import xyz.danielcortes.views.usuario.UsuarioCreatePanel;
|
||||
import xyz.danielcortes.views.usuario.UsuarioUpdatePanel;
|
||||
import xyz.danielcortes.views.usuario.UsuarioViewPanel;
|
||||
import xyz.danielcortes.views.vender.VenderSearchPanel;
|
||||
import xyz.danielcortes.views.vender.VenderVenderPanel;
|
||||
|
||||
/**
|
||||
* Controlador principal de la aplicacion
|
||||
@@ -305,6 +309,9 @@ public class LaunchController {
|
||||
this.controllers.put(PanelName.ORDEN_COMPRA_ACEPTAR, new OrdenCompraAceptarController(new OrdenCompraAceptarPanel(), this));
|
||||
this.controllers.put(PanelName.ORDEN_COMPRA_ASIGNAR, new OrdenCompraAsignarController(new OrdenCompraAsignarPanel(), this));
|
||||
|
||||
this.controllers.put(PanelName.VENDER_SEARCH, new VenderSearchController(new VenderSearchPanel(), this));
|
||||
this.controllers.put(PanelName.VENDER_VENDER, new VenderVenderController(new VenderVenderPanel(), this));
|
||||
|
||||
for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) {
|
||||
this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey());
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class OrdenCompraAceptarController extends BaseController {
|
||||
compra.setFactura(factura);
|
||||
this.compraRepository.save(compra);
|
||||
|
||||
this.ordenCompra.setEstado("Aceptada");
|
||||
this.ordenCompra.setEstado("Recibida");
|
||||
this.ordenCompra.setCompra(compra);
|
||||
this.ordenCompraRepository.update(this.ordenCompra);
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ public class OrdenCompraSearchController extends BaseController {
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
return;
|
||||
} else if (ordenCompra.getEstado().equals("Aceptada")) {
|
||||
} else if (ordenCompra.getEstado().equals("Recibida")) {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"La orden ya fue aceptada",
|
||||
"La orden ya fue Recibida",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package xyz.danielcortes.controllers.vender;
|
||||
|
||||
import java.util.List;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Venta;
|
||||
import xyz.danielcortes.repository.VenderRepository;
|
||||
import xyz.danielcortes.views.vender.VenderSearchPanel;
|
||||
|
||||
public class VenderSearchController extends BaseController {
|
||||
|
||||
private VenderSearchPanel view;
|
||||
private VenderRepository repository;
|
||||
|
||||
public VenderSearchController(VenderSearchPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.repository = new VenderRepository();
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getBuscarField().addActionListener(e -> this.search());
|
||||
this.view.getVenderButton().addActionListener(e -> this.vender());
|
||||
this.view.getVerButton().addActionListener(e -> this.ver());
|
||||
}
|
||||
|
||||
private void search() {
|
||||
}
|
||||
|
||||
private void vender() {
|
||||
this.parentController.showCard(PanelName.VENDER_VENDER);
|
||||
}
|
||||
|
||||
private void ver() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.loadTable();
|
||||
this.view.getVentasTable().clearSelection();
|
||||
this.view.getBuscarField().setText("");
|
||||
}
|
||||
|
||||
private void loadTable() {
|
||||
List<Venta> ventas = this.repository.getAll();
|
||||
this.view.getVentaTableModel().setRows(ventas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package xyz.danielcortes.controllers.vender;
|
||||
|
||||
import java.util.List;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.models.Cliente;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
import xyz.danielcortes.repository.ClienteRepository;
|
||||
import xyz.danielcortes.repository.EjemplarRepository;
|
||||
import xyz.danielcortes.repository.VenderRepository;
|
||||
import xyz.danielcortes.views.vender.VenderVenderPanel;
|
||||
|
||||
public class VenderVenderController extends BaseController {
|
||||
|
||||
private VenderVenderPanel view;
|
||||
private VenderRepository venderRepository;
|
||||
private ClienteRepository clienteRepository;
|
||||
private EjemplarRepository ejemplarRepository;
|
||||
|
||||
public VenderVenderController(VenderVenderPanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.venderRepository = new VenderRepository();
|
||||
this.clienteRepository = new ClienteRepository();
|
||||
this.ejemplarRepository = new EjemplarRepository();
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getAgregarButton().addActionListener(e -> this.agregar());
|
||||
}
|
||||
|
||||
private void agregar() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCliente();
|
||||
this.fillEjemplares();
|
||||
this.view.getEjemplaresTableModel().removeRows();
|
||||
}
|
||||
|
||||
private void fillCliente() {
|
||||
List<Cliente> cliente = this.clienteRepository.getAll();
|
||||
this.view.getClienteComboModel().removeAllElements();
|
||||
this.view.getClienteComboModel().addAll(cliente);
|
||||
}
|
||||
|
||||
private void fillEjemplares() {
|
||||
List<Ejemplar> ejemplares = this.ejemplarRepository.getAll();
|
||||
this.view.getEjemplaresComboModel().removeAllElements();
|
||||
this.view.getEjemplaresComboModel().addAll(ejemplares);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package xyz.danielcortes.controllers.vender;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
|
||||
public class VenderVerController extends BaseController {
|
||||
|
||||
|
||||
public VenderVerController(LaunchController parentController) {
|
||||
super(parentController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package xyz.danielcortes.repository;
|
||||
|
||||
import xyz.danielcortes.framework.BaseRepository;
|
||||
import xyz.danielcortes.models.Cliente;
|
||||
|
||||
public class ClienteRepository extends BaseRepository<Cliente> {
|
||||
|
||||
public ClienteRepository() {
|
||||
super(Cliente.class);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,11 @@ public class OrdenCompraRepository extends BaseRepository<OrdenCompra> {
|
||||
}
|
||||
|
||||
public List<OrdenCompra> search(String term) {
|
||||
Query query = this.em.createQuery("SELECT o FROM OrdenCompra o WHERE LOWER(o.estado) LIKE :term");
|
||||
Query query = this.em.createQuery("SELECT o FROM OrdenCompra o WHERE"
|
||||
+ " LOWER(o.estado) LIKE :term OR"
|
||||
+ " LOWER(o.distribuidor.rut) LIKE :term OR "
|
||||
+ " CONCAT(o.libros.size, '') LIKE :term OR "
|
||||
+ " LOWER(o.insertedAt) LIKE :term");
|
||||
query.setParameter("term", "%" + term.toLowerCase() + "%");
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package xyz.danielcortes.repository;
|
||||
|
||||
import xyz.danielcortes.framework.BaseRepository;
|
||||
import xyz.danielcortes.models.Venta;
|
||||
|
||||
public class VenderRepository extends BaseRepository<Venta> {
|
||||
|
||||
public VenderRepository() {
|
||||
super(Venta.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class OrdenCompraValidator {
|
||||
// se ve mas cul
|
||||
switch (estado) {
|
||||
case "En Curso":
|
||||
case "Aceptada":
|
||||
case "Recibida":
|
||||
case "Cancelada":
|
||||
return ValidationResult.NON_ERROR;
|
||||
default:
|
||||
|
||||
@@ -153,4 +153,5 @@ public class IdiomaSearchPanel extends BasePanel {
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderSearchPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="20" left="20" bottom="20" right="20"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<scrollpane id="ec841">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="71e3b" class="javax.swing.JTable" binding="ventasTable" custom-create="true">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<grid id="9441d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a29f8" class="javax.swing.JButton" binding="buscarButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Buscar"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="97bf7" class="javax.swing.JTextField" binding="buscarField">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="9ab80" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="92d7b" class="javax.swing.JButton" binding="verButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Ver"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="49f8e" class="javax.swing.JButton" binding="venderButton">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Vender"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,136 @@
|
||||
package xyz.danielcortes.views.vender;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Venta;
|
||||
|
||||
public class VenderSearchPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JTable ventasTable;
|
||||
private JButton buscarButton;
|
||||
private JTextField buscarField;
|
||||
private JButton verButton;
|
||||
private JButton venderButton;
|
||||
private BaseTableModel<Venta> ventaTableModel;
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getVentasTable() {
|
||||
return this.ventasTable;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JTextField getBuscarField() {
|
||||
return this.buscarField;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getVenderButton() {
|
||||
return this.venderButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Venta> getVentaTableModel() {
|
||||
return this.ventaTableModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
createUIComponents();
|
||||
contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(20, 20, 20, 20), -1, -1));
|
||||
final JScrollPane scrollPane1 = new JScrollPane();
|
||||
contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false));
|
||||
scrollPane1.setViewportView(ventasTable);
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
buscarButton = new JButton();
|
||||
buscarButton.setText("Buscar");
|
||||
panel1.add(buscarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
buscarField = new JTextField();
|
||||
panel1.add(buscarField,
|
||||
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
verButton = new JButton();
|
||||
verButton.setText("Ver");
|
||||
panel2.add(verButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
venderButton = new JButton();
|
||||
venderButton.setText("Vender");
|
||||
panel2.add(venderButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
// @formatter:off
|
||||
this.ventaTableModel = new BaseTableModel<>(
|
||||
new String[]{"Fecha Emision", "Nº Boleta", "Nº Ejemplares", "Vendedor", "Cliente"},
|
||||
(row, rowIndex, colIndex) -> {
|
||||
switch (colIndex) {
|
||||
case 0: return row.get(rowIndex).getBoleta().getFechaEmision();
|
||||
case 1: return row.get(rowIndex).getBoleta().getFolio();
|
||||
case 2: return row.get(rowIndex).getEjemplares().size();
|
||||
case 3: return row.get(rowIndex).getTrabajador().getRut();
|
||||
case 4: return row.get(rowIndex).getCliente().getRut();
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
// @formatter:on
|
||||
this.ventasTable = new JTable(this.ventaTableModel);
|
||||
this.ventasTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVenderPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="14" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="20" left="20" bottom="20" right="20"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="490" height="536"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="de140" class="javax.swing.JButton" binding="venderButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Vender"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6c400" class="javax.swing.JButton" binding="cancelarButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Cancelar"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="83ea6">
|
||||
<constraints>
|
||||
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<hspacer id="832a4">
|
||||
<constraints>
|
||||
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<hspacer id="7d130">
|
||||
<constraints>
|
||||
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="10dc0" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Cliente:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<scrollpane id="40e17">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="46eda" class="javax.swing.JTable" binding="ejemplaresTable" custom-create="true">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<grid id="58392" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="92e07" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Ejemplares:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="808b9" class="javax.swing.JComboBox" binding="ejemplaresCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="9343d" class="javax.swing.JButton" binding="agregarButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="30" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="+"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="350ea" class="javax.swing.JComboBox" binding="clienteCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="184ff" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Precio Total:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="441d9" class="javax.swing.JTextField" binding="precioTotalField">
|
||||
<constraints>
|
||||
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="c72e8" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="IVA:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="195f" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Precio Neto:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="89a07" class="javax.swing.JTextField" binding="precioNetoField">
|
||||
<constraints>
|
||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
|
||||
<constraints>
|
||||
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="89829" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Folio:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f03bc" class="javax.swing.JTextField" binding="folioField">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,239 @@
|
||||
package xyz.danielcortes.views.vender;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Cliente;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
|
||||
public class VenderVenderPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JButton venderButton;
|
||||
private JButton cancelarButton;
|
||||
private JTable ejemplaresTable;
|
||||
private BaseTableModel<Ejemplar> ejemplaresTableModel;
|
||||
private JComboBox<Cliente> clienteCombo;
|
||||
private DefaultComboBoxModel<Cliente> clienteComboModel;
|
||||
private JComboBox<Ejemplar> ejemplaresCombo;
|
||||
private DefaultComboBoxModel<Ejemplar> ejemplaresComboModel;
|
||||
private JButton agregarButton;
|
||||
private JTextField precioTotalField;
|
||||
private JTextField precioNetoField;
|
||||
private JTextField ivaField;
|
||||
private JTextField folioField;
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVenderButton() {
|
||||
return this.venderButton;
|
||||
}
|
||||
|
||||
public JButton getCancelarButton() {
|
||||
return this.cancelarButton;
|
||||
}
|
||||
|
||||
public JTable getEjemplaresTable() {
|
||||
return this.ejemplaresTable;
|
||||
}
|
||||
|
||||
public JComboBox getClienteCombo() {
|
||||
return this.clienteCombo;
|
||||
}
|
||||
|
||||
public JComboBox getEjemplaresCombo() {
|
||||
return this.ejemplaresCombo;
|
||||
}
|
||||
|
||||
public JButton getAgregarButton() {
|
||||
return this.agregarButton;
|
||||
}
|
||||
|
||||
public JTextField getPrecioTotalField() {
|
||||
return this.precioTotalField;
|
||||
}
|
||||
|
||||
public JTextField getPrecioNetoField() {
|
||||
return this.precioNetoField;
|
||||
}
|
||||
|
||||
public JTextField getIvaField() {
|
||||
return this.ivaField;
|
||||
}
|
||||
|
||||
public JTextField getFolioField() {
|
||||
return this.folioField;
|
||||
}
|
||||
|
||||
public BaseTableModel<Ejemplar> getEjemplaresTableModel() {
|
||||
return this.ejemplaresTableModel;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Cliente> getClienteComboModel() {
|
||||
return this.clienteComboModel;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Ejemplar> getEjemplaresComboModel() {
|
||||
return this.ejemplaresComboModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
createUIComponents();
|
||||
contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayoutManager(14, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
venderButton = new JButton();
|
||||
venderButton.setText("Vender");
|
||||
panel1.add(venderButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
cancelarButton = new JButton();
|
||||
cancelarButton.setText("Cancelar");
|
||||
panel1.add(cancelarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
final Spacer spacer1 = new Spacer();
|
||||
contentPane.add(spacer1,
|
||||
new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||
null, null, 0, false));
|
||||
final Spacer spacer2 = new Spacer();
|
||||
contentPane.add(spacer2,
|
||||
new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||
null, null, null, 0, false));
|
||||
final Spacer spacer3 = new Spacer();
|
||||
contentPane.add(spacer3,
|
||||
new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||
null, null, null, 0, false));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Cliente:");
|
||||
contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JScrollPane scrollPane1 = new JScrollPane();
|
||||
contentPane.add(scrollPane1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||
scrollPane1.setViewportView(ejemplaresTable);
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Ejemplares:");
|
||||
panel2.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel2.add(ejemplaresCombo,
|
||||
new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
agregarButton = new JButton();
|
||||
agregarButton.setText("+");
|
||||
panel2.add(agregarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, -1),
|
||||
null, 0, false));
|
||||
contentPane.add(clienteCombo,
|
||||
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label3 = new JLabel();
|
||||
label3.setText("Precio Total:");
|
||||
contentPane.add(label3, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioTotalField = new JTextField();
|
||||
precioTotalField.setEditable(false);
|
||||
contentPane.add(precioTotalField,
|
||||
new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label4 = new JLabel();
|
||||
label4.setText("IVA:");
|
||||
contentPane.add(label4, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label5 = new JLabel();
|
||||
label5.setText("Precio Neto:");
|
||||
contentPane.add(label5, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioNetoField = new JTextField();
|
||||
precioNetoField.setEditable(false);
|
||||
contentPane.add(precioNetoField,
|
||||
new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
ivaField = new JTextField();
|
||||
ivaField.setEditable(false);
|
||||
contentPane.add(ivaField,
|
||||
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label6 = new JLabel();
|
||||
label6.setText("Folio:");
|
||||
contentPane.add(label6, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
folioField = new JTextField();
|
||||
folioField.setEditable(false);
|
||||
contentPane.add(folioField,
|
||||
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
this.clienteComboModel = new DefaultComboBoxModel<>();
|
||||
this.clienteCombo = new JComboBox<>(this.clienteComboModel);
|
||||
|
||||
this.ejemplaresComboModel = new DefaultComboBoxModel<>();
|
||||
this.ejemplaresCombo = new JComboBox<>(this.ejemplaresComboModel);
|
||||
|
||||
// @formatter:off
|
||||
this.ejemplaresTableModel = new BaseTableModel<>(
|
||||
new String[]{"ISBN", "Serie", "Titulo"},
|
||||
(row, rowIndex, colIndex) -> {
|
||||
switch (colIndex) {
|
||||
case 0: return row.get(rowIndex).getLibro().getIsbn();
|
||||
case 1: return row.get(rowIndex).getSerie();
|
||||
case 2: return row.get(rowIndex).getLibro().getTitulo();
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
// @formatter:on
|
||||
|
||||
this.ejemplaresTable = new JTable(this.ejemplaresTableModel);
|
||||
this.ejemplaresTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
}
|
||||
157
src/main/java/xyz/danielcortes/views/vender/VenderVerPanel.form
Normal file
157
src/main/java/xyz/danielcortes/views/vender/VenderVerPanel.form
Normal file
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVerPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="14" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="20" left="20" bottom="20" right="20"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="490" height="536"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="6c400" class="javax.swing.JButton" binding="volverButton">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Volver"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="83ea6">
|
||||
<constraints>
|
||||
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<hspacer id="832a4">
|
||||
<constraints>
|
||||
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<hspacer id="7d130">
|
||||
<constraints>
|
||||
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="10dc0" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Cliente:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<scrollpane id="40e17">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="46eda" class="javax.swing.JTable" binding="ejemplaresTable" custom-create="true">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<component id="184ff" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Precio Total:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="441d9" class="javax.swing.JTextField" binding="precioTotalField">
|
||||
<constraints>
|
||||
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="c72e8" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="IVA:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="195f" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Precio Neto:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="89a07" class="javax.swing.JTextField" binding="precioNetoField">
|
||||
<constraints>
|
||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
|
||||
<constraints>
|
||||
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="89829" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Folio:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f03bc" class="javax.swing.JTextField" binding="folioField">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="92e07" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Ejemplares:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="61ff7" class="javax.swing.JTextField" binding="clienteField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
192
src/main/java/xyz/danielcortes/views/vender/VenderVerPanel.java
Normal file
192
src/main/java/xyz/danielcortes/views/vender/VenderVerPanel.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package xyz.danielcortes.views.vender;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
|
||||
public class VenderVerPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JButton venderButton;
|
||||
private JButton volverButton;
|
||||
private JTable ejemplaresTable;
|
||||
private BaseTableModel<Ejemplar> ejemplaresTableModel;
|
||||
private JButton agregarButton;
|
||||
private JTextField precioTotalField;
|
||||
private JTextField precioNetoField;
|
||||
private JTextField ivaField;
|
||||
private JTextField folioField;
|
||||
private JTextField clienteField;
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVenderButton() {
|
||||
return this.venderButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTable getEjemplaresTable() {
|
||||
return this.ejemplaresTable;
|
||||
}
|
||||
|
||||
public JButton getAgregarButton() {
|
||||
return this.agregarButton;
|
||||
}
|
||||
|
||||
public JTextField getPrecioTotalField() {
|
||||
return this.precioTotalField;
|
||||
}
|
||||
|
||||
public JTextField getPrecioNetoField() {
|
||||
return this.precioNetoField;
|
||||
}
|
||||
|
||||
public JTextField getIvaField() {
|
||||
return this.ivaField;
|
||||
}
|
||||
|
||||
public JTextField getFolioField() {
|
||||
return this.folioField;
|
||||
}
|
||||
|
||||
public JTextField getClienteField() {
|
||||
return this.clienteField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
createUIComponents();
|
||||
contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayoutManager(14, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
volverButton = new JButton();
|
||||
volverButton.setText("Volver");
|
||||
panel1.add(volverButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||
null, 0, false));
|
||||
final Spacer spacer1 = new Spacer();
|
||||
contentPane.add(spacer1,
|
||||
new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||
null, null, 0, false));
|
||||
final Spacer spacer2 = new Spacer();
|
||||
contentPane.add(spacer2,
|
||||
new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||
null, null, null, 0, false));
|
||||
final Spacer spacer3 = new Spacer();
|
||||
contentPane.add(spacer3,
|
||||
new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||
null, null, null, 0, false));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Cliente:");
|
||||
contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JScrollPane scrollPane1 = new JScrollPane();
|
||||
contentPane.add(scrollPane1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||
scrollPane1.setViewportView(ejemplaresTable);
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Precio Total:");
|
||||
contentPane.add(label2, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioTotalField = new JTextField();
|
||||
precioTotalField.setEditable(false);
|
||||
contentPane.add(precioTotalField,
|
||||
new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label3 = new JLabel();
|
||||
label3.setText("IVA:");
|
||||
contentPane.add(label3, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label4 = new JLabel();
|
||||
label4.setText("Precio Neto:");
|
||||
contentPane.add(label4, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioNetoField = new JTextField();
|
||||
precioNetoField.setEditable(false);
|
||||
contentPane.add(precioNetoField,
|
||||
new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
ivaField = new JTextField();
|
||||
ivaField.setEditable(false);
|
||||
contentPane.add(ivaField,
|
||||
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label5 = new JLabel();
|
||||
label5.setText("Folio:");
|
||||
contentPane.add(label5, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
folioField = new JTextField();
|
||||
folioField.setEditable(false);
|
||||
contentPane.add(folioField,
|
||||
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
final JLabel label6 = new JLabel();
|
||||
label6.setText("Ejemplares:");
|
||||
contentPane.add(label6, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
clienteField = new JTextField();
|
||||
contentPane.add(clienteField,
|
||||
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
// @formatter:off
|
||||
this.ejemplaresTableModel = new BaseTableModel<>(
|
||||
new String[]{"ISBN", "Serie", "Titulo"},
|
||||
(row, rowIndex, colIndex) -> {
|
||||
switch (colIndex) {
|
||||
case 0: return row.get(rowIndex).getLibro().getIsbn();
|
||||
case 1: return row.get(rowIndex).getSerie();
|
||||
case 2: return row.get(rowIndex).getLibro().getTitulo();
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
// @formatter:on
|
||||
this.ejemplaresTable = new JTable(this.ejemplaresTableModel);
|
||||
this.ejemplaresTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user