From 3c05a351908353c4c99c14bb5a8fcd3ea9fc7afe Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 29 Nov 2012 12:02:47 +0200 Subject: Update GridLayout DOM in onConnectorHierarchyChange (#10324, #10097) * Add ChildComponentData that is sent in the state instead of previous UIDL data * Store child data in a map instead of as a linked list * Move Cell instead of moving component form one Cell to the other if moved * Clean up internal state in remove(Widget) Change-Id: I3dabe0165b6dcdf70c0df06a0151b73d080187a5 --- .../components/gridlayout/InsertRowInMiddle.html | 31 +++++++++++++ .../components/gridlayout/InsertRowInMiddle.java | 54 ++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.html create mode 100644 uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.html b/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.html new file mode 100644 index 0000000000..7de29edd1b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.html @@ -0,0 +1,31 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.gridlayout.InsertRowInMiddle?restartApplication
clickvaadin=runcomvaadintestscomponentsgridlayoutInsertRowInMiddle::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentsgridlayoutInsertRowInMiddle::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[1]some new row
+ + diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java b/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java new file mode 100644 index 0000000000..0fc764e463 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java @@ -0,0 +1,54 @@ +/* + * 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.components.gridlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; + +public class InsertRowInMiddle extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final GridLayout layout = new GridLayout(1, 2); + layout.addComponent(new Label("some row"), 0, 0); + Button newRowButton = new Button("Insert Row"); + newRowButton.addListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + layout.insertRow(1); + layout.addComponent(new Label("some new row"), 0, 1); + } + }); + layout.addComponent(newRowButton, 0, 1); + addComponent(layout); + } + + @Override + protected String getTestDescription() { + return "A new row added to the middle of a GridLayout should appear without any exception being thrown."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(10097); + } + +} -- cgit v1.2.3