diff options
author | Artur Signell <artur@vaadin.com> | 2013-02-14 14:49:20 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-02-14 14:52:32 +0200 |
commit | 54597654e13a2d2dd98fae14e762eb8e325ec514 (patch) | |
tree | b75fc7286046e3f0180a16a70a31556e3cef0788 | |
parent | 69d6f8b78983302785c6bd9ab02bd8b42194b2b7 (diff) | |
download | vaadin-framework-54597654e13a2d2dd98fae14e762eb8e325ec514.tar.gz vaadin-framework-54597654e13a2d2dd98fae14e762eb8e325ec514.zip |
Fixed problem with removing the icon from a Button (#10543)
Change-Id: Ia119b93643678494db95d36ffe031a44b76ba578
3 files changed, 111 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/com/vaadin/client/ui/button/ButtonConnector.java index 0439cd4fdc..9733d206c7 100644 --- a/client/src/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/com/vaadin/client/ui/button/ButtonConnector.java @@ -77,7 +77,7 @@ public class ButtonConnector extends AbstractComponentConnector implements } }); - addStateChangeHandler("resources.icon", new StateChangeHandler() { + addStateChangeHandler("resources", new StateChangeHandler() { @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { if (getIcon() != null) { diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html new file mode 100644 index 0000000000..642abd8120 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.button.ButtonToggleIcons?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>v-icon</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]</td> + <td>v-icon</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>v-icon</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]</td> + <td>40,14</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]</td> + <td>v-icon</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td>v-icon</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]</td> + <td>40,14</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]</td> + <td>v-icon</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java new file mode 100644 index 0000000000..626ed1d250 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java @@ -0,0 +1,38 @@ +package com.vaadin.tests.components.button;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+public class ButtonToggleIcons extends UI {
+
+ @Override
+ protected void init(final VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ setContent(layout);
+
+ final ThemeResource iconResource = new ThemeResource(
+ "../runo/icons/16/arrow-left.png");
+
+ final ClickListener iconToggleListener = new ClickListener() {
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ final Button btn = event.getButton();
+ if (btn.getIcon() == null) {
+ btn.setIcon(iconResource);
+ } else {
+ btn.setIcon(null);
+ }
+ }
+ };
+
+ layout.addComponent(new Button("Toggle icon", iconToggleListener));
+ layout.addComponent(new NativeButton("Toggle icon", iconToggleListener));
+ }
+}
\ No newline at end of file |