diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/widgetset')
32 files changed, 1395 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml new file mode 100644 index 0000000000..c127d3bb21 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -0,0 +1,6 @@ +<module> + <!-- WS Compiler: manually edited --> + + <!-- Inherit the DefaultWidgetSet --> + <inherits name="com.vaadin.DefaultWidgetSet" /> +</module> diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.java b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.java new file mode 100644 index 0000000000..0464a53a95 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.java @@ -0,0 +1,21 @@ +/* + * 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.widgetset; + +public class TestingWidgetSet { + public static final String NAME = "com.vaadin.tests.widgetset.TestingWidgetSet"; +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java new file mode 100644 index 0000000000..9d28b52ae5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/BasicExtensionTestConnector.java @@ -0,0 +1,51 @@ +/* + * 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.widgetset.client; + +import com.google.gwt.dom.client.DivElement; +import com.google.gwt.dom.client.Document; +import com.vaadin.client.ServerConnector; +import com.vaadin.client.Util; +import com.vaadin.client.extensions.AbstractExtensionConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.extensions.BasicExtension; + +@Connect(BasicExtension.class) +public class BasicExtensionTestConnector extends AbstractExtensionConnector { + private ServerConnector target; + + @Override + protected void extend(ServerConnector target) { + this.target = target; + appendMessage(" extending "); + } + + private void appendMessage(String action) { + String message = Util.getSimpleName(this) + action + + Util.getSimpleName(target); + + DivElement element = Document.get().createDivElement(); + element.setInnerText(message); + + Document.get().getBody().insertFirst(element); + } + + @Override + public void onUnregister() { + appendMessage(" removed for "); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ComplexTestBean.java b/uitest/src/com/vaadin/tests/widgetset/client/ComplexTestBean.java new file mode 100644 index 0000000000..af3a278559 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/ComplexTestBean.java @@ -0,0 +1,82 @@ +/* + * 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.widgetset.client; + +import java.util.List; + +import com.vaadin.shared.communication.SharedState; + +@SuppressWarnings("javadoc") +public class ComplexTestBean extends SharedState { + private SimpleTestBean innerBean1; + private SimpleTestBean innerBean2; + private List<SimpleTestBean> innerBeanCollection; + private int privimite; + + public ComplexTestBean() { + // Default + } + + public ComplexTestBean(SimpleTestBean innerBean1, + SimpleTestBean innerBean2, + List<SimpleTestBean> innerBeanCollection, int privimite) { + this.innerBean1 = innerBean1; + this.innerBean2 = innerBean2; + this.innerBeanCollection = innerBeanCollection; + this.privimite = privimite; + } + + public SimpleTestBean getInnerBean1() { + return innerBean1; + } + + public void setInnerBean1(SimpleTestBean innerBean) { + innerBean1 = innerBean; + } + + public SimpleTestBean getInnerBean2() { + return innerBean2; + } + + public void setInnerBean2(SimpleTestBean innerBean2) { + this.innerBean2 = innerBean2; + } + + public List<SimpleTestBean> getInnerBeanCollection() { + return innerBeanCollection; + } + + public void setInnerBeanCollection(List<SimpleTestBean> innerBeanCollection) { + this.innerBeanCollection = innerBeanCollection; + } + + public int getPrivimite() { + return privimite; + } + + public void setPrivimite(int privimite) { + this.privimite = privimite; + } + + @Override + public String toString() { + return "ComplexTestBean [innerBean1=" + innerBean1 + ", innerBean2=" + + innerBean2 + ", innerBeanCollection=" + innerBeanCollection + + ", privimite=" + privimite + "]"; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DelegateConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/DelegateConnector.java new file mode 100644 index 0000000000..c46a5aa007 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/DelegateConnector.java @@ -0,0 +1,34 @@ +/* + * 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.widgetset.client; + +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.DelegateToWidgetComponent; + +@Connect(DelegateToWidgetComponent.class) +public class DelegateConnector extends AbstractComponentConnector { + @Override + public DelegateWidget getWidget() { + return (DelegateWidget) super.getWidget(); + } + + @Override + public DelegateState getState() { + return (DelegateState) super.getState(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java new file mode 100644 index 0000000000..e9ac8a1e61 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java @@ -0,0 +1,50 @@ +/* + * 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.widgetset.client; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.annotations.DelegateToWidget; + +public class DelegateState extends ComponentState { + @DelegateToWidget + public String value1; + + @DelegateToWidget("setValue2") + public int renamedValue2; + + private Boolean value3; + + private double renamedValue4; + + @DelegateToWidget + public void setValue3(Boolean value3) { + this.value3 = value3; + } + + public Boolean getValue3() { + return value3; + } + + @DelegateToWidget("setValue4") + public void setRenamedValue4(double renamedValue4) { + this.renamedValue4 = renamedValue4; + } + + public double getRenamedValue4() { + return renamedValue4; + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DelegateWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/DelegateWidget.java new file mode 100644 index 0000000000..4776eced9a --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/DelegateWidget.java @@ -0,0 +1,50 @@ +/* + * 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.widgetset.client; + +import com.google.gwt.user.client.ui.HTML; + +public class DelegateWidget extends HTML { + private String value1; + private int value2; + private Boolean value3; + private double value4; + + public void setValue1(String value1) { + this.value1 = value1; + updateText(); + } + + public void setValue2(int value2) { + this.value2 = value2; + updateText(); + } + + public void setValue3(Boolean value3) { + this.value3 = value3; + updateText(); + } + + public void setValue4(double value4) { + this.value4 = value4; + } + + private void updateText() { + setHTML(value1 + "<br />" + value2 + "<br />" + value3 + "<br />" + + value4 + "<br />"); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DummyLabelConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/DummyLabelConnector.java new file mode 100644 index 0000000000..601ec6db1f --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/DummyLabelConnector.java @@ -0,0 +1,50 @@ +/* + * 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.widgetset.client; + +import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.client.ui.label.VLabel; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.DummyLabel; + +/** + * Dummy connector just to cause {@link LabelState} to be used to test #8683 + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ +@Connect(DummyLabel.class) +public class DummyLabelConnector extends AbstractComponentConnector { + @Override + public LabelState getState() { + return (LabelState) super.getState(); + } + + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + + getWidget().setText(getState().getText()); + } + + @Override + public VLabel getWidget() { + return (VLabel) super.getWidget(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java new file mode 100644 index 0000000000..91a269e33f --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java @@ -0,0 +1,41 @@ +/* + * 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.widgetset.client; + +import com.vaadin.shared.ComponentState; + +/** + * State class with the same simple name as + * {@link com.vaadin.shared.ui.label.LabelState} to test #8683 + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ +public class LabelState extends ComponentState { + + private String text; + + public void setText(String text) { + this.text = text; + } + + public String getText() { + return text; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/MissingFromDefaultWidgetsetConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/MissingFromDefaultWidgetsetConnector.java new file mode 100644 index 0000000000..bc514047f9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/MissingFromDefaultWidgetsetConnector.java @@ -0,0 +1,38 @@ +/* + * 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.widgetset.client; + +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.client.ui.label.VLabel; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent; + +@Connect(MissingFromDefaultWidgetsetComponent.class) +public class MissingFromDefaultWidgetsetConnector extends + AbstractComponentConnector { + @Override + public VLabel getWidget() { + return (VLabel) super.getWidget(); + } + + @Override + protected void init() { + getWidget() + .setText( + "This component is available in TestingWidgetset, but not in DefaultWidgetset"); + super.init(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java new file mode 100644 index 0000000000..7783178a3b --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -0,0 +1,268 @@ +/* + * 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.widgetset.client; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.vaadin.client.communication.RpcProxy; +import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.extensions.AbstractExtensionConnector; +import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.widgetset.server.SerializerTestExtension; + +@Connect(SerializerTestExtension.class) +public class SerializerTestConnector extends AbstractExtensionConnector { + + private SerializerTestRpc rpc = RpcProxy.create(SerializerTestRpc.class, + this); + + public SerializerTestConnector() { + registerRpc(SerializerTestRpc.class, new SerializerTestRpc() { + @Override + public void sendWrappedGenerics( + Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> generics) { + Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> updated = new HashMap<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>>(); + + SimpleTestBean firstValue = generics.values().iterator().next() + .get(Integer.valueOf(1)).get(0); + Set<SimpleTestBean> key = new HashSet<SimpleTestBean>(Arrays + .asList(firstValue)); + + Map<Integer, List<SimpleTestBean>> value = new HashMap<Integer, List<SimpleTestBean>>(); + Set<SimpleTestBean> firstKeyValue = generics.keySet() + .iterator().next(); + value.put(Integer.valueOf(1), new ArrayList<SimpleTestBean>( + firstKeyValue)); + + updated.put(key, value); + + rpc.sendWrappedGenerics(updated); + } + + @Override + public void sendString(String value) { + char[] chars = value.toCharArray(); + Arrays.sort(chars); + rpc.sendString(new String(chars)); + } + + @Override + public void sendSet(Set<Integer> intSet, + Set<Connector> connectorSet, Set<SimpleTestBean> beanSet) { + + beanSet.iterator().next().setValue(intSet.size()); + Set<Integer> updatedIntSet = new HashSet<Integer>(); + + for (Integer integer : intSet) { + updatedIntSet.add(Integer.valueOf(-integer.intValue())); + } + rpc.sendSet(updatedIntSet, + Collections.singleton(getRootConnector()), beanSet); + } + + @Override + public void sendNestedArray(int[][] nestedIntArray, + SimpleTestBean[][] nestedBeanArray) { + rpc.sendNestedArray(new int[][] { { nestedIntArray[1][0], + nestedIntArray[0][0] } }, new SimpleTestBean[][] { + { nestedBeanArray[0][1] }, { nestedBeanArray[0][0] } }); + } + + @Override + public void sendMap(Map<String, SimpleTestBean> stringMap, + Map<Connector, Boolean> connectorMap, + Map<Integer, Connector> intMap, + Map<SimpleTestBean, SimpleTestBean> beanMap) { + Map<SimpleTestBean, SimpleTestBean> updatedBeanMap = new HashMap<SimpleTestBean, SimpleTestBean>(); + for (Entry<SimpleTestBean, SimpleTestBean> entry : beanMap + .entrySet()) { + updatedBeanMap.put(entry.getValue(), entry.getKey()); + } + + rpc.sendMap(Collections.singletonMap("a", stringMap.get("b")), + Collections.singletonMap(getThisConnector(), + connectorMap.get(getRootConnector())), + Collections.singletonMap( + Integer.valueOf(stringMap.size()), + getThisConnector()), updatedBeanMap); + } + + @Override + public void sendLong(long value, Long boxedValue, long[] array) { + rpc.sendLong(array[0], Long.valueOf(value), new long[] { + array[1], boxedValue.longValue() }); + } + + @Override + public void sendList(List<Integer> intList, + List<Connector> connectorList, List<SimpleTestBean> beanList) { + Collections.sort(intList); + Collections.reverse(beanList); + rpc.sendList(intList, + Arrays.asList(getThisConnector(), getRootConnector()), + beanList); + } + + @Override + public void sendInt(int value, Integer boxedValue, int[] array) { + rpc.sendInt(array.length, Integer.valueOf(array[0]), new int[] { + value, boxedValue.intValue() }); + } + + @Override + public void sendFloat(float value, Float boxedValue, float[] array) { + Arrays.sort(array); + rpc.sendFloat(boxedValue.floatValue(), Float.valueOf(value), + array); + } + + @Override + public void sendDouble(double value, Double boxedValue, + double[] array) { + rpc.sendDouble(value + boxedValue.doubleValue(), + Double.valueOf(value - boxedValue.doubleValue()), + new double[] { array.length, array[0], array[1] }); + } + + @Override + public void sendConnector(Connector connector) { + rpc.sendConnector(getThisConnector()); + } + + @Override + public void sendChar(char value, Character boxedValue, char[] array) { + rpc.sendChar(Character.toUpperCase(boxedValue.charValue()), + Character.valueOf(value), new String(array) + .toLowerCase().toCharArray()); + } + + @Override + public void sendByte(byte value, Byte boxedValue, byte[] array) { + // There will most certainly be a bug that is not discovered + // because this particular method doesn't do anything with it's + // values... + rpc.sendByte(value, boxedValue, array); + } + + @Override + public void sendBoolean(boolean value, Boolean boxedValue, + boolean[] array) { + boolean[] inverseArray = new boolean[array.length]; + for (int i = 0; i < array.length; i++) { + inverseArray[i] = !array[i]; + } + rpc.sendBoolean(boxedValue == Boolean.TRUE, + Boolean.valueOf(!value), inverseArray); + } + + @Override + public void sendBean(ComplexTestBean complexBean, + SimpleTestBean simpleBean, SimpleTestBean[] array) { + SimpleTestBean updatedSimpleBean = new SimpleTestBean(); + updatedSimpleBean.setValue(complexBean.getInnerBean1() + .getValue()); + + ComplexTestBean updatedComplexBean = new ComplexTestBean(); + updatedComplexBean.setInnerBean1(complexBean.getInnerBean2()); + updatedComplexBean.setInnerBean2(complexBean + .getInnerBeanCollection().get(0)); + updatedComplexBean.setInnerBeanCollection(Arrays.asList( + simpleBean, updatedSimpleBean)); + updatedComplexBean.setPrivimite(complexBean.getPrivimite() + 1); + + ArrayList<SimpleTestBean> arrayList = new ArrayList<SimpleTestBean>( + Arrays.asList(array)); + Collections.reverse(arrayList); + + rpc.sendBean(updatedComplexBean, updatedSimpleBean, + arrayList.toArray(new SimpleTestBean[array.length])); + } + + @Override + public void sendArrayList(List<int[]> primitiveArrayList, + List<Integer[]> objectArrayList, + List<SimpleTestBean[]> beanArrayList) { + Collections.reverse(beanArrayList); + List<Integer[]> updatedObjectArrayList = new ArrayList<Integer[]>(); + for (int[] array : primitiveArrayList) { + updatedObjectArrayList.add(new Integer[] { + Integer.valueOf(array.length), + Integer.valueOf(array[0]) }); + } + + rpc.sendArrayList(Arrays.asList( + new int[] { primitiveArrayList.size() }, + new int[] { objectArrayList.get(0).length }), + updatedObjectArrayList, beanArrayList); + } + + @Override + public void sendNull(String value1, String value2) { + rpc.sendNull(value2, value1); + } + + @Override + public void sendListArray(List<Integer>[] objectListArray, + List<SimpleTestBean>[] beanListArray) { + rpc.sendListArray(new List[] { objectListArray[1], + objectListArray[0] }, new List[] { Collections + .singletonList(beanListArray[0].get(0)) }); + } + + @Override + public void sendEnum(ContentMode contentMode, ContentMode[] array, + List<ContentMode> list) { + ContentMode nextContentMode = ContentMode.values()[contentMode + .ordinal() + 1]; + rpc.sendEnum(nextContentMode, + list.toArray(new ContentMode[list.size()]), + Arrays.asList(array)); + } + }); + } + + private Connector getRootConnector() { + return getConnection().getRootConnector(); + } + + private Connector getThisConnector() { + // Cast to Connector for use in e.g. Collections.singleton() to get a + // Set<Connector> + return this; + } + + @Override + public ComplexTestBean getState() { + return (ComplexTestBean) super.getState(); + } + + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + // TODO do something clever + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java new file mode 100644 index 0000000000..0d89976ca0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java @@ -0,0 +1,80 @@ +/* + * 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.widgetset.client; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vaadin.shared.Connector; +import com.vaadin.shared.communication.ClientRpc; +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.label.ContentMode; + +@SuppressWarnings("javadoc") +public interface SerializerTestRpc extends ServerRpc, ClientRpc { + public void sendBoolean(boolean value, Boolean boxedValue, boolean[] array); + + public void sendByte(byte value, Byte boxedValue, byte[] array); + + public void sendChar(char value, Character boxedValue, char[] array); + + public void sendInt(int value, Integer boxedValue, int[] array); + + public void sendLong(long value, Long boxedValue, long[] array); + + public void sendFloat(float value, Float boxedValue, float[] array); + + public void sendDouble(double value, Double boxedValue, double[] array); + + public void sendString(String value); + + public void sendConnector(Connector connector); + + public void sendBean(ComplexTestBean complexBean, + SimpleTestBean simpleBean, SimpleTestBean[] array); + + public void sendNull(String value1, String value2); + + public void sendNestedArray(int[][] nestedIntArray, + SimpleTestBean[][] nestedBeanArray); + + public void sendList(List<Integer> intList, List<Connector> connectorList, + List<SimpleTestBean> beanList); + + public void sendArrayList(List<int[]> primitiveArrayList, + List<Integer[]> objectArrayList, + List<SimpleTestBean[]> beanArrayList); + + public void sendListArray(List<Integer>[] objectListArray, + List<SimpleTestBean>[] beanListArray); + + public void sendSet(Set<Integer> intSet, Set<Connector> connectorSet, + Set<SimpleTestBean> beanSet); + + public void sendMap(Map<String, SimpleTestBean> stringMap, + Map<Connector, Boolean> connectorMap, + Map<Integer, Connector> intMap, + Map<SimpleTestBean, SimpleTestBean> beanMap); + + public void sendWrappedGenerics( + Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> generics); + + public void sendEnum(ContentMode contentMode, ContentMode[] array, + List<ContentMode> list); + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SimpleTestBean.java b/uitest/src/com/vaadin/tests/widgetset/client/SimpleTestBean.java new file mode 100644 index 0000000000..97e333c393 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/SimpleTestBean.java @@ -0,0 +1,50 @@ +/* + * 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.widgetset.client; + +import java.io.Serializable; + +public class SimpleTestBean implements Serializable { + private int value; + + public SimpleTestBean() { + this(0); + } + + public SimpleTestBean(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + @Override + public String toString() { + return "SimpleTestBean(" + value + ")"; + } + + @Override + public int hashCode() { + // Implement hash code to get consistent HashSet.toString + return value; + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/GreetAgainRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/GreetAgainRpc.java new file mode 100644 index 0000000000..8bffbb8e5e --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/GreetAgainRpc.java @@ -0,0 +1,24 @@ +/* + * 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.widgetset.client.helloworldfeature; + +import com.vaadin.shared.communication.ClientRpc; + +public interface GreetAgainRpc extends ClientRpc { + + public void greetAgain(); + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldExtensionConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldExtensionConnector.java new file mode 100644 index 0000000000..76dbdd5370 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldExtensionConnector.java @@ -0,0 +1,61 @@ +/* + * 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.widgetset.client.helloworldfeature; + +import com.google.gwt.user.client.Window; +import com.vaadin.client.ServerConnector; +import com.vaadin.client.Util; +import com.vaadin.client.VConsole; +import com.vaadin.client.communication.RpcProxy; +import com.vaadin.client.extensions.AbstractExtensionConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.extensions.HelloWorldExtension; + +@Connect(HelloWorldExtension.class) +public class HelloWorldExtensionConnector extends AbstractExtensionConnector { + HelloWorldRpc rpc = RpcProxy.create(HelloWorldRpc.class, this); + + @Override + public HelloWorldState getState() { + return (HelloWorldState) super.getState(); + } + + @Override + protected void init() { + registerRpc(GreetAgainRpc.class, new GreetAgainRpc() { + @Override + public void greetAgain() { + greet(); + } + }); + } + + @Override + public void setParent(ServerConnector parent) { + super.setParent(parent); + greet(); + } + + private void greet() { + String msg = getState().getGreeting() + " from " + + Util.getConnectorString(this) + " attached to " + + Util.getConnectorString(getParent()); + VConsole.log(msg); + + String response = Window.prompt(msg, ""); + rpc.onMessageSent(response); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldRpc.java new file mode 100644 index 0000000000..968eb463e2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldRpc.java @@ -0,0 +1,22 @@ +/* + * 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.widgetset.client.helloworldfeature; + +import com.vaadin.shared.communication.ServerRpc; + +public interface HelloWorldRpc extends ServerRpc { + public void onMessageSent(String message); +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldState.java b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldState.java new file mode 100644 index 0000000000..be90719279 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldState.java @@ -0,0 +1,30 @@ +/* + * 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.widgetset.client.helloworldfeature; + +import com.vaadin.shared.communication.SharedState; + +public class HelloWorldState extends SharedState { + private String greeting = "Hello world"; + + public String getGreeting() { + return greeting; + } + + public void setGreeting(String greeting) { + this.greeting = greeting; + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java new file mode 100644 index 0000000000..63947c2435 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java @@ -0,0 +1,32 @@ +/* + * 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.widgetset.client.minitutorials.v7a2; + +import com.vaadin.shared.ComponentState; +import com.vaadin.shared.Connector; + +public class ComponentInStateState extends ComponentState { + private Connector otherComponent; + + public Connector getOtherComponent() { + return otherComponent; + } + + public void setOtherComponent(Connector otherComponent) { + this.otherComponent = otherComponent; + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateStateConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateStateConnector.java new file mode 100644 index 0000000000..35469e7501 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateStateConnector.java @@ -0,0 +1,50 @@ +/* + * 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.widgetset.client.minitutorials.v7a2; + +import com.google.gwt.user.client.ui.Label; +import com.vaadin.client.ComponentConnector; +import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.minitutorials.v7a2.ComponentInStateComponent; + +@Connect(ComponentInStateComponent.class) +public class ComponentInStateStateConnector extends AbstractComponentConnector { + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + + getWidget().setText( + "Client-side type of other component: " + + getOtherComponent().getClass().getName()); + } + + public ComponentConnector getOtherComponent() { + return (ComponentConnector) getState().getOtherComponent(); + } + + @Override + public ComponentInStateState getState() { + return (ComponentInStateState) super.getState(); + } + + @Override + public Label getWidget() { + return (Label) super.getWidget(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentClientRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentClientRpc.java new file mode 100644 index 0000000000..f85d67da4b --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentClientRpc.java @@ -0,0 +1,9 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.vaadin.shared.communication.ClientRpc; + +public interface MyComponentClientRpc extends ClientRpc { + + public void alert(String message); + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentConnector.java new file mode 100644 index 0000000000..c80a4c88f0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentConnector.java @@ -0,0 +1,58 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.user.client.Window; +import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.communication.RpcProxy; +import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.minitutorials.v7a2.MyComponent; + +@Connect(MyComponent.class) +public class MyComponentConnector extends AbstractComponentConnector { + + MyComponentServerRpc rpc = RpcProxy + .create(MyComponentServerRpc.class, this); + + public MyComponentConnector() { + getWidget().addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + + final MouseEventDetails mouseDetails = MouseEventDetailsBuilder + .buildMouseEventDetails(event.getNativeEvent(), + getWidget().getElement()); + + rpc.clicked(mouseDetails); + } + }); + registerRpc(MyComponentClientRpc.class, new MyComponentClientRpc() { + @Override + public void alert(String message) { + Window.alert(message); + } + }); + } + + @Override + public MyComponentState getState() { + return (MyComponentState) super.getState(); + } + + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + + final String text = getState().getText(); + getWidget().setText(text); + } + + @Override + public MyComponentWidget getWidget() { + return (MyComponentWidget) super.getWidget(); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentServerRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentServerRpc.java new file mode 100644 index 0000000000..5571ffb701 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentServerRpc.java @@ -0,0 +1,10 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface MyComponentServerRpc extends ServerRpc { + + public void clicked(MouseEventDetails mouseDetails); + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java new file mode 100644 index 0000000000..8b68331f30 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java @@ -0,0 +1,17 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.vaadin.shared.ComponentState; + +public class MyComponentState extends ComponentState { + + private String text; + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentWidget.java new file mode 100644 index 0000000000..729a867f16 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentWidget.java @@ -0,0 +1,28 @@ +/* + * 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.widgetset.client.minitutorials.v7a2; + +import com.google.gwt.user.client.ui.Label; + +public class MyComponentWidget extends Label { + public static final String CLASSNAME = "mycomponent"; + + public MyComponentWidget() { + setText("This is MyComponent"); + setStyleName(CLASSNAME); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateConnector.java new file mode 100644 index 0000000000..93b12dbc68 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateConnector.java @@ -0,0 +1,49 @@ +/* + * 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.widgetset.client.minitutorials.v7a2; + +import com.google.gwt.user.client.ui.Image; +import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.minitutorials.v7a2.ResourceInStateComponent; + +@Connect(ResourceInStateComponent.class) +public class ResourceInStateConnector extends AbstractComponentConnector { + @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + String icon = getResourceUrl(ResourceInStateState.MY_ICON_RESOURCE); + + if (icon != null) { + getWidget().setUrl(icon); + } else { + getWidget().setUrl(""); + } + + } + + @Override + public ResourceInStateState getState() { + return (ResourceInStateState) super.getState(); + } + + @Override + public Image getWidget() { + return (Image) super.getWidget(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateState.java new file mode 100644 index 0000000000..728f0ba5e1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ResourceInStateState.java @@ -0,0 +1,7 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.vaadin.shared.ComponentState; + +public class ResourceInStateState extends ComponentState { + public static final String MY_ICON_RESOURCE = "myIcon"; +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/VWidgetContainer.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/VWidgetContainer.java new file mode 100644 index 0000000000..6ec0a6da7c --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/VWidgetContainer.java @@ -0,0 +1,12 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import com.google.gwt.user.client.ui.VerticalPanel; + +public class VWidgetContainer extends VerticalPanel { + + public static final String CLASSNAME = "v-widgetcontainer"; + + public VWidgetContainer() { + setStyleName(CLASSNAME); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java new file mode 100644 index 0000000000..fc65f6b2ae --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.widgetset.client.minitutorials.v7a2; + +import java.util.List; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; +import com.vaadin.client.ui.AbstractComponentContainerConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.minitutorials.v7a2.WidgetContainer; + +@Connect(WidgetContainer.class) +public class WidgetContainerConnector extends + AbstractComponentContainerConnector { + + @Override + public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + List<ComponentConnector> children = getChildComponents(); + VWidgetContainer widget = (VWidgetContainer) getWidget(); + widget.clear(); + for (ComponentConnector connector : children) { + widget.add(connector.getWidget()); + } + super.onConnectorHierarchyChange(event); + } + + @Override + protected Widget createWidget() { + return GWT.create(VWidgetContainer.class); + } + + @Override + public void updateCaption(ComponentConnector connector) { + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/widgetset/server/DelegateToWidgetComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/DelegateToWidgetComponent.java new file mode 100644 index 0000000000..34c9699f7f --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/DelegateToWidgetComponent.java @@ -0,0 +1,35 @@ +/* + * 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.widgetset.server; + +import com.vaadin.tests.widgetset.client.DelegateState; +import com.vaadin.ui.AbstractComponent; + +public class DelegateToWidgetComponent extends AbstractComponent { + public DelegateToWidgetComponent() { + DelegateState state = getState(); + state.value1 = "My String"; + state.renamedValue2 = 42; + state.setValue3(Boolean.TRUE); + state.setRenamedValue4(Math.PI); + } + + @Override + protected DelegateState getState() { + return (DelegateState) super.getState(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/DummyLabel.java b/uitest/src/com/vaadin/tests/widgetset/server/DummyLabel.java new file mode 100644 index 0000000000..bda36d64a8 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/DummyLabel.java @@ -0,0 +1,38 @@ +/* + * 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.widgetset.server; + +import com.vaadin.tests.widgetset.client.LabelState; +import com.vaadin.ui.AbstractComponent; + +/** + * Dummy component to cause {@link LabelState} to be used to test #8683 + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ +public class DummyLabel extends AbstractComponent { + public DummyLabel(String text) { + getState().setText(text); + } + + @Override + public LabelState getState() { + return (LabelState) super.getState(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/MissingFromDefaultWidgetsetComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/MissingFromDefaultWidgetsetComponent.java new file mode 100644 index 0000000000..5987bfb539 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/MissingFromDefaultWidgetsetComponent.java @@ -0,0 +1,22 @@ +/* + * 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.widgetset.server; + +import com.vaadin.ui.AbstractComponent; + +public class MissingFromDefaultWidgetsetComponent extends AbstractComponent { + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/SerializerTestExtension.java b/uitest/src/com/vaadin/tests/widgetset/server/SerializerTestExtension.java new file mode 100644 index 0000000000..978ed80ed5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/SerializerTestExtension.java @@ -0,0 +1,34 @@ +/* + * 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.widgetset.server; + +import com.vaadin.server.AbstractExtension; +import com.vaadin.tests.widgetset.client.ComplexTestBean; +import com.vaadin.tests.widgetset.client.SerializerTestRpc; + +public class SerializerTestExtension extends AbstractExtension { + + @Override + public ComplexTestBean getState() { + return (ComplexTestBean) super.getState(); + } + + public void registerRpc(SerializerTestRpc rpc) { + super.registerRpc(rpc); + } + +} |