package xyz.danielcortes.views.libro;

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.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import xyz.danielcortes.models.Autor;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.models.Editorial;
import xyz.danielcortes.models.Idioma;
import xyz.danielcortes.models.Libro;

public class LibroUpdatePanel {

  private JPanel contentPane;
  private JComboBox<Libro> libroCombo;
  private DefaultComboBoxModel<Libro> libroModel;
  private JTextField serieField;
  private JTextField isbnField;
  private JTextField tituloField;
  private JTextField paginasField;
  private JTextField anoPublicacionField;
  private JTextField precioReferenciaField;
  private JList<Idioma> idiomasList;
  private DefaultListModel<Idioma> idiomasModel;
  private JList<Autor> autoresList;
  private DefaultListModel<Autor> autoresModel;
  private JList<Categoria> categoriasList;
  private DefaultListModel<Categoria> categoriasModel;
  private JComboBox<Editorial> editorialCombo;
  private DefaultComboBoxModel<Editorial> editorialModel;
  private JButton actualizarButton;

  public JPanel getContentPane() {
    return contentPane;
  }

  public JComboBox<Libro> getLibroCombo() {
    return libroCombo;
  }

  public DefaultComboBoxModel<Libro> getLibroModel() {
    return libroModel;
  }

  public JTextField getSerieField() {
    return serieField;
  }

  public JTextField getIsbnField() {
    return isbnField;
  }

  public JTextField getTituloField() {
    return tituloField;
  }

  public JTextField getPaginasField() {
    return paginasField;
  }

  public JTextField getAnoPublicacionField() {
    return anoPublicacionField;
  }

  public JTextField getPrecioReferenciaField() {
    return precioReferenciaField;
  }

  public JList<Idioma> getIdiomasList() {
    return idiomasList;
  }

  public DefaultListModel<Idioma> getIdiomasModel() {
    return idiomasModel;
  }

  public JList<Autor> getAutoresList() {
    return autoresList;
  }

  public DefaultListModel<Autor> getAutoresModel() {
    return autoresModel;
  }

  public JList<Categoria> getCategoriasList() {
    return categoriasList;
  }

  public DefaultListModel<Categoria> getCategoriasModel() {
    return categoriasModel;
  }

  public JComboBox<Editorial> getEditorialCombo() {
    return editorialCombo;
  }

  public DefaultComboBoxModel<Editorial> getEditorialModel() {
    return editorialModel;
  }

  public JButton getActualizarButton() {
    return actualizarButton;
  }

  private void createUIComponents() {
    this.createLibroCombo();
    this.createAutoresList();
    this.createCategoriaList();
    this.createEditorialCombo();
    this.createIdiomasList();
  }

  private void createLibroCombo() {
    this.libroModel = new DefaultComboBoxModel<>();
    this.libroCombo = new JComboBox<>(this.libroModel);
  }

  private void createIdiomasList() {
    this.idiomasModel = new DefaultListModel<>();
    this.idiomasList = new JList<>(this.idiomasModel);
    this.idiomasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  }

  private void createAutoresList() {
    this.autoresModel = new DefaultListModel<>();
    this.autoresList = new JList<>(this.autoresModel);
    this.autoresList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  }

  private void createCategoriaList() {
    this.categoriasModel = new DefaultListModel<>();
    this.categoriasList = new JList<>(this.categoriasModel);
    this.categoriasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  }

  private void createEditorialCombo() {
    this.editorialModel = new DefaultComboBoxModel<>();
    this.editorialCombo = new JComboBox<>(this.editorialModel);
  }

  {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
    $$$setupUI$$$();
  }

  /**
   * 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(24, 3, new Insets(10, 10, 10, 10), -1, -1));
    final JLabel label1 = new JLabel();
    label1.setText("Libro:");
    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));
    contentPane.add(libroCombo, 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 label2 = new JLabel();
    label2.setText("Nº Serie:");
    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));
    serieField = new JTextField();
    contentPane.add(serieField, new GridConstraints(3, 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("ISBN:");
    contentPane.add(label3,
        new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    isbnField = new JTextField();
    contentPane.add(isbnField, 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 label4 = new JLabel();
    label4.setText("Titulo:");
    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));
    tituloField = new JTextField();
    contentPane.add(tituloField, 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));
    final JLabel label5 = new JLabel();
    label5.setText("Nº Paginas:");
    contentPane.add(label5,
        new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    paginasField = new JTextField();
    contentPane.add(paginasField, 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("Año Publicacion:");
    contentPane.add(label6,
        new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    anoPublicacionField = new JTextField();
    contentPane.add(anoPublicacionField,
        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 label7 = new JLabel();
    label7.setText("Precio Referencia:");
    contentPane.add(label7,
        new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    precioReferenciaField = new JTextField();
    contentPane.add(precioReferenciaField,
        new GridConstraints(13, 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 label8 = new JLabel();
    label8.setText("Idiomas:");
    contentPane.add(label8,
        new GridConstraints(14, 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(15, 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(idiomasList);
    final JLabel label9 = new JLabel();
    label9.setText("Autores:");
    contentPane.add(label9,
        new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    final JScrollPane scrollPane2 = new JScrollPane();
    contentPane.add(scrollPane2,
        new GridConstraints(17, 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));
    scrollPane2.setViewportView(autoresList);
    final JLabel label10 = new JLabel();
    label10.setText("Categorias:");
    contentPane.add(label10,
        new GridConstraints(18, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    final JScrollPane scrollPane3 = new JScrollPane();
    contentPane.add(scrollPane3,
        new GridConstraints(19, 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));
    scrollPane3.setViewportView(categoriasList);
    final JLabel label11 = new JLabel();
    label11.setText("Editorial:");
    contentPane.add(label11,
        new GridConstraints(20, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
            false));
    contentPane.add(editorialCombo, new GridConstraints(21, 1, 1, 1, GridConstraints.ANCHOR_WEST,
        GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
        GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
    actualizarButton = new JButton();
    actualizarButton.setText("Actualizar");
    contentPane.add(actualizarButton,
        new GridConstraints(22, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    contentPane.add(spacer1, new GridConstraints(23, 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(23, 0, 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(23, 2, 1, 1, GridConstraints.ANCHOR_CENTER,
        GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null,
        0, false));
  }

  /**
   * @noinspection ALL
   */
  public JComponent $$$getRootComponent$$$() {
    return contentPane;
  }

}
