From 9586a30b64bfd1e8645574d9d7b6568d52dc9e25 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 25 Mar 2013 21:54:36 +0200 Subject: Made is possible to configure tooltip on the server (#8065) Change-Id: I35af6df1dfa75ef1de1268eb630fc0f4b9306170 --- .../tests/components/ui/TooltipConfiguration.html | 135 +++++++++++++++++++++ .../tests/components/ui/TooltipConfiguration.java | 107 ++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html create mode 100644 uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java (limited to 'uitest/src/com/vaadin') diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html new file mode 100644 index 0000000000..5170d4408f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html @@ -0,0 +1,135 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.TooltipConfiguration?restartApplication
typevaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout0
mouseMoveAtvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip0,0
waitForElementPresentid=gwt-uid-3
assertTextid=gwt-uid-3This is a short tooltip
mouseClickvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::
assertElementNotPresentid=gwt-uid-3
typevaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout3000
mouseMoveAtvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip0,0
waitForElementPresentid=gwt-uid-3
assertTextid=gwt-uid-3This is a short tooltip
mouseClickvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::
assertElementPresentid=gwt-uid-3
mouseClickvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout60,9
typevaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout0
mouseMoveAtvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip0,0
waitForElementPresentid=gwt-uid-3
assertElementWidthid=gwt-uid-3500
mouseClickvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::
typevaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SMax width100
mouseMoveAtvaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip0,0
waitForElementPresentid=gwt-uid-3
assertElementWidthid=gwt-uid-3100
+ + diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java new file mode 100644 index 0000000000..b8998ff32e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java @@ -0,0 +1,107 @@ +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.tests.util.LoremIpsum; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.TextField; + +public class TooltipConfiguration extends AbstractTestUIWithLog { + + private TextField closeTimeout; + private TextField quickOpenTimeout; + private TextField maxWidth; + private TextField openDelay; + private TextField quickOpenDelay; + + @Override + protected void setup(VaadinRequest request) { + NativeButton componentWithShortTooltip = new NativeButton( + "Short tooltip"); + componentWithShortTooltip.setDescription("This is a short tooltip"); + componentWithShortTooltip.setId("shortTooltip"); + + NativeButton componentWithLongTooltip = new NativeButton("Long tooltip"); + componentWithLongTooltip.setId("longTooltip"); + componentWithLongTooltip.setDescription(LoremIpsum.get(5000)); + + closeTimeout = createIntegerTextField("Close timeout", + getState().tooltipConfiguration.closeTimeout); + closeTimeout.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setCloseTimeout( + (Integer) closeTimeout.getConvertedValue()); + } + }); + maxWidth = createIntegerTextField("Max width", + getState().tooltipConfiguration.maxWidth); + maxWidth.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip() + .setMaxWidth((Integer) maxWidth.getConvertedValue()); + } + }); + openDelay = createIntegerTextField("Open delay", + getState().tooltipConfiguration.openDelay); + openDelay.addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setOpenDelay( + (Integer) openDelay.getConvertedValue()); + } + }); + + quickOpenDelay = createIntegerTextField("Quick open delay", + getState().tooltipConfiguration.quickOpenDelay); + quickOpenDelay + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setQuickOpenDelay( + (Integer) quickOpenDelay.getConvertedValue()); + } + }); + + quickOpenTimeout = createIntegerTextField("Quick open timeout", + getState().tooltipConfiguration.quickOpenTimeout); + quickOpenTimeout + .addValueChangeListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + getTooltip().setQuickOpenTimeout( + (Integer) quickOpenTimeout.getConvertedValue()); + } + }); + + getLayout().addComponents(closeTimeout, openDelay, quickOpenDelay, + quickOpenTimeout, maxWidth); + + getLayout().addComponents(componentWithShortTooltip, + componentWithLongTooltip); + + } + + 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 tooltip delays can be configured"; + } + + @Override + protected Integer getTicketNumber() { + return 8065; + } + +} -- cgit v1.2.3