Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
AB-xdev committed Jan 11, 2024
1 parent 09ba833 commit 96a73ae
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package software.xdev.vaadin.chips;

import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -57,36 +57,39 @@ public class SimpleDemo extends HorizontalLayout
private final TextArea taValueChangeInt =
new TextArea("ValueChangeEvent", "Change something in the chip combobox to see the result");

@SuppressWarnings("checkstyle:MagicNumber")
public SimpleDemo()
{
this.initUI();

this.stringBox.addValueChangeListener(ev ->
this.taValueChangeString.setValue(
"Value: [" + ev.getValue().stream().collect(Collectors.joining(", ")) + "] \r\n" +
"OldValue: [" + ev.getOldValue().stream().collect(Collectors.joining(", ")) + "] \r\n" +
"IsFromClient: " + ev.isFromClient()
)
);
this.stringBox.addValueChangeListener(ev -> this.taValueChangeString.setValue(
"Value: [" + String.join(", ", ev.getValue()) + "] \r\n"
+ "OldValue: [" + String.join(", ", ev.getOldValue()) + "] \r\n"
+ "IsFromClient: " + ev.isFromClient()
));

this.btnSetAvailableInts1to10.addClickListener(ev -> this.setAvailableInts(1, 10));
this.btnSetAvailableInts5to15.addClickListener(ev -> this.setAvailableInts(5, 15));
this.btnSetAvailableInts11to20.addClickListener(ev -> this.setAvailableInts(11, 20));
this.btnSetRandomAvailableInts.addClickListener(ev -> this.setAvailableIntsRandom());

this.btnShowSelectedInt.addClickListener(ev ->
Notification.show("Selected: " + this.intBox.getValue().stream().map(Object::toString).collect(Collectors.joining(", ")))
Notification.show("Selected: " + this.intBox.getValue().stream()
.map(Object::toString)
.collect(Collectors.joining(", ")))
);

this.intBox.addValueChangeListener(ev ->
this.taValueChangeInt.setValue(
"Value: [" + ev.getValue().stream().map(Object::toString).collect(Collectors.joining(", ")) + "] \r\n" +
"OldValue: [" + ev.getOldValue().stream().map(Object::toString).collect(Collectors.joining(", ")) + "] \r\n" +
"IsFromClient: " + ev.isFromClient()
)
);
this.intBox.addValueChangeListener(ev -> this.taValueChangeInt.setValue(
"Value: [" + ev.getValue().stream().map(Object::toString).collect(Collectors.joining(", "))
+ "] \r\n"
+ "OldValue: ["
+ ev.getOldValue().stream().map(Object::toString).collect(Collectors.joining(", "))
+ "] \r\n"
+ "IsFromClient: " + ev.isFromClient()
));
}

@SuppressWarnings("checkstyle:MagicNumber")
private void initUI()
{
this.stringBox.setWidthFull();
Expand Down Expand Up @@ -158,14 +161,14 @@ private void setAvailableIntsRandom()

private void setAvailableInts(final int startInclusive, final int endInclusive)
{
this.intBox.withAllAvailableItems(IntStream.rangeClosed(startInclusive, endInclusive).boxed().collect(Collectors.toList()));
this.intBox.withAllAvailableItems(IntStream.rangeClosed(startInclusive, endInclusive).boxed().toList());
}

@Override
protected void onAttach(final AttachEvent attachEvent)
{
this.stringBox
.withAllAvailableItems(Arrays.asList("Java", "TypeScript", "Shell", "JavaScript", "Kotlin", "C#", "Python"));
this.stringBox.withAllAvailableItems(
List.of("Java", "TypeScript", "Shell", "JavaScript", "Kotlin", "C#", "Python"));

this.setAvailableIntsRandom();

Expand Down

0 comments on commit 96a73ae

Please sign in to comment.