2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.components.orderedlayout;
18 import com.vaadin.server.VaadinRequest;
19 import com.vaadin.tests.components.AbstractTestUI;
20 import com.vaadin.ui.Button;
21 import com.vaadin.ui.Button.ClickEvent;
22 import com.vaadin.ui.Button.ClickListener;
23 import com.vaadin.ui.Component;
24 import com.vaadin.ui.HorizontalLayout;
25 import com.vaadin.ui.VerticalLayout;
26 import com.vaadin.v7.ui.ComboBox;
28 public class InsertComponentInHorizontalLayout extends AbstractTestUI {
29 private VerticalLayout layout;
32 private Component getTestLayout() {
33 ComboBox a = new ComboBox("initial");
34 Button b = new Button("x", new Button.ClickListener() {
37 public void buttonClick(ClickEvent event) {
41 final HorizontalLayout hl = new HorizontalLayout(a, b);
43 Button add = new Button(
44 "Insert 2 comboboxes between combobox(es) and button 'x'");
45 add.addClickListener(new ClickListener() {
47 public void buttonClick(ClickEvent event) {
48 hl.addComponent(new ComboBox("Added " + added++), 1);
49 hl.addComponent(new ComboBox("Added " + added++), 2);
52 layout = new VerticalLayout(hl, add);
57 protected void setup(VaadinRequest request) {
58 setContent(getTestLayout());
62 protected String getTestDescription() {
63 return "Click the button to add two comboboxes between the existing combobox(es) and the 'x' button";
67 protected Integer getTicketNumber() {