add data for cards
This commit is contained in:
@@ -37,19 +37,19 @@ public class ComicView extends VerticalLayout {
|
||||
@Getter
|
||||
Grid<Comic> grid = new Grid<>(Comic.class, false);
|
||||
Grid.Column<Comic> idColumn = grid.addColumn(Comic::getId)
|
||||
.setHeader("ID").setResizable(true).setSortable(true);
|
||||
.setHeader("ID").setResizable(true).setSortable(true);
|
||||
Grid.Column<Comic> createdColumn = grid.addColumn(Comic::getCreatedDate)
|
||||
.setHeader("Erstellt").setResizable(true).setSortable(true);
|
||||
.setHeader("Erstellt").setResizable(true).setSortable(true);
|
||||
Grid.Column<Comic> modifiedColumn = grid.addColumn(Comic::getLastModifiedDate)
|
||||
.setHeader("Geändert").setResizable(true).setSortable(true);
|
||||
.setHeader("Geändert").setResizable(true).setSortable(true);
|
||||
Grid.Column<Comic> titleColumn = grid.addColumn(Comic::getTitle)
|
||||
.setHeader("Titel").setResizable(true).setSortable(true);
|
||||
.setHeader("Titel").setResizable(true).setSortable(true);
|
||||
Grid.Column<Comic> publisherColumn = grid.addColumn(Comic::getPublisherName)
|
||||
.setHeader("Verlag").setResizable(true).setSortable(true);
|
||||
.setHeader("Verlag").setResizable(true).setSortable(true);
|
||||
Grid.Column<Comic> currentOrderColumn = grid.addComponentColumn(comic -> StatusIcon.create(comic.getCurrentOrder()))
|
||||
.setHeader("Bestellung").setWidth("6rem").setSortable(true);
|
||||
.setHeader("Bestellung").setWidth("6rem").setSortable(true);
|
||||
Grid.Column<Comic> completedColumn = grid.addComponentColumn(comic -> StatusIcon.create(comic.getCompleted()))
|
||||
.setHeader("Abgeschlossen").setWidth("6rem").setSortable(true);
|
||||
.setHeader("Abgeschlossen").setWidth("6rem").setSortable(true);
|
||||
TextField filterText = new TextField();
|
||||
@Getter
|
||||
ComicForm form;
|
||||
|
||||
@@ -84,25 +84,25 @@ public class SetupModuleTysc implements ApplicationListener<ContextRefreshedEven
|
||||
Team steelers = createTeamIfNotFound(football, "Pittsburgh Steelers", "Steelers");
|
||||
createTeamIfNotFound(football, "Tennessee Titans", "Titans");
|
||||
createTeamIfNotFound(football, "Denver Broncos", "Broncos");
|
||||
createTeamIfNotFound(football, "Kansas City Chiefs", "Chiefs");
|
||||
createTeamIfNotFound(football, "Oakland Raiders", "Raiders");
|
||||
Team chiefs = createTeamIfNotFound(football, "Kansas City Chiefs", "Chiefs");
|
||||
Team raiders = createTeamIfNotFound(football, "Oakland Raiders", "Raiders");
|
||||
createTeamIfNotFound(football, "San Diego Chargers", "Chargers");
|
||||
createTeamIfNotFound(football, "Seattle Seahawks", "Seahawks");
|
||||
Team seahawks = createTeamIfNotFound(football, "Seattle Seahawks", "Seahawks");
|
||||
createTeamIfNotFound(football, "Arizona Cardinals", "Cardinals");
|
||||
createTeamIfNotFound(football, "Dallas Cowboys", "Cowboys");
|
||||
createTeamIfNotFound(football, "New York Giants", "Giants");
|
||||
createTeamIfNotFound(football, "Philadelphia Eagles", "Eagles");
|
||||
Team cowboys = createTeamIfNotFound(football, "Dallas Cowboys", "Cowboys");
|
||||
Team giants = createTeamIfNotFound(football, "New York Giants", "Giants");
|
||||
Team eagles = createTeamIfNotFound(football, "Philadelphia Eagles", "Eagles");
|
||||
Team redskins = createTeamIfNotFound(football, "Washington Redskins", "Redskins");
|
||||
createTeamIfNotFound(football, "Chicago Bears", "Bears");
|
||||
createTeamIfNotFound(football, "Detroit Lions", "Lions");
|
||||
createTeamIfNotFound(football, "Green Bay Packers", "Packers");
|
||||
createTeamIfNotFound(football, "Minnesota Vikings", "Vikings");
|
||||
createTeamIfNotFound(football, "Tampa Bay Buccaneers", "Buccaneers");
|
||||
createTeamIfNotFound(football, "Atlanta Falcons", "Falcons");
|
||||
Team falcons = createTeamIfNotFound(football, "Atlanta Falcons", "Falcons");
|
||||
createTeamIfNotFound(football, "Carolina Panthers", "Panthers");
|
||||
createTeamIfNotFound(football, "New Orleans Saints", "Saints");
|
||||
createTeamIfNotFound(football, "St.Louis Rams", "Rams");
|
||||
createTeamIfNotFound(football, "San Francisco 49ers", "49ers");
|
||||
Team saints = createTeamIfNotFound(football, "New Orleans Saints", "Saints");
|
||||
Team rams = createTeamIfNotFound(football, "St.Louis Rams", "Rams");
|
||||
Team sf49ers = createTeamIfNotFound(football, "San Francisco 49ers", "49ers");
|
||||
createTeamIfNotFound(football, "Houston Texans", "Texans");
|
||||
createTeamIfNotFound(football, "Houston Oilers", "Oilers");
|
||||
createTeamIfNotFound(baseball, "Baltimore Orioles", "Orioles");
|
||||
@@ -273,34 +273,35 @@ public class SetupModuleTysc implements ApplicationListener<ContextRefreshedEven
|
||||
Player chrisfuamatu = createPlayerIfNotFound("Chris", "Fuamatu-Ma'afala");
|
||||
Player jeromebettis = createPlayerIfNotFound("Jerome", "Bettis");
|
||||
Player kordellstewart = createPlayerIfNotFound("Kordell", "Stewart");
|
||||
createPlayerIfNotFound("Warren", "Moon");
|
||||
createPlayerIfNotFound("Kevin", "Lockett");
|
||||
createPlayerIfNotFound("Rich", "Gannon");
|
||||
createPlayerIfNotFound("James", "Jett");
|
||||
createPlayerIfNotFound("Mack", "Strong");
|
||||
createPlayerIfNotFound("Brock", "Huard");
|
||||
createPlayerIfNotFound("Ricky", "Watters");
|
||||
createPlayerIfNotFound("Troy", "Aikman");
|
||||
createPlayerIfNotFound("David", "LaFleur");
|
||||
createPlayerIfNotFound("Chris", "Brazzell");
|
||||
createPlayerIfNotFound("Ron", "Dayne");
|
||||
createPlayerIfNotFound("Na", "Brown");
|
||||
createPlayerIfNotFound("Torrance", "Small");
|
||||
createPlayerIfNotFound("Chad", "Lewis");
|
||||
createPlayerIfNotFound("Adrian", "Murrell");
|
||||
createPlayerIfNotFound("Chris", "Chandler");
|
||||
createPlayerIfNotFound("Danny", "Kanell");
|
||||
createPlayerIfNotFound("Ricky", "Williams");
|
||||
createPlayerIfNotFound("Jeff", "Garcia");
|
||||
createPlayerIfNotFound("Tai", "Streets");
|
||||
createPlayerIfNotFound("Charlie", "Garner");
|
||||
createPlayerIfNotFound("Drew", "Bledsoe");
|
||||
Player warrenmoon = createPlayerIfNotFound("Warren", "Moon");
|
||||
Player kevinlockett = createPlayerIfNotFound("Kevin", "Lockett");
|
||||
Player richgannon = createPlayerIfNotFound("Rich", "Gannon");
|
||||
Player jamesjett = createPlayerIfNotFound("James", "Jett");
|
||||
Player mackstrong = createPlayerIfNotFound("Mack", "Strong");
|
||||
Player brockhuard = createPlayerIfNotFound("Brock", "Huard");
|
||||
Player rickywatters = createPlayerIfNotFound("Ricky", "Watters");
|
||||
Player troyaikman = createPlayerIfNotFound("Troy", "Aikman");
|
||||
Player davidlafleur = createPlayerIfNotFound("David", "LaFleur");
|
||||
Player chrisbrazzell = createPlayerIfNotFound("Chris", "Brazzell");
|
||||
Player rondayne = createPlayerIfNotFound("Ron", "Dayne");
|
||||
Player nabrowne = createPlayerIfNotFound("Na", "Brown");
|
||||
Player torrancesmall = createPlayerIfNotFound("Torrance", "Small");
|
||||
Player chadlewis = createPlayerIfNotFound("Chad", "Lewis");
|
||||
Player adrianmurrell = createPlayerIfNotFound("Adrian", "Murrell");
|
||||
Player mauricesmith = createPlayerIfNotFound("Maurice", "Smith");
|
||||
Player chrischandler = createPlayerIfNotFound("Chris", "Chandler");
|
||||
Player dannykenell = createPlayerIfNotFound("Danny", "Kanell");
|
||||
Player rickywilliams = createPlayerIfNotFound("Ricky", "Williams");
|
||||
Player jeffgarcia = createPlayerIfNotFound("Jeff", "Garcia");
|
||||
Player taistreets = createPlayerIfNotFound("Tai", "Streets");
|
||||
Player charliegarner = createPlayerIfNotFound("Charlie", "Garner");
|
||||
Player drewbledsoe = createPlayerIfNotFound("Drew", "Bledsoe");
|
||||
createPlayerIfNotFound("Antowain", "Smith");
|
||||
createPlayerIfNotFound("Terry", "Glenn");
|
||||
createPlayerIfNotFound("Jerry", "Rice");
|
||||
createPlayerIfNotFound("Terrell", "Owens");
|
||||
createPlayerIfNotFound("Isaac", "Bruce");
|
||||
createPlayerIfNotFound("Trung", "Canidate");
|
||||
Player jerryrice = createPlayerIfNotFound("Jerry", "Rice");
|
||||
Player terrellowens = createPlayerIfNotFound("Terrell", "Owens");
|
||||
Player isaacbruce = createPlayerIfNotFound("Isaac", "Bruce");
|
||||
Player trungcanidate = createPlayerIfNotFound("Trung", "Canidate");
|
||||
Rooster pathoncoltswr2001 = createRoosterIfNotFound(jeromepathon, colts, wr, 2001);
|
||||
Rooster bruschipatriotslb2001 = createRoosterIfNotFound(bruschi, patriots, lb, 2001);
|
||||
Rooster couchbrownsqb2001 = createRoosterIfNotFound(couch, browns, qb, 2001);
|
||||
@@ -312,6 +313,32 @@ public class SetupModuleTysc implements ApplicationListener<ContextRefreshedEven
|
||||
Rooster chrisfuamatusteelersfb2001 = createRoosterIfNotFound(chrisfuamatu, steelers, fb, 2001);
|
||||
Rooster jeromebettissteelersrb2001 = createRoosterIfNotFound(jeromebettis, steelers, rb, 2001);
|
||||
Rooster kordellstewartsteelersqb2001 = createRoosterIfNotFound(kordellstewart, steelers, qb, 2001);
|
||||
Rooster warrenmoonchiefsqb2001 = createRoosterIfNotFound(warrenmoon, chiefs, qb, 2001);
|
||||
Rooster kevinlockettchiefswr2001 = createRoosterIfNotFound(kevinlockett, chiefs, wr, 2001);
|
||||
Rooster richgannonqbraidersqb2001 = createRoosterIfNotFound(richgannon, raiders, qb, 2001);
|
||||
Rooster jamesjettraiderswr2001 = createRoosterIfNotFound(jamesjett, raiders, wr,2001);
|
||||
Rooster mackstrongseahawksfb2001 = createRoosterIfNotFound(mackstrong, seahawks, fb, 2001);
|
||||
Rooster brockhuardseahawksqb2001 = createRoosterIfNotFound(brockhuard, seahawks, qb, 2001);
|
||||
Rooster rickywattersseahawksrb2001 = createRoosterIfNotFound(rickywatters, seahawks, rb, 2001);
|
||||
Rooster troyaikmancowboysqb2001 = createRoosterIfNotFound(troyaikman, cowboys, qb, 2001);
|
||||
Rooster davidlafleurcowboyste2001 = createRoosterIfNotFound(davidlafleur, cowboys, te, 2001);
|
||||
Rooster chrisbrazzellcowboyswr2001 = createRoosterIfNotFound(chrisbrazzell, cowboys, wr, 2001);
|
||||
Rooster rondaynegiantsrb2001 = createRoosterIfNotFound(rondayne, giants, rb, 2001);
|
||||
Rooster nabrownegiantswr2001 = createRoosterIfNotFound(nabrowne, giants, wr, 2001);
|
||||
Rooster torrancesmalleagleswr2001 = createRoosterIfNotFound(torrancesmall, eagles, wr, 2001);
|
||||
Rooster chadlewiseagleste2001 = createRoosterIfNotFound(chadlewis, eagles, te, 2001);
|
||||
Rooster adrianmurrellredskinsrb2001 = createRoosterIfNotFound(adrianmurrell, redskins, rb, 2001);
|
||||
Rooster mauricesmithfalconsrb2001 = createRoosterIfNotFound(mauricesmith, falcons, rb, 2001);
|
||||
Rooster chrischandlerfalconsqb2001 = createRoosterIfNotFound(chrischandler, falcons, qb, 2001);
|
||||
Rooster dannykanellfalconsqb2001 = createRoosterIfNotFound(dannykenell, falcons, qb, 2001);
|
||||
Rooster rickywilliamssaintsrb2001 = createRoosterIfNotFound(rickywilliams, saints, rb, 2001);
|
||||
Rooster jeffgarcia49ersqb2001 = createRoosterIfNotFound(jeffgarcia, sf49ers, qb, 2001);
|
||||
Rooster taistreets49erswr2001 = createRoosterIfNotFound(taistreets, sf49ers, wr, 2001);
|
||||
Rooster charliegarner49ersrb2001 = createRoosterIfNotFound(charliegarner, sf49ers, rb, 2001);
|
||||
Rooster jerryrice49erswr2001 = createRoosterIfNotFound(jerryrice, sf49ers, wr, 2001);
|
||||
Rooster terrelowens49erswr2001 = createRoosterIfNotFound(terrellowens, sf49ers, wr, 2001);
|
||||
Rooster isaacbruseramswr2001 = createRoosterIfNotFound(isaacbruce, rams, wr, 2001);
|
||||
Rooster trungcanidateramsrb2001 = createRoosterIfNotFound(trungcanidate, rams, rb, 2001);
|
||||
createCardIfNotFound(185, 2001, pacific, pacificbase, pathoncoltswr2001);
|
||||
createCardIfNotFound(250, 2001, pacific, pacificbase, bruschipatriotslb2001);
|
||||
createCardIfNotFound(103, 2001, pacific, pacificbase, couchbrownsqb2001);
|
||||
@@ -322,99 +349,32 @@ public class SetupModuleTysc implements ApplicationListener<ContextRefreshedEven
|
||||
createCardIfNotFound(338, 2001, pacific, pacificbase, chrisfuamatusteelersfb2001);
|
||||
createCardIfNotFound(335, 2001, pacific, pacificbase, jeromebettissteelersrb2001);
|
||||
createCardIfNotFound(345, 2001, pacific, pacificbase, kordellstewartsteelersqb2001);
|
||||
/*
|
||||
* INSERT INTO `spieler` (`ID`,`name`) VALUES
|
||||
* (11,'Moon, Warren'),
|
||||
* (12,'Lockett, Kevin'),
|
||||
* (13,'Gannon, Rich'),
|
||||
* (14,'Jett, James'),
|
||||
* (15,'Strong, Mack'),
|
||||
* (16,'Huard, Brock'),
|
||||
* (17,'Watters, Ricky'),
|
||||
* (18,'Aikman, Troy'),
|
||||
* (19,'LaFleur, David'),
|
||||
* (20,'Brazzell, Chris'),
|
||||
* (21,'Dayne, Ron'),
|
||||
* (22,'Brown, Na'),
|
||||
* (23,'Small, Torrance'),
|
||||
* (24,'Lewis, Chad'),
|
||||
* (25,'Murrell, Adrian'),
|
||||
* (26,'Smith, Maurice'),
|
||||
* (27,'Chandler, Chris'),
|
||||
* (28,'Kanell, Danny')
|
||||
* ,(29,'Williams, Ricky'),
|
||||
* (30,'Garcia, Jeff'),
|
||||
* (31,'Streets, Tai'),
|
||||
* (32,'Garner, Charlie'),
|
||||
* (33,'Rice, Jerry'),
|
||||
* (34,'Owens, Terrell'),
|
||||
* (35,'Bruce, Isaac'),
|
||||
* (36,'Canidate, Trung');
|
||||
*
|
||||
* INSERT INTO `team` (`ID`,`sportart_id`,`name`,`short`) VALUES
|
||||
* (1,1,'Buffalo Bills','Bills'),
|
||||
* (2,1,'Indianapolis Colts','Colts'),
|
||||
* (3,1,'Miami Dolphins','Dolphins'),
|
||||
* (4,1,'New England Patriots','Patriots'),
|
||||
* (5,1,'New York Jets','Jets'),
|
||||
* (6,1,'Baltimore Ravens','Ravens'),
|
||||
* (7,1,'Cincinnati Bengals','Bengals'),
|
||||
* (8,1,'Cleveland Browns','Browns'),
|
||||
* (9,1,'Jacksonville Jaguars','Jaguars'),
|
||||
* (10,1,'Pittsburgh Steelers','Steelers'),
|
||||
* (11,1,'Tennessee Titans','Titans'),
|
||||
* (12,1,'Denver Broncos','Broncos'),
|
||||
* (13,1,'Kansas City Chiefs','Chiefs'),
|
||||
* (14,1,'Oakland Raiders','Raiders'),
|
||||
* (15,1,'San Diego Chargers','Chargers'),
|
||||
* (16,1,'Seattle Seahawks','Seahawks'),
|
||||
* (17,1,'Arizona Cardinals','Cardinals'),
|
||||
* (18,1,'Dallas Cowboys','Cowboys'),
|
||||
* (19,1,'New York Giants','Giants'),
|
||||
* (20,1,'Philadelphia Eagles','Eagles'),
|
||||
* (21,1,'Washington Redskins','Redskins'),
|
||||
* (22,1,'Chicago Bears','Bears'),
|
||||
* (23,1,'Detroit Lions','Lions'),
|
||||
* (24,1,'Green Bay Packers','Packers'),
|
||||
* (25,1,'Minnesota Vikings','Vikings'),
|
||||
* (26,1,'Tampa Bay Buccaneers','Buccaneers'),
|
||||
* (27,1,'Atlanta Falcons','Falcons'),
|
||||
* (28,1,'Carolina Panthers','Panthers');
|
||||
* (29,1,'New Orleans Saints','Saints'),
|
||||
* (30,1,'St.Louis Rams','Rams'),
|
||||
* (31,1,'San Francisco 49ers','49ers'),
|
||||
*
|
||||
* INSERT INTO `karte`
|
||||
* (`ID`,`spieler_id`,`team_id`,`hersteller_id`,`serie_id`,`parallel_id`,`
|
||||
* inserts_id`,`rookie`,`jahr`,`nummer`) VALUES
|
||||
* (11,11,13,1,1,0,0,'N',2001,213),
|
||||
* (12,12,13,1,1,0,0,'N',2001,212),
|
||||
* (13,13,14,1,1,0,0,'N',2001,311),
|
||||
* (14,14,14,1,1,0,0,'N',2001,312),
|
||||
* (15,15,16,1,1,0,0,'N',2001,403),
|
||||
* (16,16,16,1,1,0,0,'N',2001,397),
|
||||
* (17,17,16,1,1,0,0,'N',2001,404),
|
||||
* (18,18,18,1,1,0,0,'N',2001,116),
|
||||
* (19,19,18,1,1,0,0,'N',2001,122),
|
||||
* (20,20,18,1,1,0,0,'N',2001,117),
|
||||
* (21,21,19,1,1,0,0,'N',2001,281),
|
||||
* (22,22,19,1,1,0,0,'N',2001,321),
|
||||
* (23,23,20,1,1,0,0,'N',2001,331),
|
||||
* (24,24,20,1,1,0,0,'N',2001,324),
|
||||
* (25,25,21,1,1,0,0,'N',2001,445),
|
||||
* (26,26,27,1,1,0,0,'N',2001,28),
|
||||
* (27,27,27,1,1,0,0,'N',2001,17),
|
||||
* (28,28,27,1,1,0,0,'N',2001,23),
|
||||
* (29,29,29,1,1,0,0,'N',2001,273);
|
||||
* (30,30,31,1,1,0,0,'N',2001,380),
|
||||
* (31,31,31,1,1,0,0,'N',2001,390),
|
||||
* (32,32,31,1,1,0,0,'N',2001,381),
|
||||
* (33,33,31,1,1,0,0,'N',2001,387),
|
||||
* (34,34,31,1,1,0,0,'N',2001,386),
|
||||
* (35,35,30,1,1,0,0,'N',2001,349),
|
||||
* (36,36,30,1,1,0,0,'N',2001,350),
|
||||
* (37,37,44,5,8,0,0,'N',1994,106);
|
||||
*/
|
||||
createCardIfNotFound(213, 2001, pacific, pacificbase, warrenmoonchiefsqb2001);
|
||||
createCardIfNotFound(212, 2001, pacific, pacificbase, kevinlockettchiefswr2001);
|
||||
createCardIfNotFound(311, 2001, pacific, pacificbase, richgannonqbraidersqb2001);
|
||||
createCardIfNotFound(312, 2001, pacific, pacificbase, jamesjettraiderswr2001);
|
||||
createCardIfNotFound(403, 2001, pacific, pacificbase, mackstrongseahawksfb2001);
|
||||
createCardIfNotFound(397, 2001, pacific, pacificbase, brockhuardseahawksqb2001);
|
||||
createCardIfNotFound(404, 2001, pacific, pacificbase, rickywattersseahawksrb2001);
|
||||
createCardIfNotFound(116, 2001, pacific, pacificbase, troyaikmancowboysqb2001);
|
||||
createCardIfNotFound(122, 2001, pacific, pacificbase, davidlafleurcowboyste2001);
|
||||
createCardIfNotFound(117, 2001, pacific, pacificbase, chrisbrazzellcowboyswr2001);
|
||||
createCardIfNotFound(281, 2001, pacific, pacificbase, rondaynegiantsrb2001);
|
||||
createCardIfNotFound(321, 2001, pacific, pacificbase, nabrownegiantswr2001);
|
||||
createCardIfNotFound(331, 2001, pacific, pacificbase, torrancesmalleagleswr2001);
|
||||
createCardIfNotFound(324, 2001, pacific, pacificbase, chadlewiseagleste2001);
|
||||
createCardIfNotFound(445, 2001, pacific, pacificbase, adrianmurrellredskinsrb2001);
|
||||
createCardIfNotFound(28, 2001, pacific, pacificbase, mauricesmithfalconsrb2001);
|
||||
createCardIfNotFound(17, 2001, pacific, pacificbase, chrischandlerfalconsqb2001);
|
||||
createCardIfNotFound(23, 2001, pacific, pacificbase, dannykanellfalconsqb2001);
|
||||
createCardIfNotFound(273, 2001, pacific, pacificbase, rickywilliamssaintsrb2001);
|
||||
createCardIfNotFound(380, 2001, pacific, pacificbase, jeffgarcia49ersqb2001);
|
||||
createCardIfNotFound(390, 2001, pacific, pacificbase, taistreets49erswr2001);
|
||||
createCardIfNotFound(381, 2001, pacific, pacificbase, charliegarner49ersrb2001);
|
||||
createCardIfNotFound(387, 2001, pacific, pacificbase, jerryrice49erswr2001);
|
||||
createCardIfNotFound(386, 2001, pacific, pacificbase, terrelowens49erswr2001);
|
||||
createCardIfNotFound(349, 2001, pacific, pacificbase, isaacbruseramswr2001);
|
||||
createCardIfNotFound(350, 2001, pacific, pacificbase, trungcanidateramsrb2001);
|
||||
|
||||
alreadySetup = true;
|
||||
moduleService.setDataImported(TyscConstants.TYSC);
|
||||
|
||||
@@ -46,4 +46,17 @@ public class Card extends AbstractEntity {
|
||||
@NotNull
|
||||
@JsonIgnoreProperties({ "cards" })
|
||||
private Rooster rooster;
|
||||
|
||||
public String getVendorName() {
|
||||
return this.vendor.getName();
|
||||
}
|
||||
|
||||
public String getCardSetName() {
|
||||
return this.cardSet.getName();
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return this.rooster.getPlayer().getFullName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.vaadin.flow.component.ComponentEventListener;
|
||||
import com.vaadin.flow.component.Key;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.button.ButtonVariant;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.formlayout.FormLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
@@ -15,12 +16,15 @@ import com.vaadin.flow.data.binder.Binder;
|
||||
|
||||
import de.thpeetz.kontor.tysc.data.Card;
|
||||
import de.thpeetz.kontor.tysc.data.Rooster;
|
||||
import de.thpeetz.kontor.tysc.data.Vendor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CardForm extends FormLayout {
|
||||
|
||||
TextField cardNumber = new TextField("CardNumber");
|
||||
TextField year = new TextField("Year");
|
||||
ComboBox<Vendor> vendor = new ComboBox<>("Vendor");
|
||||
|
||||
Button save = new Button("Save");
|
||||
Button delete = new Button("Delete");
|
||||
@@ -28,11 +32,13 @@ public class CardForm extends FormLayout {
|
||||
|
||||
Binder<Card> binder = new BeanValidationBinder<>(Card.class);
|
||||
|
||||
public CardForm() {
|
||||
public CardForm(List<Vendor> vendors) {
|
||||
addClassName("card-form");
|
||||
binder.bindInstanceFields(this);
|
||||
|
||||
add(cardNumber, createButtonsLayout());
|
||||
vendor.setItems(vendors);
|
||||
vendor.setItemLabelGenerator(Vendor::getName);
|
||||
add(cardNumber, year, vendor, createButtonsLayout());
|
||||
}
|
||||
|
||||
private HorizontalLayout createButtonsLayout() {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package de.thpeetz.kontor.tysc.views;
|
||||
|
||||
import de.thpeetz.kontor.comics.data.Comic;
|
||||
import de.thpeetz.kontor.common.views.StatusIcon;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import com.vaadin.flow.component.Component;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.button.ButtonVariant;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
@@ -13,11 +16,13 @@ import com.vaadin.flow.router.PageTitle;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.spring.annotation.SpringComponent;
|
||||
|
||||
import de.thpeetz.kontor.common.views.ColumnToggleContextMenu;
|
||||
import de.thpeetz.kontor.common.views.MainLayout;
|
||||
import de.thpeetz.kontor.tysc.TyscConstants;
|
||||
import de.thpeetz.kontor.tysc.data.Card;
|
||||
import de.thpeetz.kontor.tysc.services.CardService;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import lombok.Getter;
|
||||
|
||||
@SpringComponent
|
||||
@Scope("prototype")
|
||||
@@ -26,8 +31,30 @@ import jakarta.annotation.security.PermitAll;
|
||||
@PageTitle("Card | Tysc | Kontor")
|
||||
public class CardView extends VerticalLayout {
|
||||
|
||||
Grid<Card> grid = new Grid<>(Card.class);
|
||||
@Getter
|
||||
Grid<Card> grid = new Grid<>(Card.class, false);
|
||||
Grid.Column<Card> idColumn = grid.addColumn(Card::getId).setHeader("ID")
|
||||
.setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> createdColumn = grid.addColumn(Card::getCreatedDate)
|
||||
.setHeader("Erstellt").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> modifiedColumn = grid.addColumn(Card::getLastModifiedDate)
|
||||
.setHeader("Geändert").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> numberColumn = grid.addColumn(Card::getCardNumber)
|
||||
.setHeader("Nummer").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> yearColumn = grid.addColumn(Card::getYear)
|
||||
.setHeader("Jahr").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> vendorColumn = grid.addColumn(Card::getVendorName)
|
||||
.setHeader("Hersteller").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> cardSetColumn = grid.addColumn(Card::getCardSetName)
|
||||
.setHeader("Cardset").setResizable(true).setSortable(true);
|
||||
Grid.Column<Card> insertSetColumn = grid.addComponentColumn(card -> StatusIcon.create(card.getCardSet().isInsertSet()))
|
||||
.setHeader("Inserts").setWidth("6rem").setSortable(true);
|
||||
Grid.Column<Card> parallelSetColumn = grid.addComponentColumn(card -> StatusIcon.create(card.getCardSet().isParallelSet()))
|
||||
.setHeader("Parallels").setWidth("6rem").setSortable(true);
|
||||
|
||||
Grid.Column<Card> playerColumn = grid.addColumn(Card::getPlayerName).setHeader("Spieler").setResizable(true).setSortable(true);
|
||||
TextField filterText = new TextField();
|
||||
@Getter
|
||||
CardForm form;
|
||||
CardService service;
|
||||
|
||||
@@ -42,24 +69,18 @@ public class CardView extends VerticalLayout {
|
||||
updateList();
|
||||
}
|
||||
|
||||
public Grid<Card> getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
||||
private void configureGrid() {
|
||||
grid.addClassName("card-grid");
|
||||
grid.setSizeFull();
|
||||
grid.setColumns("cardNumber", "year", "vendor.name", "cardSet.name", "rooster.player.fullName");
|
||||
grid.getColumns().forEach(col -> col.setAutoWidth(true));
|
||||
grid.asSingleSelect().addValueChangeListener(event -> editCard(event.getValue()));
|
||||
}
|
||||
|
||||
public CardForm getForm() {
|
||||
return form;
|
||||
idColumn.setVisible(false);
|
||||
createdColumn.setVisible(false);
|
||||
modifiedColumn.setVisible(false);
|
||||
}
|
||||
|
||||
private void configureForm() {
|
||||
form = new CardForm();
|
||||
form = new CardForm(service.findAllVendors(null));
|
||||
form.setWidth("25em");
|
||||
form.setVisible(false);
|
||||
form.addSaveListener(this::saveCard);
|
||||
@@ -97,7 +118,19 @@ public class CardView extends VerticalLayout {
|
||||
Button addCardButton = new Button("Add card");
|
||||
addCardButton.addClickListener(click -> addCard());
|
||||
|
||||
HorizontalLayout toolbar = new HorizontalLayout(filterText, addCardButton);
|
||||
Button menuButton = new Button("Show/Hide Columns");
|
||||
menuButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
|
||||
ColumnToggleContextMenu<Card> columnToggleContextMenu = new ColumnToggleContextMenu<>(menuButton);
|
||||
columnToggleContextMenu.addColumnToggleItem(idColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(createdColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(modifiedColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(numberColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(yearColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(vendorColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(cardSetColumn);
|
||||
columnToggleContextMenu.addColumnToggleItem(playerColumn);
|
||||
HorizontalLayout toolbar = new HorizontalLayout(filterText, addCardButton, menuButton);
|
||||
|
||||
toolbar.addClassName("toolbar");
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user