From 9551d7ca56bb9fced67ced199bf23363ac230f3e Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 22 Oct 2012 16:24:05 +0300 Subject: Updated ProgressIndicator to use state and rpc (#10008) Change-Id: Iec3d0c4e9e1432f7dda4aae5c8c4f21cb96f08be --- .../ProgressIndicatorInvisible.java | 2 +- .../progressindicator/ProgressIndicatorTest.java | 85 ++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java (limited to 'uitest/src/com/vaadin/tests/components/progressindicator') diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java index 9f632ac806..2c58e9226a 100644 --- a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java @@ -21,7 +21,7 @@ public class ProgressIndicatorInvisible extends TestBase { final Button b = new Button("Hide container of progress indicator"); addComponent(b); - b.addListener(new Button.ClickListener() { + b.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // If we skip hiding the layout, hiding the ProgressIndicator diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java new file mode 100644 index 0000000000..7fb016ff57 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java @@ -0,0 +1,85 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * 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. + */ +package com.vaadin.tests.components.progressindicator; + +import java.util.LinkedHashMap; + +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.ProgressIndicator; + +public class ProgressIndicatorTest extends AbstractFieldTest { + ProgressIndicator progress = new ProgressIndicator(); + Command setValueCommand = new Command() { + + @Override + public void execute(ProgressIndicator c, Float value, Object data) { + c.setValue(value); + } + }; + private Command setPollingIntervalCommand = new Command() { + @Override + public void execute(ProgressIndicator c, Integer value, Object data) { + c.setPollingInterval(value); + } + }; + + private Command setIndeterminateCommand = new Command() { + @Override + public void execute(ProgressIndicator c, Boolean value, Object data) { + c.setIndeterminate(value); + } + }; + + @Override + protected void createActions() { + super.createActions(); + createSetValueAction(); + createPollingIntervalAction(); + createIndeterminateToggle(); + }; + + private void createIndeterminateToggle() { + createBooleanAction("Indeterminate", CATEGORY_FEATURES, false, + setIndeterminateCommand); + + } + + private void createPollingIntervalAction() { + LinkedHashMap valueOptions = new LinkedHashMap(); + for (int i = 100; i <= 3000; i += 200) { + valueOptions.put(String.valueOf(i), i); + } + createSelectAction("Polling interval", CATEGORY_FEATURES, valueOptions, + "1500", setPollingIntervalCommand); + + } + + private void createSetValueAction() { + LinkedHashMap valueOptions = new LinkedHashMap(); + for (float f = 0.0f; f <= 1.0f; f += 0.1) { + valueOptions.put(String.valueOf(f), f); + } + createSelectAction("Value", CATEGORY_FEATURES, valueOptions, "0.0", + setValueCommand); + + } + + @Override + protected Class getTestClass() { + return ProgressIndicator.class; + } + +} -- cgit v1.2.3