Muchos cambios

se me fue un poco la onda
pero ahora esta funcionando las vistas de categoria de la misma manera
que la vista de autores

Ademas arregle un error en el que el Set de libros en categoria,
editorial, estado e idioma eran null
This commit is contained in:
Daniel Cortés
2019-05-08 11:35:56 -04:00
parent b9dc5f55c9
commit 1624924708
20 changed files with 515 additions and 377 deletions

View File

@@ -12,9 +12,9 @@ import xyz.danielcortes.controllers.autor.AutorSearchController;
import xyz.danielcortes.controllers.autor.AutorUpdateController;
import xyz.danielcortes.controllers.autor.AutorViewController;
import xyz.danielcortes.controllers.categoria.CategoriaCreateController;
import xyz.danielcortes.controllers.categoria.CategoriaDeleteController;
import xyz.danielcortes.controllers.categoria.CategoriaSearchController;
import xyz.danielcortes.controllers.categoria.CategoriaUpdateController;
import xyz.danielcortes.controllers.categoria.CategoriaViewController;
import xyz.danielcortes.controllers.editorial.EditorialCreateController;
import xyz.danielcortes.controllers.editorial.EditorialDeleteController;
import xyz.danielcortes.controllers.editorial.EditorialListController;
@@ -34,9 +34,9 @@ import xyz.danielcortes.views.autor.AutorSearchPanel;
import xyz.danielcortes.views.autor.AutorUpdatePanel;
import xyz.danielcortes.views.autor.AutorViewPanel;
import xyz.danielcortes.views.categoria.CategoriaCreatePanel;
import xyz.danielcortes.views.categoria.CategoriaDeletePanel;
import xyz.danielcortes.views.categoria.CategoriaSearchPanel;
import xyz.danielcortes.views.categoria.CategoriaUpdatePanel;
import xyz.danielcortes.views.categoria.CategoriaViewPanel;
import xyz.danielcortes.views.editorial.EditorialCreatePanel;
import xyz.danielcortes.views.editorial.EditorialDeletePanel;
import xyz.danielcortes.views.editorial.EditorialListPanel;
@@ -85,8 +85,8 @@ public class LaunchController {
this.controllers.put(PanelName.CATEGORIA_SEARCH, new CategoriaSearchController(new CategoriaSearchPanel(), this));
this.controllers.put(PanelName.CATEGORIA_CREATE, new CategoriaCreateController(new CategoriaCreatePanel(), this));
this.controllers.put(PanelName.CATEGORIA_DELETE, new CategoriaDeleteController(new CategoriaDeletePanel(), this));
this.controllers.put(PanelName.CATEGORIA_UPDATE, new CategoriaUpdateController(new CategoriaUpdatePanel(), this));
this.controllers.put(PanelName.CATEGORIA_VIEW, new CategoriaViewController(new CategoriaViewPanel(), this));
this.controllers.put(PanelName.EDITORIAL_SEARCH, new EditorialListController(new EditorialListPanel(), this));
this.controllers.put(PanelName.EDITORIAL_CREATE, new EditorialCreateController(new EditorialCreatePanel(), this));
@@ -111,8 +111,6 @@ public class LaunchController {
JMenu librosMenu = new JMenu("Libros"); librosMenu.setMnemonic(KeyEvent.VK_L);
JMenuItem libroSearch = new JMenuItem("Buscar"); libroSearch.setMnemonic(KeyEvent.VK_B);
JMenuItem libroCreate = new JMenuItem("Crear"); libroCreate.setMnemonic(KeyEvent.VK_C);
JMenuItem libroUpdate= new JMenuItem("Actualizar"); libroUpdate.setMnemonic(KeyEvent.VK_U);
JMenuItem libroDelete = new JMenuItem("Eliminar"); libroDelete.setMnemonic(KeyEvent.VK_E);
JMenu autoresMenu = new JMenu("Autores"); autoresMenu.setMnemonic(KeyEvent.VK_A);
JMenuItem autorSearch = new JMenuItem("Buscar"); autorSearch.setMnemonic(KeyEvent.VK_B);
@@ -121,20 +119,14 @@ public class LaunchController {
JMenu idiomasMenu = new JMenu("Idiomas"); idiomasMenu.setMnemonic(KeyEvent.VK_I);
JMenuItem idiomaSearch = new JMenuItem("Buscar"); idiomaSearch.setMnemonic(KeyEvent.VK_B);
JMenuItem idiomaCreate = new JMenuItem("Crear"); idiomaCreate.setMnemonic(KeyEvent.VK_C);
JMenuItem idiomaUpdate = new JMenuItem("Actualizar"); idiomaUpdate.setMnemonic(KeyEvent.VK_A);
JMenuItem idiomaDelete = new JMenuItem("Eliminar"); idiomaDelete.setMnemonic(KeyEvent.VK_E);
JMenu categoriasMenu = new JMenu("Categorias"); categoriasMenu.setMnemonic(KeyEvent.VK_C);
JMenuItem categoriaSearch = new JMenuItem("Buscar"); categoriaSearch.setMnemonic(KeyEvent.VK_B);
JMenuItem categoriaCreate = new JMenuItem("Crear"); categoriaCreate.setMnemonic(KeyEvent.VK_C);
JMenuItem categoriaUpdate = new JMenuItem("Actualizar"); categoriaUpdate.setMnemonic(KeyEvent.VK_A);
JMenuItem categoriaDelete = new JMenuItem("Eliminar"); categoriaDelete.setMnemonic(KeyEvent.VK_E);
JMenu editorialesMenu = new JMenu("Editoriales"); editorialesMenu.setMnemonic(KeyEvent.VK_E);
JMenuItem editorialSearch= new JMenuItem("Buscar"); editorialSearch.setMnemonic(KeyEvent.VK_B);
JMenuItem editorialCreate= new JMenuItem("Crear"); editorialCreate.setMnemonic(KeyEvent.VK_C);
JMenuItem editorialUpdate = new JMenuItem("Actualizar"); editorialUpdate.setMnemonic(KeyEvent.VK_A);
JMenuItem editorialDelete = new JMenuItem("Eliminar"); editorialDelete.setMnemonic(KeyEvent.VK_E);
// @formatter:on
autorSearch.addActionListener(e -> this.showCard(PanelName.AUTOR_SEARCH));
@@ -142,29 +134,19 @@ public class LaunchController {
idiomaSearch.addActionListener(e -> this.showCard(PanelName.IDIOMA_SEARCH));
idiomaCreate.addActionListener(e -> this.showCard(PanelName.IDIOMA_CREATE));
idiomaUpdate.addActionListener(e -> this.showCard(PanelName.IDIOMA_UPDATE));
idiomaDelete.addActionListener(e -> this.showCard(PanelName.IDIOMA_DELETE));
libroSearch.addActionListener(e -> this.showCard(PanelName.LIBRO_SEARCH));
libroCreate.addActionListener(e -> this.showCard(PanelName.LIBRO_CREATE));
libroUpdate.addActionListener(e -> this.showCard(PanelName.LIBRO_UPDATE));
libroDelete.addActionListener(e -> this.showCard(PanelName.LIBRO_DELETE));
categoriaSearch.addActionListener(e -> this.showCard(PanelName.CATEGORIA_SEARCH));
categoriaCreate.addActionListener(e -> this.showCard(PanelName.CATEGORIA_CREATE));
categoriaUpdate.addActionListener(e -> this.showCard(PanelName.CATEGORIA_UPDATE));
categoriaDelete.addActionListener(e -> this.showCard(PanelName.CATEGORIA_DELETE));
editorialSearch.addActionListener(e -> this.showCard(PanelName.EDITORIAL_SEARCH));
editorialCreate.addActionListener(e -> this.showCard(PanelName.EDITORIAL_CREATE));
editorialUpdate.addActionListener(e -> this.showCard(PanelName.EDITORIAL_UPDATE));
editorialDelete.addActionListener(e -> this.showCard(PanelName.EDITORIAL_DELETE));
menuBar.add(librosMenu);
librosMenu.add(libroSearch);
librosMenu.add(libroCreate);
librosMenu.add(libroUpdate);
librosMenu.add(libroDelete);
menuBar.add(autoresMenu);
autoresMenu.add(autorSearch);
@@ -173,25 +155,19 @@ public class LaunchController {
menuBar.add(idiomasMenu);
idiomasMenu.add(idiomaSearch);
idiomasMenu.add(idiomaCreate);
idiomasMenu.add(idiomaUpdate);
idiomasMenu.add(idiomaDelete);
menuBar.add(categoriasMenu);
categoriasMenu.add(categoriaSearch);
categoriasMenu.add(categoriaCreate);
categoriasMenu.add(categoriaUpdate);
categoriasMenu.add(categoriaDelete);
menuBar.add(editorialesMenu);
editorialesMenu.add(editorialSearch);
editorialesMenu.add(editorialCreate);
editorialesMenu.add(editorialUpdate);
editorialesMenu.add(editorialDelete);
this.frame.setJMenuBar(menuBar);
}
public void showCard(PanelName name){
public void showCard(PanelName name) {
this.controllers.get(name).show();
this.frame.showCard(name);
}

View File

@@ -106,7 +106,7 @@ public class AutorSearchController extends BaseController {
return null;
}
return this.view.getAutorModel().getRow(this.view.getAutorTable().getSelectedRow());
return this.view.getAutorModel().getRow(selectedRow);
}
public BasePanel getView() {

View File

@@ -1,72 +0,0 @@
package xyz.danielcortes.controllers.categoria;
import java.util.List;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.BaseController;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.repository.CategoriaRepository;
import xyz.danielcortes.views.BasePanel;
import xyz.danielcortes.views.categoria.CategoriaDeletePanel;
public class CategoriaDeleteController extends BaseController {
private CategoriaRepository categoriaRepository;
private CategoriaDeletePanel view;
public CategoriaDeleteController(CategoriaDeletePanel view, LaunchController parent) {
super(parent);
this.view = view;
this.categoriaRepository = new CategoriaRepository();
this.setupListeners();
}
@Override
public void show() {
this.reload();
this.view.getCategoriaCombo().requestFocus();
}
private void setupListeners() {
view.getEliminarButton().addActionListener(e -> delete());
}
private void delete() {
Categoria selected = (Categoria) this.view.getCategoriaCombo().getSelectedItem();
if (!validateCategoria(selected)) return;
this.categoriaRepository.delete(selected);
this.reload();
}
private boolean validateCategoria(Categoria categoria) {
if (categoria == null) {
JOptionPane.showMessageDialog(
this.view.getContentPane(),
"No hay categoria seleccionada",
"Error",
JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
public void reload() {
this.loadCategoriaCombo();
}
private void loadCategoriaCombo() {
List<Categoria> categorias = this.categoriaRepository.getAll();
JComboBox<Categoria> combobox = this.view.getCategoriaCombo();
combobox.removeAllItems();
for (Categoria categoria : categorias) {
combobox.addItem(categoria);
}
}
public BasePanel getView() {
return view;
}
}

View File

@@ -1,15 +1,18 @@
package xyz.danielcortes.controllers.categoria;
import java.util.List;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.BaseController;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseTableModel;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.repository.CategoriaRepository;
import xyz.danielcortes.views.BasePanel;
import xyz.danielcortes.views.categoria.CategoriaSearchPanel;
public class CategoriaSearchController extends BaseController {
private CategoriaRepository categoriaRepository;
private CategoriaSearchPanel view;
@@ -18,20 +21,96 @@ public class CategoriaSearchController extends BaseController {
this.view = view;
this.categoriaRepository = new CategoriaRepository();
this.loadCategoriaTable();
this.setupListeners();
}
@Override
public void show() {
this.reload();
this.view.getCategoriaTable().clearSelection();
}
public void reload() {this.loadCategoriaTable();}
private void setupListeners() {
this.view.getSearchField().addActionListener(e -> this.search());
this.view.getBuscarButton().addActionListener(e -> this.search());
this.view.getVerButton().addActionListener(e -> this.view());
this.view.getEditarButton().addActionListener(e -> this.edit());
this.view.getEliminarButton().addActionListener(e -> this.delete());
}
private void edit() {
Categoria categoria = this.getSelectedCategoria();
if (categoria != null) {
CategoriaUpdateController controller = (CategoriaUpdateController) this.getParentController().getCard(PanelName.CATEGORIA_UPDATE);
controller.setCategoria(categoria);
this.getParentController().showCard(PanelName.CATEGORIA_UPDATE);
}
}
private void delete() {
Categoria categoria = this.getSelectedCategoria();
if (categoria == null)
return;
int option = JOptionPane.showConfirmDialog(
null,
"¿Estas seguro de que deseas eliminar la categoria?",
"Confirmacion",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE
);
if (option == JOptionPane.NO_OPTION)
return;
this.categoriaRepository.delete(categoria);
this.reload();
}
private void view() {
Categoria categoria = this.getSelectedCategoria();
if (categoria != null) {
CategoriaViewController controller = (CategoriaViewController) this.getParentController().getCard(PanelName.CATEGORIA_VIEW);
controller.setCategoria(categoria);
this.getParentController().showCard(PanelName.CATEGORIA_VIEW);
}
}
private void search() {
String term = this.view.getSearchField().getText();
List<Categoria> categorias = this.categoriaRepository.search(term);
this.loadCategoriaTable(categorias);
}
public void reload() {
this.loadCategoriaTable();
}
private void loadCategoriaTable() {
List<Categoria> categorias = this.categoriaRepository.getAll();
this.loadCategoriaTable(categorias);
}
private void loadCategoriaTable(List<Categoria> categorias) {
BaseTableModel<Categoria> model = this.view.getCategoriaModel();
model.setRows(categorias);
}
public BasePanel getView() { return view; }
private Categoria getSelectedCategoria() {
int selectedRow = this.view.getCategoriaTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(
null,
"No hay categoria seleccionada",
"Error",
JOptionPane.ERROR_MESSAGE
);
return null;
}
return this.view.getCategoriaModel().getRow(selectedRow);
}
public BasePanel getView() {
return view;
}
}

View File

@@ -1,10 +1,9 @@
package xyz.danielcortes.controllers.categoria;
import java.util.List;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.BaseController;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.repository.CategoriaRepository;
import xyz.danielcortes.views.BasePanel;
@@ -12,6 +11,7 @@ import xyz.danielcortes.views.categoria.CategoriaUpdatePanel;
public class CategoriaUpdateController extends BaseController {
private Categoria categoria;
private CategoriaUpdatePanel view;
private CategoriaRepository categoriaRepository;
@@ -25,33 +25,34 @@ public class CategoriaUpdateController extends BaseController {
@Override
public void show() {
this.reload();
this.fillCategoria();
this.view.getNombreField().requestFocus();
}
private void fillCategoria() {
if(categoria != null)
this.view.getNombreField().setText(this.categoria.getNombre());
}
private void setupListeners() {
this.view.getCategoriaCombo().addActionListener(e -> {
Categoria selected = (Categoria) view.getCategoriaCombo().getSelectedItem();
if(selected != null)
this.view.getNombreField().setText(selected.getNombre());
});
this.view.getNombreField().addActionListener(e -> this.update());
this.view.getUpdateButton().addActionListener(e -> this.update());
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CATEGORIA_SEARCH));
}
private void update() {
Categoria original = (Categoria) this.view.getCategoriaCombo().getSelectedItem();
if (!validateOriginal(original)) return;
if (!validateOriginal(this.categoria))
return;
String nombre = this.view.getNombreField().getText();
if (!validateNombre(nombre)) return;
if (!validateNombre(nombre))
return;
assert original != null;
original.setNombre(nombre);
categoriaRepository.update(original);
assert this.categoria != null;
this.categoria.setNombre(nombre);
categoriaRepository.update(this.categoria);
this.loadCategoriaCombo();
this.view.getNombreField().requestFocus();
this.getParentController().showCard(PanelName.CATEGORIA_SEARCH);
}
private boolean validateOriginal(Categoria original) {
@@ -85,20 +86,11 @@ public class CategoriaUpdateController extends BaseController {
return true;
}
public void reload() {
this.loadCategoriaCombo();
}
private void loadCategoriaCombo() {
List<Categoria> categorias = this.categoriaRepository.getAll();
JComboBox<Categoria> combobox = this.view.getCategoriaCombo();
combobox.removeAllItems();
for (Categoria categoria : categorias) {
combobox.addItem(categoria);
}
}
public BasePanel getView() {
return view;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
}

View File

@@ -0,0 +1,46 @@
package xyz.danielcortes.controllers.categoria;
import xyz.danielcortes.controllers.BaseController;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.repository.CategoriaRepository;
import xyz.danielcortes.views.BasePanel;
import xyz.danielcortes.views.categoria.CategoriaViewPanel;
public class CategoriaViewController extends BaseController {
private Categoria categoria;
private CategoriaViewPanel view;
private CategoriaRepository categoriaRepository;
public CategoriaViewController(CategoriaViewPanel view, LaunchController parent) {
super(parent);
this.view = view;
this.categoriaRepository = new CategoriaRepository();
this.setupListeners();
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
private void setupListeners() {
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CATEGORIA_SEARCH));
}
private void fillCategoria() {
if(this.categoria != null)
this.view.getNombreField().setText(categoria.getNombre());
}
@Override
public void show() {
this.fillCategoria();
}
@Override
public BasePanel getView() {
return this.view;
}
}

View File

@@ -13,10 +13,10 @@ public enum PanelName {
IDIOMA_UPDATE,
IDIOMA_DELETE,
CATEGORIA_VIEW,
CATEGORIA_SEARCH,
CATEGORIA_CREATE,
CATEGORIA_UPDATE,
CATEGORIA_DELETE,
EDITORIAL_SEARCH,
EDITORIAL_CREATE,
@@ -27,5 +27,4 @@ public enum PanelName {
AUTOR_SEARCH,
AUTOR_CREATE,
AUTOR_UPDATE,
AUTOR_DELETE
}

View File

@@ -1,5 +1,6 @@
package xyz.danielcortes.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -41,6 +42,9 @@ public class Categoria {
}
public Set<Libro> getLibros() {
if (this.libros == null) {
this.libros = new HashSet<>();
}
return libros;
}

View File

@@ -1,5 +1,6 @@
package xyz.danielcortes.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -40,7 +41,10 @@ public class Editorial {
this.nombre = nombre;
}
public Set<Libro> getLibros() {
public Set<Libro> getLibros() {
if (this.libros == null) {
this.libros = new HashSet<>();
}
return libros;
}

View File

@@ -1,5 +1,6 @@
package xyz.danielcortes.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -14,7 +15,7 @@ import javax.persistence.Table;
public class Estado {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Integer id;
@@ -41,6 +42,9 @@ public class Estado {
}
public Set<Libro> getLibros() {
if (this.libros == null) {
this.libros = new HashSet<>();
}
return libros;
}

View File

@@ -1,5 +1,6 @@
package xyz.danielcortes.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -41,6 +42,9 @@ public class Idioma {
}
public Set<Libro> getLibros() {
if (this.libros == null) {
this.libros = new HashSet<>();
}
return libros;
}

View File

@@ -3,14 +3,16 @@
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" 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="500" height="400"/>
<xy x="20" y="20" width="484" height="174"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e85e9" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" 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="Guardar"/>
@@ -37,14 +39,14 @@
<grid row="3" 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="3214d">
<constraints>
<grid row="2" 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="e47b1">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
<hspacer id="3214d">
<constraints>
<grid row="3" 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>
</children>

View File

@@ -38,8 +38,7 @@ public class CategoriaCreatePanel extends BasePanel {
}
/**
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
* call it in your code!
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
@@ -48,32 +47,29 @@ public class CategoriaCreatePanel extends BasePanel {
contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1));
guardarButton = new JButton();
guardarButton.setText("Guardar");
contentPane.add(guardarButton,
new GridConstraints(2, 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));
contentPane.add(guardarButton, new GridConstraints(2, 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 JLabel label1 = new JLabel();
label1.setText("Nombre:");
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(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
nombreField = new JTextField();
contentPane.add(nombreField, 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));
contentPane.add(nombreField,
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));
final Spacer spacer1 = new Spacer();
contentPane.add(spacer1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0,
false));
contentPane.add(spacer1,
new GridConstraints(3, 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(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER,
GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null,
0, false));
contentPane.add(spacer2,
new GridConstraints(3, 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(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null,
0, false));
contentPane.add(spacer3,
new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
null, null, 0, false));
}
/**

View File

@@ -1,98 +0,0 @@
package xyz.danielcortes.views.categoria;
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 xyz.danielcortes.models.Categoria;
import xyz.danielcortes.views.BasePanel;
public class CategoriaDeletePanel extends BasePanel {
private JComboBox<Categoria> categoriaCombo;
private DefaultComboBoxModel<Categoria> categoriaModel;
private JButton eliminarButton;
private JPanel contentPane;
public JComboBox<Categoria> getCategoriaCombo() {
return categoriaCombo;
}
public JButton getEliminarButton() {
return eliminarButton;
}
public JPanel getContentPane() {
return contentPane;
}
private void createUIComponents() {
createCategoriaCombo();
}
private void createCategoriaCombo() {
categoriaModel = new DefaultComboBoxModel<>();
categoriaCombo = new JComboBox<>(categoriaModel);
}
{
// 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(4, 3, new Insets(20, 20, 20, 20), -1, -1));
contentPane.add(categoriaCombo, 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));
eliminarButton = new JButton();
eliminarButton.setText("Eliminar");
contentPane.add(eliminarButton,
new GridConstraints(2, 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 JLabel label1 = new JLabel();
label1.setText("Categoria:");
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(3, 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(2, 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(2, 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;
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaSearchPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<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"/>
@@ -10,7 +10,7 @@
<children>
<scrollpane id="cac09">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<grid row="1" column="0" 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>
@@ -23,6 +23,74 @@
</component>
</children>
</scrollpane>
<grid id="deefa" 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="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="5265e" class="javax.swing.JButton" binding="verButton" 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="Ver"/>
</properties>
</component>
<component id="6eeed" class="javax.swing.JButton" binding="editarButton" 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="Editar"/>
</properties>
</component>
<component id="c46ae" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<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="Eliminar"/>
</properties>
</component>
</children>
</grid>
<grid id="2a83c" 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="d844f" class="javax.swing.JTextField" binding="searchField">
<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>
<component id="25699" 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="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Buscar"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@@ -4,10 +4,13 @@ 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.BaseTableModel;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.views.BasePanel;
@@ -16,8 +19,14 @@ public class CategoriaSearchPanel extends BasePanel {
private JPanel contentPane;
private JTable categoriaTable;
private JButton verButton;
private JButton editarButton;
private JButton eliminarButton;
private JTextField searchField;
private JButton buscarButton;
private BaseTableModel<Categoria> categoriaModel;
@Override
public JPanel getContentPane() {
return contentPane;
}
@@ -26,6 +35,26 @@ public class CategoriaSearchPanel extends BasePanel {
return categoriaTable;
}
public JButton getVerButton() {
return verButton;
}
public JButton getEditarButton() {
return editarButton;
}
public JButton getEliminarButton() {
return eliminarButton;
}
public JTextField getSearchField() {
return searchField;
}
public JButton getBuscarButton() {
return buscarButton;
}
public BaseTableModel<Categoria> getCategoriaModel() {
return categoriaModel;
}
@@ -48,6 +77,7 @@ public class CategoriaSearchPanel extends BasePanel {
);
// @formatter:on
this.categoriaTable = new JTable(this.categoriaModel);
this.categoriaTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
{
@@ -58,22 +88,53 @@ public class CategoriaSearchPanel extends BasePanel {
}
/**
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
* call it in your code!
* 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(1, 1, new Insets(20, 20, 20, 20), -1, -1));
contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(20, 20, 20, 20), -1, -1));
final JScrollPane scrollPane1 = new JScrollPane();
contentPane.add(scrollPane1,
new GridConstraints(0, 0, 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));
contentPane.add(scrollPane1, new GridConstraints(1, 0, 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(categoriaTable);
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, 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");
panel1.add(verButton, 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));
editarButton = new JButton();
editarButton.setText("Editar");
panel1.add(editarButton, 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));
eliminarButton = new JButton();
eliminarButton.setText("Eliminar");
panel1.add(eliminarButton, 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));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel2, 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));
searchField = new JTextField();
panel2.add(searchField,
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));
buscarButton = new JButton();
buscarButton.setText("Buscar");
panel2.add(buscarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
null, 0, false));
}
/**
@@ -82,4 +143,5 @@ public class CategoriaSearchPanel extends BasePanel {
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}

View File

@@ -1,68 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" 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="484" height="214"/>
<xy x="20" y="20" width="270" height="183"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="ecc19" 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="Categoria:"/>
</properties>
</component>
<component id="8461f" 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"/>
<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="Nombre:"/>
</properties>
</component>
<component id="bc042" class="javax.swing.JButton" binding="updateButton">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<vspacer id="e4bef">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
<component id="4860e" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="3" 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="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="7136a" class="javax.swing.JComboBox" binding="categoriaCombo" custom-create="true">
<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"/>
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<hspacer id="bef66">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
<hspacer id="12110">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
<grid id="94adc" 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="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="bc042" class="javax.swing.JButton" binding="updateButton">
<constraints>
<grid row="0" column="0" 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="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<component id="6761c" 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="1" 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>

View File

@@ -5,24 +5,21 @@ 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.JTextField;
import xyz.danielcortes.models.Categoria;
import xyz.danielcortes.views.BasePanel;
public class CategoriaUpdatePanel extends BasePanel {
private JPanel contentPane;
private JTextField nombreField;
private JComboBox<Categoria> categoriaCombo;
private DefaultComboBoxModel<Categoria> categoriaModel;
private JButton updateButton;
private JButton volverButton;
@Override
public JPanel getContentPane() {
return contentPane;
}
@@ -31,22 +28,14 @@ public class CategoriaUpdatePanel extends BasePanel {
return nombreField;
}
public JComboBox<Categoria> getCategoriaCombo() {
return categoriaCombo;
}
public JButton getUpdateButton() {
return updateButton;
}
private void createUIComponents() {
this.createCategoriaCombo();
public JButton getVolverButton() {
return volverButton;
}
private void createCategoriaCombo() {
this.categoriaModel = new DefaultComboBoxModel<>();
this.categoriaCombo = new JComboBox<>(this.categoriaModel);
}
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
@@ -56,52 +45,48 @@ public class CategoriaUpdatePanel extends BasePanel {
}
/**
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
* call it in your code!
* 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(6, 3, new Insets(20, 20, 20, 20), -1, -1));
contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1));
final JLabel label1 = new JLabel();
label1.setText("Categoria:");
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 JLabel label2 = new JLabel();
label2.setText("Nombre:");
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));
label1.setText("Nombre:");
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(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
null, null, 0, false));
nombreField = new JTextField();
contentPane.add(nombreField,
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final Spacer spacer2 = new Spacer();
contentPane.add(spacer2,
new GridConstraints(3, 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(3, 2, 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(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, 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));
updateButton = new JButton();
updateButton.setText("Actualizar");
contentPane.add(updateButton,
new GridConstraints(4, 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(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0,
false));
nombreField = new JTextField();
contentPane.add(nombreField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST,
GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
contentPane.add(categoriaCombo, 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));
final Spacer spacer2 = new Spacer();
contentPane.add(spacer2, new GridConstraints(5, 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(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER,
GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null,
0, false));
panel1.add(updateButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
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");
panel1.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
null, 0, false));
}
/**
@@ -110,4 +95,5 @@ public class CategoriaUpdatePanel extends BasePanel {
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}

View File

@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaDeletePanel">
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaViewPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" 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="504" height="154"/>
<xy x="20" y="20" width="484" height="154"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c9fc7" class="javax.swing.JComboBox" binding="categoriaCombo" custom-create="true">
<component id="c6263" 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="Nombre:"/>
</properties>
</component>
<component id="9c8d2" class="javax.swing.JTextField" binding="nombreField">
<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"/>
@@ -16,35 +24,27 @@
</constraints>
<properties/>
</component>
<component id="8fa01" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<component id="c23eb" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" 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="Eliminar"/>
<text value="Volver"/>
</properties>
</component>
<component id="8c3f8" 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="Categoria:"/>
</properties>
</component>
<vspacer id="ceef0">
<vspacer id="37ee">
<constraints>
<grid row="3" 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="55d28">
<hspacer id="75159">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" 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="8640e">
<hspacer id="eceff">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
</children>

View File

@@ -0,0 +1,80 @@
package xyz.danielcortes.views.categoria;
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.JTextField;
import xyz.danielcortes.views.BasePanel;
public class CategoriaViewPanel extends BasePanel {
private JPanel contentPane;
private JTextField nombreField;
private JButton volverButton;
public JPanel getContentPane() {
return contentPane;
}
public JTextField getNombreField() {
return nombreField;
}
public JButton getVolverButton() {
return volverButton;
}
{
// 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$$$() {
contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1));
final JLabel label1 = new JLabel();
label1.setText("Nombre:");
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));
nombreField = new JTextField();
contentPane.add(nombreField,
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));
volverButton = new JButton();
volverButton.setText("Volver");
contentPane.add(volverButton, new GridConstraints(2, 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 Spacer spacer1 = new Spacer();
contentPane.add(spacer1,
new GridConstraints(3, 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(3, 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(3, 0, 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;
}
}