summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-03-25 23:37:45 +0200
committerVaadin Code Review <review@vaadin.com>2013-04-03 06:42:55 +0000
commitce2df6d10370c669a512e96f0693fc37cf02aca1 (patch)
tree5b12cf84ba967b17d96c0a5913030e23a491eeb6 /uitest
parent9586a30b64bfd1e8645574d9d7b6568d52dc9e25 (diff)
downloadvaadin-framework-ce2df6d10370c669a512e96f0693fc37cf02aca1.tar.gz
vaadin-framework-ce2df6d10370c669a512e96f0693fc37cf02aca1.zip
Enable setting loading indicator delays from the server (#7448)
* Refactored LoadingIndicator to a separate class on client side to enable customization and to remove clutter from ApplicationConnection Change-Id: I12e94294beed9c65a5710bdfe2486bc0f1b92bd9
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java99
1 files changed, 99 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
new file mode 100644
index 0000000000..0f15ff2fe0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
@@ -0,0 +1,99 @@
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+
+public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
+
+ private TextField initialDelay;
+ private TextField delayStateDelay;
+ private TextField waitStateDelay;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final TextField delayField = new TextField("Delay (ms)");
+ delayField.setConverter(Integer.class);
+ delayField.setConvertedValue(1000);
+
+ NativeButton delayButton = new NativeButton("Wait");
+ delayButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ try {
+ Thread.sleep((Integer) delayField.getConvertedValue());
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ initialDelay = createIntegerTextField("Initial delay (ms)",
+ getState().loadingIndicatorConfiguration.initialDelay);
+ initialDelay.addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ getLoadingIndicator().setInitialDelay(
+ (Integer) initialDelay.getConvertedValue());
+ }
+ });
+ delayStateDelay = createIntegerTextField("Delay state delay (ms)",
+ getState().loadingIndicatorConfiguration.delayStateDelay);
+ delayStateDelay
+ .addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ getLoadingIndicator().setDelayStateDelay(
+ (Integer) delayStateDelay.getConvertedValue());
+ }
+ });
+ waitStateDelay = createIntegerTextField("Wait state delay (ms)",
+ getState().loadingIndicatorConfiguration.waitStateDelay);
+ waitStateDelay
+ .addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ getLoadingIndicator().setWaitStateDelay(
+ (Integer) waitStateDelay.getConvertedValue());
+ }
+ });
+
+ getLayout()
+ .addComponents(initialDelay, delayStateDelay, waitStateDelay);
+
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.setMargin(true);
+ hl.setDefaultComponentAlignment(Alignment.BOTTOM_RIGHT);
+ hl.addComponents(delayField, delayButton);
+ addComponent(hl);
+
+ }
+
+ private TextField createIntegerTextField(String caption, int initialValue) {
+ TextField tf = new TextField(caption);
+ tf.setId(caption);
+ tf.setConverter(Integer.class);
+ tf.setImmediate(true);
+ tf.setConvertedValue(initialValue);
+ return tf;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests that loading indicator delay can be configured";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7448;
+ }
+
+}