Vaadin has a high quality component set for building mobile and desktop web applications in modern browsers
web-padawan on test-refactor
web-padawan on master
test: refactor and cleanup test… (compare)
yuriy-fix on fix-sorting-filtering-attach
Add tests for new sorting and f… fix: update filtering and sorti… (compare)
@tulioag <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vaadin.trainings.intro</groupId>
<artifactId>exercises-intro</artifactId>
<name>Exercise for Intro</name>
<version>1.0.0</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<vaadin.version>14.0.0</vaadin.version>
<drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Repository used by many Vaadin add-ons -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
<!-- Repository needed for prerelease versions of Vaadin -->
<repository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Repository needed for the snapshot versions of Vaadin -->
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases><enabled>false</enabled></releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
<!-- Repository needed for prerelease versions of Vaadin -->
<pluginRepository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases><enabled>false</enabled></releases>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<type>pom</type>
<scope>import</scope>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin</artifactId>
<exclusions>
<!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
<exclusion>
<groupId>com.vaadin.webjar</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.insites</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymer</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymerelements</groupId>
<ar
mvn jetty:run
to when the command exits.
public class MainView extends VerticalLayout {
private CustomerService service ;
public Customer customer = new Customer();
private Binder<Customer> binder = new Binder<>(Customer.class);
private Grid<Customer> grid = new Grid(Customer.class);
private Button save = new Button("Save", e -> {
try {
binder.writeBean(customer);
saveCustomer();
updateGrid();
binder.readBean(new Customer());
} catch (ValidationException ex) {
ex.printStackTrace();
}
});
public MainView(CustomerService service) {
this.service = service;
add(
new H1("הוסף לקוח"),
buildForm(),
grid
);
updateGrid(); // update the grid with the sql data
setSizeFull();
}
private void saveCustomer() throws ValidationException {
service.update(customer);
}
private Component buildForm() {
TextField firstName = new TextField("First Name");
TextField lastName = new TextField("Last Name");
TextField id = new TextField("ID");
TextField company= new TextField("Company");
TextField address = new TextField("Address");
TextField phone = new TextField("phone");
TextField created = new TextField("created");
TextField email = new TextField("Email");
Div errorsLayout = new Div();
binder.forField(firstName)
.bind(
Customer::getFirstName,Customer::setFirstName
);
binder.forField(lastName)
.bind(
Customer::getLastName,Customer::setLastName
);
Button reload = new Button("reload", e ->{
try{
binder.readBean(customer);
} catch (Exception ex) {
ex.printStackTrace();
}
});
// Configure UI components
save.setThemeName("primary");
// Wrap components in layouts
HorizontalLayout formLayout = new HorizontalLayout(grid,firstName,lastName,save,reload);
Div wrapperLayout = new Div(formLayout, errorsLayout);
formLayout.setDefaultVerticalComponentAlignment(Alignment.BASELINE);
wrapperLayout.setWidth("100%");
grid.setColumnReorderingAllowed(true);
return wrapperLayout;
}
private void updateGrid() {
List<Customer> customers = service.findAll();
grid.setItems(customers);
}
public List<Customer> findAll() {
return jdbcTemplate.query(
"SELECT ID, FirstName, LastName FROM customer",
(rs, rowNum) -> new Customer(rs.getLong("ID"),
rs.getString("FirstName"), rs.getString("LastName")));
}
For example, just having this:
import { TextFieldElement } from '@vaadin/vaadin-text-field/src/vaadin-text-field';
export class AxiansTextField extends TextFieldElement {}
makes
<vaadin-custom-element label="Custom">
<vaadin-text-field></vaadin-text-field>
</vaadin-custom-element>
like this:
extends TextFieldElement
, then the field appears again :open_mouth:
label-suffix
). I’m using the technique of template-injection I’ve seen in the Vaadin’s text-field elements, but I guess I’m missing something: when importing the custom element, original elements break.
TextFieldElement
: the styles get lost in the original field.
src/vaadin-text-field.js
before the styles, styles don’t get applied!
MemoryBuffer buffer = new MemoryBuffer();
Upload upload = new Upload(buffer);
upload.addSucceededListener(e -> {
SecurityContext context = SecurityContextHolder.getContext();
context.getAuthentication(); // null
});
<vaadin-text-field>
would be import '@vaadin/vaadin-text-field/theme/material/vaadin-text-field.js';
. Note that you shouldn't mix Lumo and Material themed Vaadin components on the same page.
material-color-light
instead of material-light-color
.