summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/vaadin/terminal/AbstractJavaScriptExtension.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/SuperDevMode.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/Util.java38
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VOverlay.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java14
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java25
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java64
-rw-r--r--src/com/vaadin/ui/AbstractJavaScriptComponent.java5
-rw-r--r--src/com/vaadin/ui/Notification.java22
-rw-r--r--src/com/vaadin/ui/Root.java31
-rw-r--r--tests/testbench/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java160
-rw-r--r--tests/testbench/com/vaadin/tests/components/LongTooltip.html33
-rw-r--r--tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html15
-rw-r--r--tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java2
-rw-r--r--tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html2
-rw-r--r--tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.html2
-rw-r--r--tests/testbench/com/vaadin/tests/components/notification/Notifications.java1
-rw-r--r--tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java5
-rw-r--r--tests/testbench/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html6
-rw-r--r--tests/testbench/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html6
-rw-r--r--tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java13
-rw-r--r--tests/testbench/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java4
-rw-r--r--tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html16
23 files changed, 334 insertions, 166 deletions
diff --git a/src/com/vaadin/terminal/AbstractJavaScriptExtension.java b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
index 77540c355a..1cfa91e392 100644
--- a/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
+++ b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
@@ -139,8 +139,9 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension {
/**
* Invoke a named function that the connector JavaScript has added to the
* JavaScript connector wrapper object. The arguments should only contain
- * data types that can be represented in JavaScript, including primitive
- * boxing types, arrays, String, List, Set, Map, Connector and JavaBeans.
+ * data types that can be represented in JavaScript including primitives,
+ * their boxed types, arrays, String, List, Set, Map, Connector and
+ * JavaBeans.
*
* @param name
* the name of the function
diff --git a/src/com/vaadin/terminal/gwt/client/SuperDevMode.java b/src/com/vaadin/terminal/gwt/client/SuperDevMode.java
index e94aea4ae1..98e73c0c08 100644
--- a/src/com/vaadin/terminal/gwt/client/SuperDevMode.java
+++ b/src/com/vaadin/terminal/gwt/client/SuperDevMode.java
@@ -1,3 +1,6 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
package com.vaadin.terminal.gwt.client;
import com.google.gwt.core.client.GWT;
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java
index d3cb54160d..4687512b47 100644
--- a/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/src/com/vaadin/terminal/gwt/client/Util.java
@@ -29,6 +29,7 @@ import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
+import com.vaadin.terminal.gwt.client.ui.VOverlay;
public class Util {
@@ -642,31 +643,44 @@ public class Util {
*/
public static ComponentConnector getConnectorForElement(
ApplicationConnection client, Widget parent, Element element) {
+
+ Element browseElement = element;
Element rootElement = parent.getElement();
- while (element != null && element != rootElement) {
- ComponentConnector paintable = ConnectorMap.get(client)
- .getConnector(element);
- if (paintable == null) {
- String ownerPid = VCaption.getCaptionOwnerPid(element);
+
+ while (browseElement != null && browseElement != rootElement) {
+ ComponentConnector connector = ConnectorMap.get(client)
+ .getConnector(browseElement);
+
+ if (connector == null) {
+ String ownerPid = VCaption.getCaptionOwnerPid(browseElement);
if (ownerPid != null) {
- paintable = (ComponentConnector) ConnectorMap.get(client)
+ connector = (ComponentConnector) ConnectorMap.get(client)
.getConnector(ownerPid);
}
}
- if (paintable != null) {
+ if (connector != null) {
// check that inside the rootElement
- while (element != null && element != rootElement) {
- element = (Element) element.getParentElement();
+ while (browseElement != null && browseElement != rootElement) {
+ browseElement = (Element) browseElement.getParentElement();
}
- if (element != rootElement) {
+ if (browseElement != rootElement) {
return null;
} else {
- return paintable;
+ return connector;
}
}
- element = (Element) element.getParentElement();
+ browseElement = (Element) browseElement.getParentElement();
+ }
+
+ if (browseElement == null) {
+ // Element is possibly inside a VOverlay
+ VOverlay overlay = findWidget(element, VOverlay.class);
+ if (overlay != null && overlay.getOwner() != null) {
+ return getConnectorForElement(client, RootPanel.get(), overlay
+ .getOwner().getElement());
+ }
}
return null;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
index df655ef959..77639c0c3f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
@@ -14,6 +14,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.BrowserInfo;
/**
@@ -45,6 +46,12 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
*/
private Element shadow;
+ /*
+ * Creator of VOverlow (widget that made the instance, not the layout
+ * parent)
+ */
+ private Widget owner;
+
/**
* The HTML snippet that is used to render the actual shadow. In consists of
* nine different DIV-elements with the following class names:
@@ -414,4 +421,25 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
protected boolean isSinkShadowEvents() {
return sinkShadowEvents;
}
+
+ /**
+ * Get owner (Widget that made this VOverlay, not the layout parent) of
+ * VOverlay
+ *
+ * @return Owner (creator) or null if not defined
+ */
+ public Widget getOwner() {
+ return owner;
+ }
+
+ /**
+ * Set owner (Widget that made this VOverlay, not the layout parent) of
+ * VOverlay
+ *
+ * @param owner
+ * Owner (creator) of VOverlay
+ */
+ public void setOwner(Widget owner) {
+ this.owner = owner;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
index 72555214fa..f9d02d403b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
@@ -64,15 +64,21 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
}
// Remove old stylename that indicates current resolution
- setWidgetStyleNameWithPrefix(VDateField.CLASSNAME,
- VDateField.resolutionToString(getWidget().currentResolution),
+ setWidgetStyleName(
+ VDateField.CLASSNAME
+ + "-"
+ + VDateField
+ .resolutionToString(getWidget().currentResolution),
false);
getWidget().currentResolution = newResolution;
// Add stylename that indicates current resolution
- setWidgetStyleNameWithPrefix(VDateField.CLASSNAME,
- VDateField.resolutionToString(getWidget().currentResolution),
+ setWidgetStyleName(
+ VDateField.CLASSNAME
+ + "-"
+ + VDateField
+ .resolutionToString(getWidget().currentResolution),
true);
final int year = uidl.getIntVariable("year");
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
index d1f77aa0ff..a18e4d734a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
@@ -7,9 +7,11 @@ import java.util.Iterator;
import java.util.Stack;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Command;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
@@ -120,6 +122,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
iteratorStack.push(itr);
itr = item.getChildIterator();
currentMenu = new VMenuBar(true, currentMenu);
+ client.getVTooltip().connectHandlersToWidget(currentMenu);
// this is the top-level style that also propagates to items -
// any item specific styles are set above in
// currentItem.updateFromUIDL(item, client)
@@ -160,4 +163,26 @@ public class MenuBarConnector extends AbstractComponentConnector implements
public void layout() {
getWidget().iLayout();
}
+
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+ TooltipInfo info = null;
+
+ // Check content of widget to find tooltip for element
+ if (element != getWidget().getElement()) {
+
+ CustomMenuItem item = getWidget().getMenuItemWithElement(
+ (com.google.gwt.user.client.Element) element);
+ if (item != null) {
+ info = item.getTooltip();
+ }
+ }
+
+ // Use default tooltip if nothing found from DOM three
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
index 821fa5032c..6133b7d80c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
@@ -33,6 +33,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.LayoutManager;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.Icon;
@@ -87,8 +88,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
boolean enabled = true;
- private String width = "notinited";
-
private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100,
new ScheduledCommand() {
@@ -524,6 +523,22 @@ public class VMenuBar extends SimpleFocusablePanel implements
final int shadowSpace = 10;
popup = new VOverlay(true, false, true);
+
+ // Setting owner and handlers to support tooltips. Needed for tooltip
+ // handling of overlay widgets (will direct queries to parent menu)
+ if (parentMenu == null) {
+ popup.setOwner(this);
+ } else {
+ VMenuBar parent = parentMenu;
+ while (parent.getParentMenu() != null) {
+ parent = parent.getParentMenu();
+ }
+ popup.setOwner(parent);
+ }
+ if (client != null) {
+ client.getVTooltip().connectHandlersToWidget(popup);
+ }
+
popup.setStyleName(CLASSNAME + "-popup");
popup.setWidget(item.getSubMenu());
popup.addCloseHandler(this);
@@ -707,9 +722,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* A class to hold information on menu items
*
*/
- protected static class CustomMenuItem extends Widget implements HasHTML {
-
- private ApplicationConnection client;
+ public static class CustomMenuItem extends Widget implements HasHTML {
protected String html = null;
protected Command command = null;
@@ -719,6 +732,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
protected boolean isSeparator = false;
protected boolean checkable = false;
protected boolean checked = false;
+ protected String description = null;
/**
* Default menu item {@link Widget} constructor for GWT.create().
@@ -884,7 +898,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- this.client = client;
setSeparator(uidl.hasAttribute("separator"));
setEnabled(!uidl.hasAttribute(ATTRIBUTE_ITEM_DISABLED));
@@ -903,17 +916,18 @@ public class VMenuBar extends SimpleFocusablePanel implements
addStyleDependentName(itemStyle);
}
+ if (uidl.hasAttribute(ATTRIBUTE_ITEM_DESCRIPTION)) {
+ description = uidl
+ .getStringAttribute(ATTRIBUTE_ITEM_DESCRIPTION);
+ }
}
- private VMenuBar findRootMenu() {
- VMenuBar menubar = getParentMenu();
-
- // Traverse up until root menu is found
- while (menubar.getParentMenu() != null) {
- menubar = menubar.getParentMenu();
+ public TooltipInfo getTooltip() {
+ if (description == null) {
+ return null;
}
- return menubar;
+ return new TooltipInfo(description);
}
/**
@@ -1405,4 +1419,28 @@ public class VMenuBar extends SimpleFocusablePanel implements
return null;
}
+ /**
+ * Get menu item with given DOM element
+ *
+ * @param element
+ * Element used in search
+ * @return Menu item or null if not found
+ */
+ public CustomMenuItem getMenuItemWithElement(Element element) {
+ for (int i = 0; i < items.size(); i++) {
+ CustomMenuItem item = items.get(i);
+ if (DOM.isOrHasChild(item.getElement(), element)) {
+ return item;
+ }
+
+ if (item.getSubMenu() != null) {
+ item = item.getSubMenu().getMenuItemWithElement(element);
+ if (item != null) {
+ return item;
+ }
+ }
+ }
+
+ return null;
+ }
}
diff --git a/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/src/com/vaadin/ui/AbstractJavaScriptComponent.java
index 969c5b7fcd..a9b9494689 100644
--- a/src/com/vaadin/ui/AbstractJavaScriptComponent.java
+++ b/src/com/vaadin/ui/AbstractJavaScriptComponent.java
@@ -142,8 +142,9 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent {
/**
* Invoke a named function that the connector JavaScript has added to the
* JavaScript connector wrapper object. The arguments should only contain
- * data types that can be represented in JavaScript, including primitive
- * boxing types, arrays, String, List, Set, Map, Connector and JavaBeans.
+ * data types that can be represented in JavaScript including primitives,
+ * their boxed types, arrays, String, List, Set, Map, Connector and
+ * JavaBeans.
*
* @param name
* the name of the function
diff --git a/src/com/vaadin/ui/Notification.java b/src/com/vaadin/ui/Notification.java
index 0358283cb4..502e5ff788 100644
--- a/src/com/vaadin/ui/Notification.java
+++ b/src/com/vaadin/ui/Notification.java
@@ -76,8 +76,7 @@ public class Notification implements Serializable {
/**
* Creates a "humanized" notification message.
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption is by
- * default rendered as html.
+ * The caption is rendered as plain text with HTML automatically escaped.
*
* @param caption
* The message to show
@@ -89,8 +88,7 @@ public class Notification implements Serializable {
/**
* Creates a notification message of the specified type.
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption is by
- * default rendered as html.
+ * The caption is rendered as plain text with HTML automatically escaped.
*
* @param caption
* The message to show
@@ -105,8 +103,8 @@ public class Notification implements Serializable {
* Creates a "humanized" notification message with a bigger caption and
* smaller description.
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are by default rendered as html.
+ * The caption and description are rendered as plain text with HTML
+ * automatically escaped.
*
* @param caption
* The message caption
@@ -121,8 +119,8 @@ public class Notification implements Serializable {
* Creates a notification message of the specified type, with a bigger
* caption and smaller description.
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are by default rendered as html.
+ * The caption and description are rendered as plain text with HTML
+ * automatically escaped.
*
* @param caption
* The message caption
@@ -132,7 +130,7 @@ public class Notification implements Serializable {
* The type of message
*/
public Notification(String caption, String description, int type) {
- this(caption, description, type, true);
+ this(caption, description, type, false);
}
/**
@@ -335,8 +333,7 @@ public class Notification implements Serializable {
* Shows a notification message on the middle of the current page. The
* message automatically disappears ("humanized message").
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption is
- * rendered as html.
+ * The caption is rendered as plain text with HTML automatically escaped.
*
* @see #Notification(String)
* @see #show(Page)
@@ -354,8 +351,7 @@ public class Notification implements Serializable {
* defined in {@link Notification}, for instance
* Notification.TYPE_WARNING_MESSAGE.
*
- * Care should be taken to to avoid XSS vulnerabilities as the caption is
- * rendered as html.
+ * The caption is rendered as plain text with HTML automatically escaped.
*
* @see #Notification(String, int)
* @see #show(Page)
diff --git a/src/com/vaadin/ui/Root.java b/src/com/vaadin/ui/Root.java
index 7ae687be79..9271097a46 100644
--- a/src/com/vaadin/ui/Root.java
+++ b/src/com/vaadin/ui/Root.java
@@ -1071,11 +1071,14 @@ public abstract class Root extends AbstractComponentContainer implements
* @param caption
* The message
*
- * @deprecated As of 7.0, use Notification.show instead
+ * @deprecated As of 7.0, use Notification.show instead but be aware that
+ * Notification.show does not allow HTML.
*/
@Deprecated
public void showNotification(String caption) {
- getPage().showNotification(new Notification(caption));
+ Notification notification = new Notification(caption);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
}
/**
@@ -1094,11 +1097,14 @@ public abstract class Root extends AbstractComponentContainer implements
* @param type
* The message type
*
- * @deprecated As of 7.0, use Notification.show instead
+ * @deprecated As of 7.0, use Notification.show instead but be aware that
+ * Notification.show does not allow HTML.
*/
@Deprecated
public void showNotification(String caption, int type) {
- getPage().showNotification(new Notification(caption, type));
+ Notification notification = new Notification(caption, type);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
}
/**
@@ -1117,11 +1123,14 @@ public abstract class Root extends AbstractComponentContainer implements
* @param description
* The message description
*
- * @deprecated As of 7.0, use Notification.show instead
+ * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
+ * be aware that HTML by default not allowed.
*/
@Deprecated
public void showNotification(String caption, String description) {
- getPage().showNotification(new Notification(caption, description));
+ Notification notification = new Notification(caption, description);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
}
/**
@@ -1143,12 +1152,14 @@ public abstract class Root extends AbstractComponentContainer implements
* @param type
* The message type
*
- * @deprecated As of 7.0, use Notification.show instead
+ * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
+ * be aware that HTML by default not allowed.
*/
@Deprecated
public void showNotification(String caption, String description, int type) {
- getPage()
- .showNotification(new Notification(caption, description, type));
+ Notification notification = new Notification(caption, description, type);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
}
/**
@@ -1173,7 +1184,7 @@ public abstract class Root extends AbstractComponentContainer implements
* Whether html in the caption and description should be
* displayed as html or as plain text
*
- * @deprecated As of 7.0, use Notification.show instead
+ * @deprecated As of 7.0, use new Notification(...).show(Page).
*/
@Deprecated
public void showNotification(String caption, String description, int type,
diff --git a/tests/testbench/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java b/tests/testbench/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
index 21cf9e45a6..b458c12188 100644
--- a/tests/testbench/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
+++ b/tests/testbench/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
@@ -1,81 +1,81 @@
-package com.vaadin.tests.components;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.PopupDateField;
-
-public class AddRemoveSetStyleNamesTest extends TestBase {
-
- private String style1 = "style1";
- private String style2 = "style2";
- private String thestyle = "thestyle";
-
- private PopupDateField popupDateField;
- private Button button1;
- private Button button2;
- private Button button3;
-
- private Button.ClickListener listener;
-
- @Override
- protected void setup() {
- popupDateField = new PopupDateField("PopupDateField");
- popupDateField.setRequired(true);
- popupDateField.setRequiredError("abcd");
- addComponent(popupDateField);
-
- listener = new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- String style = (String) event.getButton().getData();
- setComponentsStyle(style, !popupDateField.getStyleName()
- .contains(style), event.getButton());
- }
- };
-
- button1 = new Button("Add style1", listener);
- button1.setData(style1);
- addComponent(button1);
-
- button2 = new Button("Add style2", listener);
- button2.setData(style2);
- addComponent(button2);
-
- button3 = new Button("Set thestyle", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- if (popupDateField.getStyleName().contains(thestyle)) {
- popupDateField.removeStyleName(thestyle);
- button3.setCaption("Set thestyle");
- } else {
- popupDateField.setStyleName(thestyle);
- button1.setCaption("Add style1");
- button2.setCaption("Add style2");
- button3.setCaption("Remove thestyle");
- }
- }
- });
- addComponent(button3);
- }
-
- private void setComponentsStyle(String style, boolean add, Button button) {
- if (add) {
- popupDateField.addStyleName(style);
- button.setCaption("Remove " + style);
- } else {
- popupDateField.removeStyleName(style);
- button.setCaption("Add " + style);
- }
- }
-
- @Override
- protected String getDescription() {
- return "If a widget has set multiple css class names, AbtractComponentConnector.getStyleNames() removes all but first one of them. This is not acceptable, because we should be able to create connector for any existing GWT component and thus we do not know it it depends on multiple css class names.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 8664;
- }
-
+package com.vaadin.tests.components;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.PopupDateField;
+
+public class AddRemoveSetStyleNamesTest extends TestBase {
+
+ private String style1 = "style1";
+ private String style2 = "style2";
+ private String thestyle = "thestyle";
+
+ private PopupDateField popupDateField;
+ private Button button1;
+ private Button button2;
+ private Button button3;
+
+ private Button.ClickListener listener;
+
+ @Override
+ protected void setup() {
+ popupDateField = new PopupDateField("PopupDateField");
+ popupDateField.setRequired(true);
+ popupDateField.setRequiredError("abcd");
+ addComponent(popupDateField);
+
+ listener = new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ String style = (String) event.getButton().getData();
+ setComponentsStyle(style, !popupDateField.getStyleName()
+ .contains(style), event.getButton());
+ }
+ };
+
+ button1 = new Button("Add style1", listener);
+ button1.setData(style1);
+ addComponent(button1);
+
+ button2 = new Button("Add style2", listener);
+ button2.setData(style2);
+ addComponent(button2);
+
+ button3 = new Button("Set thestyle", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ if (popupDateField.getStyleName().contains(thestyle)) {
+ popupDateField.removeStyleName(thestyle);
+ button3.setCaption("Set thestyle");
+ } else {
+ popupDateField.setStyleName(thestyle);
+ button1.setCaption("Add style1");
+ button2.setCaption("Add style2");
+ button3.setCaption("Remove thestyle");
+ }
+ }
+ });
+ addComponent(button3);
+ }
+
+ private void setComponentsStyle(String style, boolean add, Button button) {
+ if (add) {
+ popupDateField.addStyleName(style);
+ button.setCaption("Remove " + style);
+ } else {
+ popupDateField.removeStyleName(style);
+ button.setCaption("Add " + style);
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "If a widget has set multiple css class names, AbtractComponentConnector.getStyleNames() removes all but first one of them. This is not acceptable, because we should be able to create connector for any existing GWT component and thus we do not know it it depends on multiple css class names.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8664;
+ }
+
} \ No newline at end of file
diff --git a/tests/testbench/com/vaadin/tests/components/LongTooltip.html b/tests/testbench/com/vaadin/tests/components/LongTooltip.html
index ac317380b8..a5055741f1 100644
--- a/tests/testbench/com/vaadin/tests/components/LongTooltip.html
+++ b/tests/testbench/com/vaadin/tests/components/LongTooltip.html
@@ -36,8 +36,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -63,8 +63,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -113,8 +113,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -140,8 +140,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -190,8 +190,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -217,8 +217,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -267,8 +267,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -294,8 +294,8 @@
</tr>
<!--Hide tooltip-->
<tr>
- <td>mouseOut</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
<td>55,43</td>
</tr>
<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
@@ -319,7 +319,6 @@
<td></td>
<td>tooltip-upper-left-3</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html
index a1d4fc9b35..3cea965690 100644
--- a/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html
+++ b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html
@@ -27,6 +27,11 @@
<td>no_tooltip</td>
</tr>
<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[0]/domChild[0]</td>
<td>10,7</td>
@@ -42,6 +47,11 @@
<td>panel_tooltip</td>
</tr>
<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[1]/domChild[0]</td>
<td>8,6</td>
@@ -57,6 +67,11 @@
<td>layout_tooltip</td>
</tr>
<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[2]/domChild[0]</td>
<td>5,5</td>
diff --git a/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java b/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java
index 694c5b54f9..88c6f7fc45 100644
--- a/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java
+++ b/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java
@@ -64,7 +64,7 @@ public class BooleanFieldExample extends TestBase {
public void buttonClick(ClickEvent event) {
form.commit();
Notification.show("The custom boolean field value is "
- + data.isCustom() + ".<br>"
+ + data.isCustom() + ".\n"
+ "The checkbox (default boolean field) value is "
+ data.isNormal() + ".");
}
diff --git a/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html
index 08dc608787..c85d7e0626 100644
--- a/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html
+++ b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html
@@ -17,7 +17,7 @@
<td></td>
</tr>
<tr>
- <td>mouseOver</td>
+ <td>showTooltip</td>
<td>vaadin=runcomvaadintestscomponentsdraganddropwrapperTooltipHandlingWhenNotDefined::PID_StooltipLabel</td>
<td></td>
</tr>
diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.html b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.html
index f6fc12af0a..7733da4e95 100644
--- a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.html
+++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutErrorHover.html
@@ -28,7 +28,7 @@
</tr>
<!--Hover error indicator-->
<tr>
- <td>mouseOver</td>
+ <td>showTooltip</td>
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutErrorHover::/VVerticalLayout[0]/VVerticalLayout[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
diff --git a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java
index 5a158c8f03..b0c597004e 100644
--- a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java
+++ b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java
@@ -53,6 +53,7 @@ public class Notifications extends TestBase implements ClickListener {
public void buttonClick(ClickEvent event) {
Notification n = new Notification(tf.getValue(),
(Integer) type.getValue());
+ n.setHtmlContentAllowed(true);
n.show(Page.getCurrent());
}
}
diff --git a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
index 98f31cd68c..3b77de8b86 100644
--- a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
+++ b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.richtextarea;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ShortcutAction;
+import com.vaadin.terminal.Page;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Component;
@@ -31,7 +32,9 @@ public class RichTextAreaWithKeyboardShortcuts extends TestBase {
String string = f.getValue().toString();
msg += " Value: " + string;
- Notification.show(msg);
+ Notification notification = new Notification(msg);
+ notification.setHtmlContentAllowed(true);
+ notification.show(Page.getCurrent());
}
diff --git a/tests/testbench/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html b/tests/testbench/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html
index 2e69052162..b57c5f978e 100644
--- a/tests/testbench/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html
+++ b/tests/testbench/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html
@@ -40,6 +40,11 @@
</tr>
<!--collapse root2-->
<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[42]/domChild[0]/domChild[0]/domChild[0]</td>
<td>11,-182</td>
@@ -49,7 +54,6 @@
<td></td>
<td>root1-expanded-scrolled-to-end</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/testbench/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html b/tests/testbench/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
index 078aede82f..b7c40b4d9e 100644
--- a/tests/testbench/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
+++ b/tests/testbench/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
@@ -47,6 +47,12 @@
<td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
<td>v-errorindicator</td>
</tr>
+<!--Hide tooltip-->
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]</td>
+ <td></td>
+</tr>
<!--10 -> age-->
<tr>
<td>enterCharacter</td>
diff --git a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
index 9397206f1e..78b8f812b9 100644
--- a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
+++ b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
@@ -596,8 +596,10 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
Button show = new Button("Humanized Notification",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- new Notification(title.getValue(), message.getValue())
- .show(Page.getCurrent());
+ Notification notification = new Notification(
+ title.getValue(), message.getValue());
+ notification.setHtmlContentAllowed(true);
+ notification.show(Page.getCurrent());
}
});
l.addComponent(show);
@@ -606,7 +608,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
show = new Button("Warning Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
new Notification(title.getValue(), message.getValue(),
- Notification.TYPE_WARNING_MESSAGE).show(Page
+ Notification.TYPE_WARNING_MESSAGE, true).show(Page
.getCurrent());
}
@@ -617,7 +619,8 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
show = new Button("Error Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
new Notification(title.getValue(), message.getValue(),
- Notification.TYPE_ERROR_MESSAGE).show(Page.getCurrent());
+ Notification.TYPE_ERROR_MESSAGE, true).show(Page
+ .getCurrent());
}
});
@@ -627,7 +630,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
show = new Button("Tray Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
new Notification(title.getValue(), message.getValue(),
- Notification.TYPE_TRAY_NOTIFICATION).show(Page
+ Notification.TYPE_TRAY_NOTIFICATION, true).show(Page
.getCurrent());
}
diff --git a/tests/testbench/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java b/tests/testbench/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java
index dd32242062..66185ef6a6 100644
--- a/tests/testbench/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java
+++ b/tests/testbench/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java
@@ -41,8 +41,8 @@ public class IntegerTextFieldDataSource extends AbstractTestRoot {
int dataModelValue = myBean.getValue();
Notification.show("UI value (String): " + uiValue
- + "<br />Property value (Integer): " + propertyValue
- + "<br />Data model value (int): " + dataModelValue);
+ + "\nProperty value (Integer): " + propertyValue
+ + "\nData model value (int): " + dataModelValue);
}
});
diff --git a/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html
index cc594882dd..62d972e89f 100644
--- a/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html
+++ b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html
@@ -88,11 +88,21 @@
<td>0,0</td>
</tr>
<tr>
+ <td>waitForVisible</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredEmptyFields::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<tr>
<td>screenCapture</td>
<td></td>
<td>error-must-be-int-and-5-to-10-chars</td>
</tr>
<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredEmptyFields::/VVerticalLayout[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestsvalidationValidationOfRequiredEmptyFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
<td>12,7</td>
@@ -123,11 +133,15 @@
<td>0,0</td>
</tr>
<tr>
+ <td>waitForVisible</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredEmptyFields::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<tr>
<td>screenCapture</td>
<td></td>
<td>empty-invalid-not-required</td>
</tr>
-
</tbody></table>
</body>
</html>