Skip to content

Commit

Permalink
Version 3.1.5: Small fixes and fix class name conflict with Tree add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
TatuLund committed Nov 29, 2023
1 parent bf026b0 commit 854f9b7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.vaadin.tatu</groupId>
<artifactId>beantable</artifactId>
<version>3.1.4</version>
<version>3.1.5</version>
<name>BeanTable</name>
<description>Table component for Vaadin platform</description>
<properties>
<vaadin.version>24.1.7</vaadin.version>
<vaadin.version>24.2.2</vaadin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
35 changes: 22 additions & 13 deletions src/main/java/org/vaadin/tatu/BeanTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ void toggleSelection() {
rowElement.getChildren().forEach(
cell -> cell.setAttribute("aria-selected", "true"));
}
fireEvent(new SelectionChangedEvent<>(BeanTable.this, selected,
true));
fireEvent(new BeanTableSelectionChangedEvent<>(BeanTable.this,
selected, true));
}
}

Expand Down Expand Up @@ -1369,7 +1369,7 @@ public Optional<Column<T>> getColumn(String key) {
}

private String randomId(String prefix, int chars) {
int limit = (10 * chars) - 1;
int limit = (int) (Math.pow(10, chars) - 1);
String key = "" + rand.nextInt(limit);
key = String.format("%" + chars + "s", key).replace(' ', '0');
return prefix + "-" + key;
Expand Down Expand Up @@ -1472,8 +1472,8 @@ public void focus(T item) {
* <p>
* Note: If FocusBehavior.NONE used, then does nothing.
*
* @param row
* @param col
* @param row int value
* @param col int value
*/
public void focus(int row, int col) {
if (focusBehavior != FocusBehavior.NONE) {
Expand Down Expand Up @@ -1587,8 +1587,8 @@ public void select(T... items) {
}
if (added) {
getDataProvider().refreshAll();
fireEvent(new SelectionChangedEvent<>(BeanTable.this, selected,
false));
fireEvent(new BeanTableSelectionChangedEvent<>(BeanTable.this,
selected, false));
}
}

Expand All @@ -1609,8 +1609,8 @@ public void deselect(T... items) {
}
if (removed) {
getDataProvider().refreshAll();
fireEvent(new SelectionChangedEvent<>(BeanTable.this, selected,
false));
fireEvent(new BeanTableSelectionChangedEvent<>(BeanTable.this,
selected, false));
}
}

Expand All @@ -1620,8 +1620,8 @@ public void deselect(T... items) {
public void deselectAll() {
if (!selected.isEmpty()) {
selected.clear();
fireEvent(new SelectionChangedEvent<>(BeanTable.this, selected,
false));
fireEvent(new BeanTableSelectionChangedEvent<>(BeanTable.this,
selected, false));
getDataProvider().refreshAll();
}
}
Expand Down Expand Up @@ -1667,8 +1667,9 @@ public void setSelectionEnabled(boolean selectionEnabled) {
*/
@SuppressWarnings("unchecked")
public Registration addSelectionChangedListener(
ComponentEventListener<SelectionChangedEvent<T, BeanTable<T>>> listener) {
return ComponentUtil.addListener(this, SelectionChangedEvent.class,
ComponentEventListener<BeanTableSelectionChangedEvent<T, BeanTable<T>>> listener) {
return ComponentUtil.addListener(this,
BeanTableSelectionChangedEvent.class,
(ComponentEventListener) listener);
}

Expand All @@ -1686,6 +1687,9 @@ public Registration addItemClickedListener(
(ComponentEventListener) listener);
}

/**
* Localization object for BeanTable
*/
@SuppressWarnings("serial")
public static class BeanTableI18n implements Serializable {
private String lastPage;
Expand Down Expand Up @@ -1762,6 +1766,11 @@ public void setPageProvider(
this.pageProvider = provider;
}

/**
* Generate the default English localization.
*
* @return localization object
*/
public static BeanTableI18n getDefault() {
BeanTableI18n english = new BeanTableI18n();
english.setFirstPage("First page");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import com.vaadin.flow.component.ComponentEvent;

@SuppressWarnings({ "serial", "rawtypes" })
public class SelectionChangedEvent<R, C extends BeanTable>
public class BeanTableSelectionChangedEvent<R, C extends BeanTable>
extends ComponentEvent<C> {
private Set<R> selection;

public SelectionChangedEvent(C source, Set<R> selection,
public BeanTableSelectionChangedEvent(C source, Set<R> selection,
boolean fromClient) {
super(source, fromClient);
this.selection = selection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
font-weight: 700;
background: var(--lumo-contrast-5pct);
position: relative;
height: 30px;
height: var(--lumo-size-xs);
}

.bean-table thead tr {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/vaadin/tatu/AbstractViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static String getTestURL(String rootUrl, String... parameters) {
@Before
public void setup() throws Exception {
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
options.addArguments("--headless=new");
setDriver(TestBench.createDriver(new ChromeDriver(options)));
getDriver().get(getURL(route));

Expand Down

0 comments on commit 854f9b7

Please sign in to comment.