diff --git a/assembly/assembly.xml b/assembly/assembly.xml
index aed1c4b..5838ca6 100644
--- a/assembly/assembly.xml
+++ b/assembly/assembly.xml
@@ -27,6 +27,9 @@
*.jar
*.pdf
+
+ *-tests.jar
+
diff --git a/pom.xml b/pom.xml
index b76aff6..ee22ba6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
Simple Timer for Vaadin Flow
- 14.0.12
+ 14.4.0
1.8
1.8
UTF-8
@@ -53,6 +53,20 @@
Vaadin Directory
https://maven.vaadin.com/vaadin-addons
+
+ FlowingCode Releases
+ https://maven.flowingcode.com/releases
+
+
+ FlowingCode Snapshots
+ https://maven.flowingcode.com/snapshots
+
+ true
+
+
+ false
+
+
@@ -94,6 +108,18 @@
slf4j-simple
test
+
+ junit
+ junit
+ 4.13.1
+ test
+
+
+ com.flowingcode.vaadin.addons.demo
+ commons-demo
+ 2.1.0-SNAPSHOT
+ test
+
@@ -177,6 +203,14 @@
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.1
+
+ false
+
+
@@ -270,5 +304,34 @@
+
+ demo-jar
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+ demo
+
+ META-INF/resources/frontend/styles/shared-styles.css
+ **/test/*
+ **/integration/*
+ **/DemoView.class
+ **/DemoLayout.class
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/src/main/java/com/flowingcode/vaadin/addons/simpletimer/SimpleTimer.java b/src/main/java/com/flowingcode/vaadin/addons/simpletimer/SimpleTimer.java
index 3b20793..06fbdf9 100644
--- a/src/main/java/com/flowingcode/vaadin/addons/simpletimer/SimpleTimer.java
+++ b/src/main/java/com/flowingcode/vaadin/addons/simpletimer/SimpleTimer.java
@@ -2,7 +2,7 @@
* #%L
* Simple Timer Addon
* %%
- * Copyright (C) 2019 Flowing Code
+ * Copyright (C) 2019 - 2020 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java b/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java
new file mode 100644
index 0000000..4a81050
--- /dev/null
+++ b/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java
@@ -0,0 +1,32 @@
+/*-
+ * #%L
+ * Simple Timer Addon
+ * %%
+ * Copyright (C) 2019 - 2020 Flowing Code
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons;
+
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.router.RouterLayout;
+
+@SuppressWarnings("serial")
+public class DemoLayout extends Div implements RouterLayout {
+
+ public DemoLayout() {
+ setSizeFull();
+ }
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/simpletimer/DemoView.java b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/DemoView.java
index c5e721e..9be5115 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/simpletimer/DemoView.java
+++ b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/DemoView.java
@@ -2,7 +2,7 @@
* #%L
* Simple Timer Addon
* %%
- * Copyright (C) 2019 Flowing Code
+ * Copyright (C) 2019 - 2020 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,59 +19,22 @@
*/
package com.flowingcode.vaadin.addons.simpletimer;
-
-import java.math.BigDecimal;
-
-import com.vaadin.flow.component.button.Button;
-import com.vaadin.flow.component.checkbox.Checkbox;
-import com.vaadin.flow.component.html.Div;
-import com.vaadin.flow.component.html.Span;
-import com.vaadin.flow.component.notification.Notification;
-import com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment;
-import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
-import com.vaadin.flow.component.textfield.TextField;
+import com.vaadin.flow.router.BeforeEnterEvent;
+import com.vaadin.flow.router.BeforeEnterObserver;
import com.vaadin.flow.router.Route;
/**
* @author Leonardo Scardanzan / Flowing Code
*/
-@Route("")
@SuppressWarnings("serial")
-public class DemoView extends Div {
-
- public DemoView() {
- this.setSizeFull();
- final SimpleTimer timer = new SimpleTimer();
- timer.setWidth("100px");
- timer.setHeight("50px");
- timer.getStyle().set("font-size", "40px");
- final TextField startTime = new TextField("Start Time", e -> timer.setStartTime(new BigDecimal(e.getValue())));
- final Checkbox countUp = new Checkbox("Count Up", false);
- countUp.addValueChangeListener(e -> timer.setCountUp(countUp.getValue()));
- final Button start = new Button("Start/Stop", e -> timer.start());
- final Button stop = new Button("Stop", e -> timer.pause());
- final Button reset = new Button("Reset", e -> {
- timer.reset();
- });
- final Button running = new Button("Current Time", e -> timer.getCurrentTimeAsync().thenAccept(
- time -> Notification.show(time.toPlainString() + (timer.isRunning() ? "" : " (Not Running)"))));
- final Checkbox fractions = new Checkbox("Fractions", true);
- fractions.addValueChangeListener(e -> timer.setFractions(e.getValue()));
- final Checkbox minutes = new Checkbox("Minutes", e -> timer.setMinutes(e.getValue()));
- final Checkbox hours = new Checkbox("Hours", e -> timer.setHours(e.getValue()));
- final Checkbox visible = new Checkbox("Visible", e->{
- if (e.isFromClient()) timer.setVisible(!timer.isVisible());
- });
- visible.setValue(true);
- timer.addTimerEndEvent(e -> Notification.show("Timer Ended"));
- final HorizontalLayout topLayout = new HorizontalLayout(new Span("SimpleTimer"), timer);
- topLayout.setAlignItems(Alignment.CENTER);
- final HorizontalLayout bottomLayout = new HorizontalLayout(startTime, countUp, start, stop, reset, running, fractions, minutes, hours, visible);
- bottomLayout.setAlignItems(Alignment.CENTER);
- add(new VerticalLayout(topLayout, bottomLayout));
+@Route("")
+public class DemoView extends VerticalLayout implements BeforeEnterObserver {
+ @Override
+ public void beforeEnter(BeforeEnterEvent event) {
+ event.forwardTo(SimpletimerDemoView.class);
}
-
}
+
diff --git a/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemo.java b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemo.java
new file mode 100644
index 0000000..55075f4
--- /dev/null
+++ b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemo.java
@@ -0,0 +1,88 @@
+/*-
+ * #%L
+ * Simple Timer Addon
+ * %%
+ * Copyright (C) 2019 - 2020 Flowing Code
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.simpletimer;
+
+import com.vaadin.flow.component.button.Button;
+import com.vaadin.flow.component.checkbox.Checkbox;
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.component.html.Span;
+import com.vaadin.flow.component.notification.Notification;
+import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
+import com.vaadin.flow.component.orderedlayout.VerticalLayout;
+import com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment;
+import com.vaadin.flow.component.textfield.TextField;
+import java.math.BigDecimal;
+
+@SuppressWarnings("serial")
+public class SimpletimerDemo extends Div {
+
+ public SimpletimerDemo() {
+ this.setSizeFull();
+ final SimpleTimer timer = new SimpleTimer();
+ timer.setWidth("100px");
+ timer.setHeight("50px");
+ timer.getStyle().set("font-size", "40px");
+
+ Span timerTitle = new Span("Simple Count Up Timer");
+
+ final TextField startTime = new TextField("Start Time", e -> timer.setStartTime(new BigDecimal(e.getValue())));
+ final Checkbox countUp = new Checkbox("Count Up", false);
+ countUp.addValueChangeListener(e -> {
+ timer.setCountUp(countUp.getValue());
+ if (e.getValue()) {
+ startTime.setLabel("End Time");
+ timerTitle.setText("Simple Count Up Timer");
+ } else {
+ startTime.setLabel("Start Time");
+ timerTitle.setText("Simple Countdown Timer");
+ }
+ });
+ final Button start = new Button("Start/Stop", e -> timer.start());
+ final Button stop = new Button("Stop", e -> timer.pause());
+ final Button reset = new Button("Reset", e -> {
+ timer.reset();
+ });
+ final Button running = new Button("Current Time", e -> timer.getCurrentTimeAsync().thenAccept(
+ time -> Notification.show(time.toPlainString() + (timer.isRunning() ? "" : " (Not Running)"))));
+ final Checkbox fractions = new Checkbox("Fractions", true);
+ fractions.addValueChangeListener(e -> timer.setFractions(e.getValue()));
+ final Checkbox minutes = new Checkbox("Minutes", e -> timer.setMinutes(e.getValue()));
+ final Checkbox hours = new Checkbox("Hours", e -> timer.setHours(e.getValue()));
+ final Checkbox visible = new Checkbox("Visible", e->{
+ if (e.isFromClient()) timer.setVisible(!timer.isVisible());
+ });
+ visible.setValue(true);
+
+ timer.addTimerEndEvent(e -> Notification.show("Timer Ended"));
+
+ final HorizontalLayout topLayout = new HorizontalLayout(timerTitle, timer);
+ topLayout.setAlignItems(Alignment.CENTER);
+
+ HorizontalLayout options = new HorizontalLayout(countUp, fractions, minutes, hours, visible);
+ options.setAlignItems(Alignment.CENTER);
+
+ final HorizontalLayout bottomLayout = new HorizontalLayout(start, stop, reset, running);
+ bottomLayout.setAlignItems(Alignment.BASELINE);
+
+ add(new VerticalLayout(topLayout, startTime, options, bottomLayout));
+
+ }
+
+}
diff --git a/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemoView.java b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemoView.java
new file mode 100644
index 0000000..f63140e
--- /dev/null
+++ b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemoView.java
@@ -0,0 +1,39 @@
+/*-
+ * #%L
+ * Simple Timer Addon
+ * %%
+ * Copyright (C) 2019 - 2020 Flowing Code
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.simpletimer;
+
+import com.flowingcode.vaadin.addons.DemoLayout;
+import com.flowingcode.vaadin.addons.GithubLink;
+import com.flowingcode.vaadin.addons.demo.TabbedDemo;
+import com.vaadin.flow.router.Route;
+
+@SuppressWarnings("serial")
+@Route(value = "simple-timer", layout = DemoLayout.class)
+@GithubLink("https://github.com/FlowingCode/SimpleTimerAddon")
+public class SimpletimerDemoView extends TabbedDemo {
+
+ private static final String ST_DEMO = "Simple Timer Demo";
+ private static final String ST_SOURCE = "https://github.com/FlowingCode/SimpleTimerAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/simpletimer/SimpletimerDemo.java";
+
+ public SimpletimerDemoView() {
+ addDemo(new SimpletimerDemo(), ST_DEMO, ST_SOURCE);
+ setSizeFull();
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/flowingcode/vaadin/addons/simpletimer/test/LayoutTest.java b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/test/LayoutTest.java
new file mode 100644
index 0000000..08ea6c4
--- /dev/null
+++ b/src/test/java/com/flowingcode/vaadin/addons/simpletimer/test/LayoutTest.java
@@ -0,0 +1,40 @@
+/*-
+ * #%L
+ * Simple Timer Addon
+ * %%
+ * Copyright (C) 2019 - 2020 Flowing Code
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package com.flowingcode.vaadin.addons.simpletimer.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import org.junit.Test;
+
+import com.flowingcode.vaadin.addons.DemoLayout;
+import com.flowingcode.vaadin.addons.simpletimer.SimpletimerDemoView;
+import com.vaadin.flow.router.Route;
+
+public class LayoutTest {
+
+ @Test
+ public void testDemoLayout() {
+ Route route = SimpletimerDemoView.class.getAnnotation(Route.class);
+ assertEquals("com.flowingcode.vaadin.addons.DemoLayout",DemoLayout.class.getName());
+ assertEquals(DemoLayout.class, route.layout());
+ assertNotEquals("", route.value());
+ }
+}
diff --git a/src/test/resources/META-INF/resources/frontend/styles/shared-styles.html b/src/test/resources/META-INF/resources/frontend/styles/shared-styles.html
index 0277a0b..8aa043f 100644
--- a/src/test/resources/META-INF/resources/frontend/styles/shared-styles.html
+++ b/src/test/resources/META-INF/resources/frontend/styles/shared-styles.html
@@ -2,7 +2,7 @@
#%L
Simple Timer Addon
%%
- Copyright (C) 2019 Flowing Code
+ Copyright (C) 2019 - 2020 Flowing Code
%%
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.