Skip to content

Commit

Permalink
Release 0.19.2 ready (#523)
Browse files Browse the repository at this point in the history
#518 #519 done
  • Loading branch information
vaadin-miki authored Sep 6, 2024
1 parent e2ee389 commit d33bc99
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This is the relevant dependency:
<dependency>
<groupId>pl.unforgiven</groupId>
<artifactId>superfields</artifactId>
<version>0.19.1</version>
<version>0.19.2</version>
</dependency>
```

Expand Down
5 changes: 4 additions & 1 deletion demo-v24/frontend/generated/vaadin-featureflags.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ window.Vaadin.featureFlags.exampleFeatureFlag = false;
window.Vaadin.featureFlags.collaborationEngineBackend = false;
window.Vaadin.featureFlags.webPush = false;
window.Vaadin.featureFlags.formFillerAddon = false;
window.Vaadin.featureFlags.reactRouter = false;
window.Vaadin.featureFlags.hillaI18n = false;
window.Vaadin.featureFlags.copilotFlow = false;
window.Vaadin.featureFlags.copilotI18n = false;
window.Vaadin.featureFlags.copilotExperimentalFeatures = false;
export {};
6 changes: 3 additions & 3 deletions demo-v24/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<artifactId>superfields-parent</artifactId>
<groupId>pl.unforgiven</groupId>
<version>0.19.1</version>
<version>0.19.2</version>
</parent>

<artifactId>superfields-demo-v24</artifactId>
<version>0.19.1</version>
<version>0.19.2</version>
<name>V24+ demo app for SuperFields</name>
<description>Showcase application for V24+ and SuperFields.</description>
<packaging>war</packaging>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>pl.unforgiven</groupId>
<artifactId>superfields</artifactId>
<version>0.19.1</version>
<version>0.19.2</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.vaadin.miki.demo.builders;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.combobox.ComboBox;
import org.vaadin.miki.demo.ContentBuilder;
Expand Down Expand Up @@ -30,6 +31,8 @@ public void buildContent(SuperTabs<?> component, Consumer<Component[]> callback)
component.setTabHandler(event.getValue());
});

callback.accept(new Component[]{multilineTabs, tabHandlers});
@SuppressWarnings("unchecked")
final Button tabSelect = new Button("Switch to \"Open source\" tab with .setSelected()", event -> ((SuperTabs<String>)component).getTabHeader("Open source").ifPresent(tab -> tab.setSelected(true)));
callback.accept(new Component[]{multilineTabs, tabHandlers, tabSelect});
}
}
2 changes: 1 addition & 1 deletion demo-v24/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// You might want to change the configurations to fit your preferences
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{
"_version": "9",
"_version": "9.1",
"compilerOptions": {
"sourceMap": true,
"jsx": "react-jsx",
Expand Down
11 changes: 9 additions & 2 deletions demo-v24/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
// This is needed for TypeScript compiler to declare and export as a TypeScript module.
// It is recommended to commit this file to the VCS.
// You might want to change the configurations to fit your preferences
declare module '*.css' {
import { CSSResultGroup } from 'lit';
declare module '*.css?inline' {
import type { CSSResultGroup } from 'lit';
const content: CSSResultGroup;
export default content;
}

// Allow any CSS Custom Properties
declare module 'csstype' {
interface Properties {
[index: `--${string}`]: any;
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pl.unforgiven</groupId>
<artifactId>superfields-parent</artifactId>
<version>0.19.1</version>
<version>0.19.2</version>
<modules>
<module>superfields</module>
<module>demo-v24</module>
Expand All @@ -18,7 +18,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>24.3.12</vaadin.version>
<vaadin.version>24.4.11</vaadin.version>
</properties>

</project>
4 changes: 2 additions & 2 deletions superfields/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<name>SuperFields</name>
<description>Code for various Vaadin 24 fields and other components.</description>
<url>https://www.unforgiven.pl/superfields</url>
<version>0.19.1</version>
<version>0.19.2</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>24.3.12</vaadin.version>
<vaadin.version>24.4.11</vaadin.version>
<maven.jar.plugin.version>3.1.2</maven.jar.plugin.version>
<javadoc.plugin.version>3.4.1</javadoc.plugin.version>
</properties>
Expand Down
9 changes: 8 additions & 1 deletion superfields/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.19.2 - Vaadin 24.4
## New features and enhancements
* \#518 - [selecting a tab programmatically in SuperTabs](https://github.com/vaadin-miki/super-fields/issues/518)
## Changes to API
* \#519 - [Upgrade to Vaadin 24.4](https://github.com/vaadin-miki/super-fields/issues/519)
## Bug fixes
(nothing reported)
# 0.19.1 - Bug fixes
## New features and enhancements
(nothing reported)
Expand Down Expand Up @@ -340,4 +347,4 @@
## Changes to API
(nothing reported)
## Bug fixes
* \#10 - [Max integer length does not work if it is a multiplication of grouping size](https://www.github.com/vaadin-miki/super-fields/issues/10)
* \#10 - [Max integer length does not work if it is a multiplication of grouping size](https://www.github.com/vaadin-miki/super-fields/issues/10)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.tabs.Tab;
import com.vaadin.flow.component.tabs.Tabs;
import com.vaadin.flow.dom.PropertyChangeEvent;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
import org.vaadin.miki.markers.WithIdMixin;
Expand Down Expand Up @@ -207,6 +208,20 @@ protected void addNewTab(T value, Tab tab, Component content, boolean select) {
else
this.updateValue();
}
tab.getElement().addPropertyChangeListener("selected", this::tabSelectedPropertyChanged);
}

private void tabSelectedPropertyChanged(PropertyChangeEvent propertyChangeEvent) {
if(propertyChangeEvent.getPropertyName().equals("selected") &&
(propertyChangeEvent.getOldValue() == null || !Boolean.parseBoolean(propertyChangeEvent.getOldValue().toString())) &&
propertyChangeEvent.getValue() != null &&
Boolean.parseBoolean(propertyChangeEvent.getValue().toString())) {
this.tabsToContents.entrySet().stream()
.filter(entry -> Objects.equals(entry.getKey().getElement(), propertyChangeEvent.getSource()))
.findFirst()
.map(Map.Entry::getKey)
.ifPresent(this.tabs::setSelectedTab);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.vaadin.miki.shared.dates.DatePatterns;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Locale;

public class DatePatternDelegateTest {
Expand Down Expand Up @@ -44,7 +46,8 @@ public void testFormattedValue() {

// now formatted according to locale
raw = this.datePicker.getFormattedValue();
Assert.assertEquals("03.05.1999", raw);
final String formatted = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(this.datePicker.getLocale()).format(expected);
Assert.assertEquals(formatted, raw);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

public class SuperTabsTest {

Expand Down Expand Up @@ -243,4 +244,20 @@ public void testChangingTabHandler() {
}
}

@Test
public void testTabSetSelected() {
final String tabTitle = "foo";
this.tabs.addTab("something", "anything", tabTitle, "another thing");
Assert.assertNotEquals(tabTitle, this.tabs.getValue());
final Optional<Tab> perhapsHeader = this.tabs.getTabHeader(tabTitle);
Assert.assertTrue(perhapsHeader.isPresent());
final Tab tab = perhapsHeader.get();
tab.setSelected(true);
Assert.assertEquals(tabTitle, this.tabs.getValue());

final Tab notThere = new Tab("oh wow");
notThere.setSelected(true);
Assert.assertEquals(tabTitle, this.tabs.getValue());
}

}

0 comments on commit d33bc99

Please sign in to comment.