MyVaadin
MyVaadin will help you write small web applications faster and easier
IMPORTANT NOTICE: This addon has been renamed to MyTableGenerator. Please refere to the new package which has some more features. Sorry for the inconvenience.
Sample code
@Theme("myTheme") public class ExampleUI extends MyUI { @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = ExampleUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(final VaadinRequest request) { // On this version Employee class shall only have persistence annotation on the fields setContent(new GenerateTable(Employee.class)); // Will not include the id column setContent(new GenerateTable(Employee.class, false)); } }
public class ExampleTable extends MyTable { public ExampleTable(TableInfo tableInfo) { super(tableInfo); } @Override public String export2excel() { return null; } @Override public ClickListener saveButtonListener() { return null; } }
@Theme("myTheme") public class ExampleUI extends MyUI { @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = ExampleUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(final VaadinRequest request) { setContent(new ExampleTable(new EmployeeTableInfo())); } }
public class EmployeeTableInfo extends TableInfo { public HolidayTableInfo() { this.setClazz(Employee.class); this.setCaption("Employees"); this.getColumns().add(new MyColumn("firstName", "First Name")); this.getColumns().add(new MyColumn("lastName", "Last Name")); this.getColumns().add(new MyColumn("address.postalCode", "Postal Code")); this.setNestedProperties("address.postalCode"); this.setPopupEditCaption("Employee"); this.setPopupEditWidth(300); this.setPopupEditHeight(300); this.setPopupImportCaption("Import Employees"); this.setPopupImportWidth(500); this.setPopupImportHeight(200); this.setImportable(true); this.setJpaContainer((JPAContainer<Employee>) JPAContainerFactory.make(this.getClazz(), "examplePersistence")); } @Override public MyEdit getEditComponent(Object itemId) { return new EditEmployee(this, itemId); } @Override public MyEdit getNewComponent() { return new EditEmployee(this, null); } @Override public MyImport getImportComponent() { return new ImportEmployee(this); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Debugging some features. For example there were some problem with saving a new generated edit popup.
- Renaming some classes for better understanding of the idea
- No need to necessarily write annotation for persisting classes
- Released
- 2013-07-11
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.0+
- Browser
- Firefox
- Safari
- Google Chrome
- Internet Explorer