[BAEL-10984-1] - Added new URL for MyUIServlet and updated Grid creation logic

This commit is contained in:
amit2103 2019-07-26 00:26:13 +05:30
parent 367f105fe7
commit 29e2806ade
2 changed files with 54 additions and 5 deletions

View File

@ -0,0 +1,45 @@
package com.baeldung.introduction;
public class Row {
private String column1;
private String column2;
private String column3;
public Row() {
}
public Row(String column1, String column2, String column3) {
super();
this.column1 = column1;
this.column2 = column2;
this.column3 = column3;
}
public String getColumn1() {
return column1;
}
public void setColumn1(String column1) {
this.column1 = column1;
}
public String getColumn2() {
return column2;
}
public void setColumn2(String column2) {
this.column2 = column2;
}
public String getColumn3() {
return column3;
}
public void setColumn3(String column3) {
this.column3 = column3;
}
}

View File

@ -201,10 +201,14 @@ public class VaadinUI extends UI {
TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect");
twinColSelect.setItems(numbers);
Grid grid = new Grid("Grid");
grid.setColumns("Column1", "Column2", "Column3");
grid.setItems("Item1", "Item2", "Item3");
grid.setItems("Item4", "Item5", "Item6");
Grid<Row> grid = new Grid(Row.class);
grid.setColumns("column1", "column2", "column3");
Row row1 = new Row("Item1", "Item2", "Item3");
Row row2 = new Row("Item4", "Item5", "Item6");
List<Row> rows = new ArrayList();
rows.add(row1);
rows.add(row2);
grid.setItems(rows);
Panel panel = new Panel("Panel");
panel.setContent(grid);
@ -271,7 +275,7 @@ public class VaadinUI extends UI {
setContent(verticalLayout);
}
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@WebServlet(urlPatterns = "/VAADIN/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = VaadinUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {
}