Skip to content

Commit

Permalink
renamed the addon class
Browse files Browse the repository at this point in the history
  • Loading branch information
samie committed May 23, 2023
1 parent 75477d5 commit b19936b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
10 changes: 0 additions & 10 deletions src/main/java/org/vaadin/addons/mygroup/TheAddon.java

This file was deleted.

55 changes: 28 additions & 27 deletions src/test/java/org/vaadin/addons/mygroup/AddonView.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
package org.vaadin.addons.mygroup;

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;

@Route("")
public class AddonView extends Div {
public class AddonView extends VerticalLayout {

public AddonView() {
final NPS nps = new NPS();
nps.setId("nps"); // This is for automated tests

// Button to start the feed process
add(new Button("Ask NPS", e -> {
add(nps);
}));

// Get the score and remove component
nps.addValueChangeListener(e-> {
Notification.show("Value changed from "+e.getOldValue()+" to "+e.getValue());
add(new Paragraph("NPS: " +e.getOldValue()+" -> "+e.getValue()));
remove(nps);
});

// Edit the the score
add(new Button("Edit score", e -> {
nps.setValue((int)Math.ceil(Math.random()*10));
add(nps);
}));

// Test read-only state
add(new Button("Toggle read-only", e -> {
nps.setReadOnly(!nps.isReadOnly());
}));
final NPS nps = new NPS();
nps.setId("nps"); // This is for automated tests

// Button to start the feed process
add(new Button("Ask NPS", e -> {
add(nps);
}));

// Get the score and remove component
nps.addValueChangeListener(e -> {
Notification.show("Value changed from " + e.getOldValue() + " to " + e.getValue());
add(new Paragraph("NPS: " + e.getOldValue() + " -> " + e.getValue()));
remove(nps);
});

// Edit the the score
add(new Button("Edit score", e -> {
nps.setValue((int) Math.ceil(Math.random() * 10));
add(nps);
}));

// Test read-only state
add(new Button("Toggle read-only", e -> {
nps.setReadOnly(!nps.isReadOnly());
}));


}
}

0 comments on commit b19936b

Please sign in to comment.