diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-10-11 10:31:11 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-10-11 10:31:11 +0300 |
commit | 04413150ac7ef28e50d9e207080f2a00db5a59be (patch) | |
tree | 1b03928961161a5b059c8770a8beab1ea98c5148 /uitest/src/com | |
parent | dec9f91a708d5b7b4ec1d6a2faaddf2b64827d3e (diff) | |
download | vaadin-framework-04413150ac7ef28e50d9e207080f2a00db5a59be.tar.gz vaadin-framework-04413150ac7ef28e50d9e207080f2a00db5a59be.zip |
Use class hierachy for resolving @Connect conflicts (#9826)
Change-Id: Ic268bfb5704a5c9113dee80017196c72b5236b93
Diffstat (limited to 'uitest/src/com')
6 files changed, 189 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/IntermediateReplaceConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/IntermediateReplaceConnector.java new file mode 100644 index 0000000000..7f2b5a9a93 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/IntermediateReplaceConnector.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012 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.widgetset.client; + +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.ReplaceComponent; + +@Connect(value = ReplaceComponent.class) +public class IntermediateReplaceConnector extends ReplacedConnector { + @Override + protected void init() { + super.init(); + getWidget().setHTML( + IntermediateReplaceConnector.class.getName() + + ", should not be used"); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ReplacedConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ReplacedConnector.java new file mode 100644 index 0000000000..7f116e4803 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/ReplacedConnector.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012 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.widgetset.client; + +import com.google.gwt.user.client.ui.HTML; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.ReplaceComponent; + +@Connect(ReplaceComponent.class) +public class ReplacedConnector extends AbstractComponentConnector { + + @Override + protected void init() { + getWidget().setHTML( + ReplacedConnector.class.getName() + ", should not be used"); + } + + @Override + public HTML getWidget() { + return (HTML) super.getWidget(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ReplacingConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ReplacingConnector.java new file mode 100644 index 0000000000..03e50aab16 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/ReplacingConnector.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012 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.widgetset.client; + +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.ReplaceComponent; + +@Connect(value = ReplaceComponent.class) +public class ReplacingConnector extends IntermediateReplaceConnector { + @Override + protected void init() { + super.init(); + getWidget().setHTML( + ReplacingConnector.class.getName() + ", this is the right one"); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.html b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.html new file mode 100644 index 0000000000..79b231949c --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.html @@ -0,0 +1,26 @@ +<?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="" /> +<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.widgetset.server.ReplaceComponentUI?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestswidgetsetserverReplaceComponentUI::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/HTML[0]</td> + <td>com.vaadin.tests.widgetset.client.ReplacingConnector, this is the right one</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.java new file mode 100644 index 0000000000..81c8af95a6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponent.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012 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.widgetset.server; + +import com.vaadin.ui.AbstractComponent; + +public class ReplaceComponent extends AbstractComponent { + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponentUI.java b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponentUI.java new file mode 100644 index 0000000000..1f83cb0d48 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/ReplaceComponentUI.java @@ -0,0 +1,42 @@ +/* + * Copyright 2012 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.widgetset.server; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; + +@Widgetset(TestingWidgetSet.NAME) +public class ReplaceComponentUI extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addComponent(new ReplaceComponent()); + } + + @Override + protected String getTestDescription() { + return "Tests that the right client-side connector is used when there are multiple connectors with @Connect mappings to the same server-side component."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(9826); + } + +} |