Todo a medias, aparecieron mil requerientos :c
This commit is contained in:
@@ -30,7 +30,9 @@ import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoCreateContro
|
||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoSearchController;
|
||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoUpdateController;
|
||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoViewController;
|
||||
import xyz.danielcortes.controllers.comprar.ComprarComprarController;
|
||||
import xyz.danielcortes.controllers.comprar.ComprarSearchController;
|
||||
import xyz.danielcortes.controllers.comprar.ComprarSeleccionarController;
|
||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorCreateController;
|
||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorSearchController;
|
||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorUpdateController;
|
||||
@@ -98,7 +100,9 @@ import xyz.danielcortes.views.cliente.ClienteCreatePanel;
|
||||
import xyz.danielcortes.views.cliente.ClienteSearchPanel;
|
||||
import xyz.danielcortes.views.cliente.ClienteUpdatePanel;
|
||||
import xyz.danielcortes.views.cliente.ClienteViewPanel;
|
||||
import xyz.danielcortes.views.comprar.ComprarComprarPanel;
|
||||
import xyz.danielcortes.views.comprar.ComprarSearchPanel;
|
||||
import xyz.danielcortes.views.comprar.ComprarSeleccionarPanel;
|
||||
import xyz.danielcortes.views.correo.CorreoCreatePanel;
|
||||
import xyz.danielcortes.views.correo.CorreoSearchPanel;
|
||||
import xyz.danielcortes.views.correo.CorreoUpdatePanel;
|
||||
@@ -289,6 +293,8 @@ public class LaunchController {
|
||||
this.controllers.put(PanelName.DISTRIBUIDOR_DIRECCION_UPDATE, new DistribuidorDireccionUpdateController(new DireccionUpdatePanel(), this));
|
||||
|
||||
this.controllers.put(PanelName.COMPRAR_SEARCH, new ComprarSearchController(new ComprarSearchPanel(), this));
|
||||
this.controllers.put(PanelName.COMPRAR_COMPRAR, new ComprarComprarController(new ComprarComprarPanel(), this));
|
||||
this.controllers.put(PanelName.COMPRAR_SELECCIONAR, new ComprarSeleccionarController(new ComprarSeleccionarPanel(), this));
|
||||
|
||||
for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) {
|
||||
this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey());
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package xyz.danielcortes.controllers.comprar;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.repository.CompraRepository;
|
||||
import xyz.danielcortes.repository.DistribuidorRepository;
|
||||
import xyz.danielcortes.validator.CompraValidator;
|
||||
import xyz.danielcortes.views.comprar.ComprarComprarPanel;
|
||||
|
||||
public class ComprarComprarController extends BaseController {
|
||||
|
||||
private ComprarComprarPanel view;
|
||||
private CompraRepository compraRepository;
|
||||
private DistribuidorRepository distribuidorRepository;
|
||||
private CompraValidator validator;
|
||||
|
||||
public ComprarComprarController(ComprarComprarPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.compraRepository = new CompraRepository();
|
||||
this.distribuidorRepository = new DistribuidorRepository();
|
||||
this.validator = new CompraValidator(this.compraRepository);
|
||||
this.setupListeners();
|
||||
|
||||
}
|
||||
|
||||
public void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.COMPRAR_SEARCH));
|
||||
this.view.getSeleccionarButton().addActionListener(e -> this.parentController.showCard(PanelName.COMPRAR_SELECCIONAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillDistribuidores();
|
||||
}
|
||||
|
||||
private void fillDistribuidores() {
|
||||
this.view.getDistribuidorModel().removeAllElements();
|
||||
this.view.getDistribuidorModel().addAll(this.distribuidorRepository.getAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package xyz.danielcortes.controllers.comprar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
import xyz.danielcortes.models.Estado;
|
||||
import xyz.danielcortes.models.Libro;
|
||||
import xyz.danielcortes.repository.EjemplarRepository;
|
||||
import xyz.danielcortes.repository.LibroRepository;
|
||||
import xyz.danielcortes.validator.EjemplarValidator;
|
||||
import xyz.danielcortes.views.comprar.ComprarSeleccionarPanel;
|
||||
|
||||
public class ComprarSeleccionarController extends BaseController {
|
||||
|
||||
private ComprarSeleccionarPanel view;
|
||||
private LibroRepository libroRepository;
|
||||
private EjemplarValidator ejemplarValidator;
|
||||
|
||||
private List<Ejemplar> ejemplares;
|
||||
private List<Ejemplar> editing;
|
||||
|
||||
public ComprarSeleccionarController(ComprarSeleccionarPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.libroRepository = new LibroRepository();
|
||||
this.ejemplarValidator = new EjemplarValidator(new EjemplarRepository());
|
||||
this.ejemplares = new ArrayList<>();
|
||||
this.editing = new ArrayList<>();
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
public void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
this.view.getRemoverButton().addActionListener(e -> this.remove());
|
||||
this.view.getAgregarButton().addActionListener(e -> this.agregar());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
this.ejemplares.clear();
|
||||
this.ejemplares.addAll(this.editing);
|
||||
|
||||
this.getParentController().showCard(PanelName.COMPRAR_COMPRAR);
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
this.editing.clear();
|
||||
this.editing.addAll(this.ejemplares);
|
||||
|
||||
this.parentController.showCard(PanelName.COMPRAR_COMPRAR);
|
||||
}
|
||||
|
||||
private void remove() {
|
||||
Ejemplar ejemplar = this.getSelectedEjemplar();
|
||||
if (ejemplar == null)
|
||||
return;
|
||||
int index = this.view.getEjemplaresTable().getSelectedRow();
|
||||
|
||||
this.view.getEjemplaresTableModel().removeRow(index);
|
||||
this.editing.remove(ejemplar);
|
||||
}
|
||||
|
||||
private void agregar() {
|
||||
Libro libro = (Libro) this.view.getLibrosCombo().getSelectedItem();
|
||||
if (libro == null)
|
||||
return;
|
||||
|
||||
String serie = this.view.getSerieField().getText();
|
||||
|
||||
ValidationResult serieValidation = this.ejemplarValidator.validateSerie(serie, libro.getId(), this.editing);
|
||||
if (serieValidation.hasError()) {
|
||||
serieValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
Ejemplar ejemplar = new Ejemplar();
|
||||
ejemplar.setLibro(libro);
|
||||
ejemplar.setSerie(serie);
|
||||
ejemplar.setEstado(new Estado());
|
||||
|
||||
this.editing.add(ejemplar);
|
||||
this.view.getEjemplaresTableModel().addRow(ejemplar);
|
||||
|
||||
this.view.getLibrosCombo().setSelectedIndex(0);
|
||||
this.view.getSerieField().setText("");
|
||||
}
|
||||
|
||||
private Ejemplar getSelectedEjemplar() {
|
||||
int selectedRow = this.view.getEjemplaresTable().getSelectedRow();
|
||||
if (selectedRow == -1) {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"No hay ningun ejemplar seleccionado",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
return null;
|
||||
}
|
||||
return this.view.getEjemplaresTableModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.editing.clear();
|
||||
this.editing.addAll(this.ejemplares);
|
||||
|
||||
this.fillLibros();
|
||||
this.view.getLibrosCombo().setSelectedIndex(0);
|
||||
}
|
||||
|
||||
private void fillLibros() {
|
||||
this.view.getLibrosComboModel().removeAllElements();
|
||||
this.view.getLibrosComboModel().addAll(this.libroRepository.getAll());
|
||||
|
||||
this.view.getEjemplaresTableModel().setRows(this.ejemplares);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public List<Ejemplar> getEjemplares() {
|
||||
return this.ejemplares;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,6 +98,7 @@ public enum PanelName {
|
||||
CLIENTE_DIRECCION_UPDATE,
|
||||
|
||||
COMPRAR_SEARCH,
|
||||
COMPRAR_SELECCIONAR,
|
||||
COMPRAR_VIEW,
|
||||
COMPRAR_COMPRAR,
|
||||
|
||||
|
||||
@@ -105,4 +105,9 @@ public class Distribuidor {
|
||||
this.compras = compras;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.rut;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package xyz.danielcortes.validator;
|
||||
|
||||
import java.util.List;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
import xyz.danielcortes.repository.EjemplarRepository;
|
||||
|
||||
public class EjemplarValidator {
|
||||
@@ -11,7 +13,7 @@ public class EjemplarValidator {
|
||||
this.ejemplarRepository = ejemplarRepository;
|
||||
}
|
||||
|
||||
public ValidationResult validateSerie(String serie, Integer libroId) {
|
||||
public ValidationResult validateSerie(String serie, Integer libroId, List<Ejemplar> ejemplares) {
|
||||
if (serie == null) {
|
||||
return new ValidationResult("La serie es nula");
|
||||
}
|
||||
@@ -21,6 +23,9 @@ public class EjemplarValidator {
|
||||
if (this.ejemplarRepository.exists(serie, libroId)) {
|
||||
return new ValidationResult("El numero de serie ya existe");
|
||||
}
|
||||
if (ejemplares.stream().anyMatch(ejemplar -> ejemplar.getLibro().getId().equals(libroId) && ejemplar.getSerie().equals(serie))) {
|
||||
return new ValidationResult("El numero de serie ya existe");
|
||||
}
|
||||
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.comprar.ComprarComprarPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="7" 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="518" height="530"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="de524" 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="Libros:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="36014">
|
||||
<constraints>
|
||||
<grid row="6" 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="11118">
|
||||
<constraints>
|
||||
<grid row="6" 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="43954">
|
||||
<constraints>
|
||||
<grid row="6" 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="847b5" 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="Distribuidor:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="66798" class="javax.swing.JComboBox" binding="distribuidorCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" 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="2b462" class="javax.swing.JButton" binding="seleccionarButton" 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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Seleccionar"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="15262" layout-manager="GridLayoutManager" row-count="10" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<grid row="4" 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="line" title="Factura"/>
|
||||
<children>
|
||||
<component id="3164e" 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="Folio:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="3a289" class="javax.swing.JTextField" binding="folioField">
|
||||
<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">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="66882" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" 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="Precio Neto:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="38890" class="javax.swing.JTextField" binding="precioNetoField">
|
||||
<constraints>
|
||||
<grid row="3" 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="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="94d68" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" 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="Precio IVA:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2b4c9" class="javax.swing.JTextField" binding="precioIVAField">
|
||||
<constraints>
|
||||
<grid row="5" 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="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="56f53" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" 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="Precio Bruto:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="bf663" class="javax.swing.JTextField" binding="precioBrutoField">
|
||||
<constraints>
|
||||
<grid row="7" 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="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="552e6" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="8" 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="Fecha compra:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="51579" class="com.github.lgooddatepicker.components.DatePicker" binding="fechaCompraField">
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="17d46" 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="5" 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="74b0c" class="javax.swing.JButton" binding="guardarButton" 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="Guardar"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="45282" class="javax.swing.JButton" binding="volverButton" 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="Volver"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,200 @@
|
||||
package xyz.danielcortes.views.comprar;
|
||||
|
||||
import com.github.lgooddatepicker.components.DatePicker;
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.BorderFactory;
|
||||
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.JTextField;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.models.Distribuidor;
|
||||
|
||||
public class ComprarComprarPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JComboBox<Distribuidor> distribuidorCombo;
|
||||
private DefaultComboBoxModel<Distribuidor> distribuidorModel;
|
||||
private JButton seleccionarButton;
|
||||
private JTextField folioField;
|
||||
private JTextField precioNetoField;
|
||||
private JTextField precioIVAField;
|
||||
private JTextField precioBrutoField;
|
||||
private DatePicker fechaCompraField;
|
||||
private JButton guardarButton;
|
||||
private JButton volverButton;
|
||||
|
||||
{
|
||||
// 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 JComboBox getDistribuidorCombo() {
|
||||
return this.distribuidorCombo;
|
||||
}
|
||||
|
||||
public JButton getSeleccionarButton() {
|
||||
return this.seleccionarButton;
|
||||
}
|
||||
|
||||
public JTextField getFolioField() {
|
||||
return this.folioField;
|
||||
}
|
||||
|
||||
public JTextField getPrecioNetoField() {
|
||||
return this.precioNetoField;
|
||||
}
|
||||
|
||||
public JTextField getPrecioIVAField() {
|
||||
return this.precioIVAField;
|
||||
}
|
||||
|
||||
public JTextField getPrecioBrutoField() {
|
||||
return this.precioBrutoField;
|
||||
}
|
||||
|
||||
public DatePicker getFechaCompraField() {
|
||||
return this.fechaCompraField;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Distribuidor> getDistribuidorModel() {
|
||||
return this.distribuidorModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(7, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Libros:");
|
||||
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 Spacer spacer1 = new Spacer();
|
||||
contentPane.add(spacer1,
|
||||
new GridConstraints(6, 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(6, 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(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||
null, null, 0, false));
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Distribuidor:");
|
||||
contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
contentPane.add(distribuidorCombo,
|
||||
new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||
seleccionarButton = new JButton();
|
||||
seleccionarButton.setText("Seleccionar");
|
||||
contentPane.add(seleccionarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
|
||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(10, 1, new Insets(10, 10, 10, 10), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(4, 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));
|
||||
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), "Factura"));
|
||||
final JLabel label3 = new JLabel();
|
||||
label3.setText("Folio:");
|
||||
panel1.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
folioField = new JTextField();
|
||||
folioField.setText("");
|
||||
panel1.add(folioField,
|
||||
new GridConstraints(1, 0, 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("Precio Neto:");
|
||||
panel1.add(label4, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioNetoField = new JTextField();
|
||||
panel1.add(precioNetoField,
|
||||
new GridConstraints(3, 0, 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("Precio IVA:");
|
||||
panel1.add(label5, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioIVAField = new JTextField();
|
||||
precioIVAField.setEditable(false);
|
||||
panel1.add(precioIVAField,
|
||||
new GridConstraints(5, 0, 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("Precio Bruto:");
|
||||
panel1.add(label6, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
precioBrutoField = new JTextField();
|
||||
precioBrutoField.setEditable(false);
|
||||
panel1.add(precioBrutoField,
|
||||
new GridConstraints(7, 0, 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 label7 = new JLabel();
|
||||
label7.setText("Fecha compra:");
|
||||
panel1.add(label7, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
fechaCompraField = new DatePicker();
|
||||
panel1.add(fechaCompraField,
|
||||
new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -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(5, 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));
|
||||
guardarButton = new JButton();
|
||||
guardarButton.setText("Guardar");
|
||||
panel2.add(guardarButton, 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));
|
||||
volverButton = new JButton();
|
||||
volverButton.setText("Volver");
|
||||
panel2.add(volverButton, 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));
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
this.distribuidorModel = new DefaultComboBoxModel<>();
|
||||
this.distribuidorCombo = new JComboBox<>(this.distribuidorModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
}
|
||||
@@ -139,4 +139,5 @@ public class ComprarSearchPanel extends BasePanel {
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.comprar.ComprarSeleccionarPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="5" 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="631" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="13b47">
|
||||
<constraints>
|
||||
<grid row="4" 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>
|
||||
<scrollpane id="3750c">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" 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="2e370" class="javax.swing.JTable" binding="ejemplaresTable" custom-create="true" default-binding="true">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<hspacer id="32a85">
|
||||
<constraints>
|
||||
<grid row="4" 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="bd6b7">
|
||||
<constraints>
|
||||
<grid row="4" 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>
|
||||
<grid id="5d741" layout-manager="GridLayoutManager" row-count="5" 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="1" 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="db345" class="javax.swing.JComboBox" binding="librosCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" 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="350" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="6693" 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="Libro:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5aecc" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" 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="Serie:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7cdc5" class="javax.swing.JTextField" binding="serieField">
|
||||
<constraints>
|
||||
<grid row="3" 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>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5c6b2" class="javax.swing.JButton" binding="agregarButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" 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="Agregar"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="ca98b" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="3" 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="ef939" class="javax.swing.JButton" binding="removerButton">
|
||||
<constraints>
|
||||
<grid row="0" column="2" 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="Remover"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f66dd" class="javax.swing.JButton" binding="guardarButton" 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="Guardar"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="90c0e" class="javax.swing.JButton" binding="volverButton" 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="Volver"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,187 @@
|
||||
package xyz.danielcortes.views.comprar;
|
||||
|
||||
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 xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Ejemplar;
|
||||
import xyz.danielcortes.models.Libro;
|
||||
|
||||
public class ComprarSeleccionarPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JTable ejemplaresTable;
|
||||
private BaseTableModel<Ejemplar> ejemplaresTableModel;
|
||||
private JComboBox<Libro> librosCombo;
|
||||
private DefaultComboBoxModel<Libro> librosComboModel;
|
||||
private JButton agregarButton;
|
||||
private JButton removerButton;
|
||||
private JButton guardarButton;
|
||||
private JButton volverButton;
|
||||
private JTextField serieField;
|
||||
|
||||
{
|
||||
// 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 getEjemplaresTable() {
|
||||
return this.ejemplaresTable;
|
||||
}
|
||||
|
||||
public JComboBox getLibrosCombo() {
|
||||
return this.librosCombo;
|
||||
}
|
||||
|
||||
public JButton getAgregarButton() {
|
||||
return this.agregarButton;
|
||||
}
|
||||
|
||||
public JButton getRemoverButton() {
|
||||
return this.removerButton;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Ejemplar> getEjemplaresTableModel() {
|
||||
return this.ejemplaresTableModel;
|
||||
}
|
||||
|
||||
public JTextField getSerieField() {
|
||||
return this.serieField;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Libro> getLibrosComboModel() {
|
||||
return this.librosComboModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(5, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||
final Spacer spacer1 = new Spacer();
|
||||
contentPane.add(spacer1,
|
||||
new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||
null, null, 0, false));
|
||||
final JScrollPane scrollPane1 = new JScrollPane();
|
||||
contentPane.add(scrollPane1, new GridConstraints(2, 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, new Dimension(400, -1), null, 0, false));
|
||||
scrollPane1.setViewportView(ejemplaresTable);
|
||||
final Spacer spacer2 = new Spacer();
|
||||
contentPane.add(spacer2,
|
||||
new GridConstraints(4, 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(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||
null, null, 0, false));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(1, 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));
|
||||
panel1.add(librosCombo,
|
||||
new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(350, -1), null, 0, false));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Libro:");
|
||||
panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Serie:");
|
||||
panel1.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
serieField = new JTextField();
|
||||
serieField.setText("");
|
||||
panel1.add(serieField,
|
||||
new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
agregarButton = new JButton();
|
||||
agregarButton.setText("Agregar");
|
||||
panel1.add(agregarButton, new GridConstraints(4, 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 JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel2, new GridConstraints(3, 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));
|
||||
removerButton = new JButton();
|
||||
removerButton.setText("Remover");
|
||||
panel2.add(removerButton, new GridConstraints(0, 2, 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));
|
||||
guardarButton = new JButton();
|
||||
guardarButton.setText("Guardar");
|
||||
panel2.add(guardarButton, 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));
|
||||
volverButton = new JButton();
|
||||
volverButton.setText("Volver");
|
||||
panel2.add(volverButton, 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));
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
this.librosComboModel = new DefaultComboBoxModel<>();
|
||||
this.librosCombo = new JComboBox<>(this.librosComboModel);
|
||||
|
||||
this.ejemplaresTableModel = new BaseTableModel<>(
|
||||
new String[]{"ISBN", "Titulo", "Precio Referencial", "Serie"},
|
||||
(rows, rowIndex, colIndex) -> {
|
||||
switch (colIndex) {
|
||||
case 0:
|
||||
return rows.get(rowIndex).getLibro().getIsbn();
|
||||
case 1:
|
||||
return rows.get(rowIndex).getLibro().getTitulo();
|
||||
case 2:
|
||||
return rows.get(rowIndex).getLibro().getPrecioReferencia();
|
||||
case 3:
|
||||
return rows.get(rowIndex).getSerie();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.ejemplaresTable = new JTable(this.ejemplaresTableModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user