Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.9.0 ready #219

Merged
merged 66 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
66c3c12
#100 development branch with snapshot version set up
vaadin-miki May 4, 2020
d50a607
#100 ready (#101)
vaadin-miki May 7, 2020
85009d5
#105 fixed
vaadin-miki May 7, 2020
2ce9a58
#108 set up in a separate profile (#109)
vaadin-miki May 12, 2020
ac137aa
automated release notes (#110)
vaadin-miki May 12, 2020
5a61be5
#111 done
vaadin-miki May 12, 2020
06212f3
Merge pull request #112 from vaadin-miki/111-run-sonar-more-often
vaadin-miki May 12, 2020
aa302b5
#113 done
vaadin-miki May 12, 2020
06374ab
Merge pull request #114 from vaadin-miki/113-sonar-and-github-token
vaadin-miki May 12, 2020
bfcb333
#115 done
vaadin-miki May 12, 2020
7c824e4
Merge pull request #116 from vaadin-miki/115-no-shallow-clone
vaadin-miki May 12, 2020
b62bf69
#117 done
vaadin-miki May 13, 2020
82bbb44
#119 hopefully done, needs merging and testing (#120)
vaadin-miki May 25, 2020
8cb6b86
#22 and #124 done (#125)
vaadin-miki May 25, 2020
b833449
#126, #127, #129 done (#128)
vaadin-miki May 28, 2020
88f970e
#132 done (#133)
vaadin-miki May 29, 2020
3e2429e
122 super text field (#134)
vaadin-miki Jun 1, 2020
c50f655
#136 done
vaadin-miki Jun 2, 2020
396c8fe
Merge pull request #138 from vaadin-miki/136-fixed-setreadonly-for-nu…
vaadin-miki Jun 2, 2020
5601d60
#137 done (#140)
vaadin-miki Jun 2, 2020
9c89b31
123 text selection api (#142)
vaadin-miki Jun 4, 2020
df8cdf5
#139 done (#144)
vaadin-miki Jun 5, 2020
292cf82
#143 done (#145)
vaadin-miki Jun 5, 2020
bfc1641
#135 and #146 done (#148)
vaadin-miki Jun 5, 2020
39a3755
#147 done (#149)
vaadin-miki Jun 5, 2020
4cbaffe
#152 done (#153)
vaadin-miki Jun 8, 2020
d6931a3
Bump websocket-extensions from 0.1.3 to 0.1.4 in /demo-v14 (#151)
dependabot[bot] Jun 8, 2020
7d9efbf
#154 fixed (#155)
vaadin-miki Jun 9, 2020
c1be9fe
#131 could it be this simple?
vaadin-miki Jun 10, 2020
01efd91
Merge pull request #158 from vaadin-miki/131-conflict-resolving
vaadin-miki Jun 10, 2020
f9d1431
131 conflict resolving (#164)
vaadin-miki Jun 16, 2020
89c6bd3
#131 using separate step with PR for notes (with automatic merge) (#165)
vaadin-miki Jun 17, 2020
47f03a6
#131 using delayed merge action (#167)
vaadin-miki Jun 21, 2020
ac39ffa
(bot) release notes updated for 0.7.0
vaadin-miki Jun 21, 2020
5222ef1
automatic merge of PR #168
github-actions[bot] Jun 21, 2020
ab9bcca
#171 DatePattern now in a separate package (#172)
vaadin-miki Jun 22, 2020
c3a8281
173 threadlocal unload observer (#175)
vaadin-miki Jun 25, 2020
58ffe02
#170 done (#177)
vaadin-miki Jun 26, 2020
cbcfca6
#178 UnloadObserver is now UI-scoped singleton (#179)
vaadin-miki Jul 1, 2020
187eb88
(bot) release notes updated for 0.7.1
vaadin-miki Jul 1, 2020
e4a3335
automatic merge of PR #180
github-actions[bot] Jul 1, 2020
9aef510
done #182 and #183
vaadin-miki Jul 3, 2020
dd837d7
#174 done (#185)
vaadin-miki Jul 4, 2020
e70d813
(bot) release notes updated for 0.7.2
vaadin-miki Jul 4, 2020
36dd05a
automatic merge of PR #186
github-actions[bot] Jul 4, 2020
677592f
#188 fixes to automated release-notes.md creation (#190)
vaadin-miki Jul 6, 2020
7314c22
#189 done, #191 fixed in the process (#192)
vaadin-miki Jul 6, 2020
558f31e
#188 fixed wrong path (#193)
vaadin-miki Jul 6, 2020
8b04d63
(bot) release notes updated for 0.7.3
vaadin-miki Jul 6, 2020
6ffa1e0
automatic merge of PR #194
github-actions[bot] Jul 6, 2020
7630686
#160 done (#197)
vaadin-miki Jul 8, 2020
6bf0427
#196 done (#198)
vaadin-miki Jul 8, 2020
21a4e7e
#199 fixed (#200)
vaadin-miki Jul 22, 2020
e382394
#201 done (#202)
vaadin-miki Jul 24, 2020
f8a2eb1
(bot) release notes updated for 0.8.0
vaadin-miki Jul 27, 2020
34fa62d
automatic merge of PR #203
github-actions[bot] Jul 27, 2020
fca71dd
Removing beforeunload EventListener on detach (#207)
vaadin-miki Jul 28, 2020
c4d4c19
#208 added contributors to README
vaadin-miki Jul 28, 2020
92f74a1
GridSelect (#213)
vaadin-miki Aug 24, 2020
8e1fc7b
#214 seems done (#215)
vaadin-miki Aug 24, 2020
f2ab4ef
super date (time) picker now optionally always accepts short year (#217)
vaadin-miki Aug 24, 2020
0366d0a
(bot) release notes updated for 0.9.0
vaadin-miki Aug 27, 2020
8801399
automatic merge of PR #218
github-actions[bot] Aug 27, 2020
aaa2bba
(bot) version updated to 0.9.0
vaadin-miki Aug 27, 2020
3f3c436
Merge branch 'master' into release-0.9.0
vaadin-miki Aug 27, 2020
f4c47ff
pom.xml dependency changed to 0.9.0
vaadin-miki Aug 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This is the relevant dependency:
<dependency>
<groupId>org.vaadin.miki</groupId>
<artifactId>superfields</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
</dependency>
```

Expand Down Expand Up @@ -47,6 +47,20 @@ This repository has a branch `java-8` which contains the most recent release com

You are more than welcome to contribute. Feel free to make PRs, submit issues, ideas etc.

### Contributors

The author of the majority of the code is Miki, but this project would not be possible without these wonderful people - listed in alphabetical order:

* Wolfgang Fischlein
* Jean-Christophe Gueriaud
* Holger Hähnel
* Gerald Koch
* Sebastian Kühnau
* Jean-François Lamy
* Stuart Robinson
* Kaspar Scherrer
* Tomi Virkki

## Small print

All components are provided "as is", with no warranty or liability. See license for details.
6 changes: 3 additions & 3 deletions demo-v14/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<artifactId>superfields-parent</artifactId>
<groupId>org.vaadin.miki</groupId>
<version>0.8.0</version>
<version>0.9.0</version>
</parent>

<artifactId>superfields-demo-v14</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
<name>V14 demo app for SuperFields</name>
<description>Showcase application for V14 and SuperFields.</description>
<packaging>war</packaging>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>org.vaadin.miki</groupId>
<artifactId>superfields</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down
11 changes: 9 additions & 2 deletions demo-v14/src/main/java/org/vaadin/miki/DemoComponentFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.vaadin.miki.superfields.buttons.SimpleButtonState;
import org.vaadin.miki.superfields.dates.SuperDatePicker;
import org.vaadin.miki.superfields.dates.SuperDateTimePicker;
import org.vaadin.miki.superfields.gridselect.GridSelect;
import org.vaadin.miki.superfields.itemgrid.ItemGrid;
import org.vaadin.miki.superfields.lazyload.ComponentObserver;
import org.vaadin.miki.superfields.lazyload.LazyLoad;
Expand All @@ -53,6 +54,7 @@
import org.vaadin.miki.superfields.text.SuperTextField;
import org.vaadin.miki.superfields.unload.UnloadObserver;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
Expand All @@ -63,13 +65,14 @@
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
* Stores information about components to demo.
* @author miki
* @since 2020-07-04
*/
public final class DemoComponentFactory {
public final class DemoComponentFactory implements Serializable {

private static final int NOTIFICATION_TIME = 1500;

Expand Down Expand Up @@ -126,6 +129,8 @@ private DemoComponentFactory() {
new SimpleButtonState("Are you sure?", VaadinIcon.INFO_CIRCLE.create()),
new SimpleButtonState("Really navigate away?", VaadinIcon.INFO.create()).withThemeVariant(ButtonVariant.LUMO_ERROR)
).withId("multi-click-button"));
final GridSelect<SuperFieldsGridItem> gridSelect = new GridSelect<>(SuperFieldsGridItem.class, true);
this.components.put(GridSelect.class, gridSelect); // note: extra config below to include all fields
this.components.put(ComponentObserver.class, new ComponentObserver());
this.components.put(UnloadObserver.class, UnloadObserver.get().withoutQueryingOnUnload());
this.components.put(ItemGrid.class, new ItemGrid<Class<? extends Component>>(
Expand Down Expand Up @@ -157,6 +162,8 @@ private DemoComponentFactory() {
return result;
})
);
gridSelect.getGrid().getColumnByKey("nameLength").setAutoWidth(true);
gridSelect.setItems(this.components.keySet().stream().map(SuperFieldsGridItem::new).collect(Collectors.toList()));

this.contentBuilders.put(CanSelectText.class, this::buildCanSelectText);
this.contentBuilders.put(HasValue.class, this::buildHasValue);
Expand Down Expand Up @@ -296,7 +303,7 @@ private void buildItemGrid(Component component, Consumer<Component[]> callback)
private void buildHasDatePattern(Component component, Consumer<Component[]> callback) {
final ComboBox<DatePattern> patterns = new ComboBox<>("Select date display pattern:",
DatePatterns.YYYY_MM_DD, DatePatterns.M_D_YYYY_SLASH,
DatePatterns.DD_MM_YYYY_DOTTED, DatePatterns.D_M_YY_DOTTED,
DatePatterns.DD_MM_YYYY_DOTTED, DatePatterns.DD_MM_YY_OR_YYYY_DOTTED, DatePatterns.D_M_YY_DOTTED,
DatePatterns.YYYYMMDD, DatePatterns.DDMMYY
);
final Button clearPattern = new Button("Clear pattern", event -> ((HasDatePattern)component).setDatePattern(null));
Expand Down
24 changes: 17 additions & 7 deletions demo-v14/src/main/java/org/vaadin/miki/DemoPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import com.vaadin.flow.router.HasUrlParameter;
import com.vaadin.flow.router.Route;

import java.util.HashMap;
import java.util.Map;

/**
* Page that shows a demo of a component.
* @author miki
Expand All @@ -18,24 +21,31 @@ public class DemoPage extends VerticalLayout implements HasUrlParameter<String>,

private final DemoComponentFactory demoComponentFactory = DemoComponentFactory.get();

private final Map<String, Component> pages = new HashMap<>();

private Class<? extends Component> componentType;

@Override
public void setParameter(BeforeEvent event, String parameter) {
this.removeAll();
this.demoComponentFactory.getDemoableComponentTypes().stream()
.filter(type -> type.getSimpleName().equalsIgnoreCase(parameter))
.findFirst().ifPresentOrElse(this::buildDemoPageFor, this::buildErrorPage);

this.add(this.pages.computeIfAbsent(parameter, s ->
this.demoComponentFactory.getDemoableComponentTypes().stream()
.filter(type -> type.getSimpleName().equalsIgnoreCase(s))
.findFirst()
.map(this::buildDemoPageFor)
.orElseGet(this::buildErrorPage)
));
}

private void buildDemoPageFor(Class<? extends Component> type) {
private Component buildDemoPageFor(Class<? extends Component> type) {
this.componentType = type;
this.add(this.demoComponentFactory.buildDemoPageFor(type));
return this.demoComponentFactory.buildDemoPageFor(type);
}

private void buildErrorPage() {
private Component buildErrorPage() {
this.componentType = null;
this.add(new Span("You are seeing this because there was a problem in navigating to the demo page for your selected component."));
return new Span("You are seeing this because there was a problem in navigating to the demo page for your selected component.");
}

@Override
Expand Down
36 changes: 36 additions & 0 deletions demo-v14/src/main/java/org/vaadin/miki/SuperFieldsGridItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.vaadin.miki;

/**
* Simple data class to showcase in grid select demo.
* @author miki
* @since 2020-08-07
*/
// needs to be public, otherwise grid cannot access it
public class SuperFieldsGridItem {

private final int nameLength;

private String name;

SuperFieldsGridItem(Class<?> type) {
this.name = type.getSimpleName();
this.nameLength = this.name.length();
}

public int getNameLength() {
return this.nameLength;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public String toString() {
return this.name;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.vaadin.miki</groupId>
<artifactId>superfields-parent</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
<modules>
<module>superfields</module>
<module>demo-v14</module>
Expand Down
2 changes: 1 addition & 1 deletion superfields/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<artifactId>superfields</artifactId>
<name>SuperFields</name>
<description>Code for various V14+ fields and other components.</description>
<version>0.8.0</version>
<version>0.9.0</version>

<properties>
<maven.compiler.source>10</maven.compiler.source>
Expand Down
10 changes: 10 additions & 0 deletions superfields/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 0.9.0 - GridSelect
## New features and enhancements
* \#211 - [GridSelect](https://github.com/vaadin-miki/super-fields/issues/211)
* \#212 - [Date pickers should have an option to always accept short year as input](https://github.com/vaadin-miki/super-fields/issues/212)
## Changes to API
(nothing reported)
## Bug fixes
* \#206 - [Client-side listener for UnloadObserver is not cleared when navigating away](https://github.com/vaadin-miki/super-fields/issues/206)
* \#214 - [Demo app events are triggered multiple times](https://github.com/vaadin-miki/super-fields/issues/214)
* \#216 - [Year calculation in date pickers for short year is incorrect](https://github.com/vaadin-miki/super-fields/issues/216)
# 0.8.0 - MultiClickButton
## New features and enhancements
* \#160 - [Confirm-on-click button](https://github.com/vaadin-miki/super-fields/issues/160)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public enum Order {DAY_MONTH_YEAR, MONTH_DAY_YEAR, YEAR_MONTH_DAY}

private boolean previousCenturyBelowBoundary = false;

private boolean shortYearAlwaysAccepted = false;

private Order displayOrder = Order.YEAR_MONTH_DAY;

/**
Expand Down Expand Up @@ -316,6 +318,37 @@ public DatePattern withPreviousCenturyBelowBoundary(boolean belowBoundaryIsPrevi
return this;
}

/**
* Allows short year to be always accepted as input.
* @param shortYearAlwaysAccepted When {@code true}, short year can always be entered and will be parsed properly and displayed as full year.
* @see #setBaseCentury(int)
* @see #setCenturyBoundaryYear(int)
* @see #setPreviousCenturyBelowBoundary(boolean)
* @see #setShortYear(boolean)
*/
public void setShortYearAlwaysAccepted(boolean shortYearAlwaysAccepted) {
this.shortYearAlwaysAccepted = shortYearAlwaysAccepted;
}

/**
* Whether or not short year is accepted as user input even if {@link #isShortYear()} returns {@code false}.
* @return When {@code true}, user can input last two digits of the year and it will be properly parsed.
*/
public boolean isShortYearAlwaysAccepted() {
return shortYearAlwaysAccepted;
}

/**
* Chains {@link #setShortYearAlwaysAccepted(boolean)} and returns itself.
* @param shortYearAlwaysAccepted Whether or not to always accept short year as user input.
* @return This.
* @see #setShortYearAlwaysAccepted(boolean)
*/
public DatePattern withShortYearAlwaysAccepted(boolean shortYearAlwaysAccepted) {
this.setShortYearAlwaysAccepted(shortYearAlwaysAccepted);
return this;
}

/**
* Returns display name defined in the constructor. The display name is irrelevant in {@link #equals(Object)} and {@link #hashCode()}.
* @return Display name. May be {@code null} when no-arg constructor has been used.
Expand All @@ -336,12 +369,13 @@ public boolean equals(Object o) {
getBaseCentury() == pattern.getBaseCentury() &&
getCenturyBoundaryYear() == pattern.getCenturyBoundaryYear() &&
isPreviousCenturyBelowBoundary() == pattern.isPreviousCenturyBelowBoundary() &&
isShortYearAlwaysAccepted() == pattern.isShortYearAlwaysAccepted() &&
getDisplayOrder() == pattern.getDisplayOrder();
}

@Override
public int hashCode() {
return Objects.hash(getSeparator(), isZeroPrefixedDay(), isZeroPrefixedMonth(), isShortYear(), getBaseCentury(), getCenturyBoundaryYear(), isPreviousCenturyBelowBoundary(), getDisplayOrder());
return Objects.hash(getSeparator(), isZeroPrefixedDay(), isZeroPrefixedMonth(), isShortYear(), getBaseCentury(), getCenturyBoundaryYear(), isPreviousCenturyBelowBoundary(), isShortYearAlwaysAccepted(), getDisplayOrder());
}

@Override
Expand All @@ -355,6 +389,7 @@ public String toString() {
", baseCentury=" + baseCentury +
", centuryBoundaryYear=" + centuryBoundaryYear +
", previousCenturyBelowBoundary=" + previousCenturyBelowBoundary +
", shortYearAlwaysAccepted=" + shortYearAlwaysAccepted +
", displayOrder=" + displayOrder +
'}' :
getDisplayName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public final class DatePatterns {
.withDisplayOrder(DatePattern.Order.DAY_MONTH_YEAR)
.withSeparator('.');

/**
* Uses zero-prefixed day and month, optionally full year, separated by {@code .}.
* For short years the century boundary year is 40 (years less than 40 are from 21st century).
*/
public static final DatePattern DD_MM_YY_OR_YYYY_DOTTED = new DatePattern("dd.MM.(yy)yy")
.withDisplayOrder(DatePattern.Order.DAY_MONTH_YEAR)
.withShortYearAlwaysAccepted(true)
.withBaseCentury(21).withCenturyBoundaryYear(40).withPreviousCenturyBelowBoundary(false)
.withSeparator('.');

/**
* Uses day, month and short year with century boundary year 40 (years less than 40 are from 21st century), separated by {@code .}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static String convertDatePatternToClientPattern(DatePattern pattern) {
builder.append(yearPart).append(monthPart).append(dayPart);
break;
}
if (pattern.isShortYear()) {
if (pattern.isShortYear() || pattern.isShortYearAlwaysAccepted()) {
builder.append(pattern.isPreviousCenturyBelowBoundary() ? '+' : '-');
builder.append(String.format("%02d", pattern.getBaseCentury() % 100));
builder.append(String.format("%02d", pattern.getCenturyBoundaryYear() % 100));
Expand Down
Loading