/*
   * (non-Javadoc)
   *
   * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
   * VaadinRequest)
   */
  @Override
  protected void setup(VaadinRequest request) {
    final Table table = new Table("Test table", buildContainer());
    table.setSizeFull();
    addComponent(table);
    Button sortButton =
        new Button(
            "Sort",
            new ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {
                table.sort(new Object[] {"val1"}, new boolean[] {false});
              }
            });
    addComponent(sortButton);
  }
  @Override
  protected void setup() {
    getLayout().setSizeFull();

    final Table table = new Table();
    table.setSizeFull();

    table.addContainerProperty("column1", String.class, "Humpty");
    table.addContainerProperty("column2", String.class, "Dumpty");
    table.addContainerProperty("column3", String.class, "Doe");

    for (int row = 0; row < 100; row++) {
      table.addItem();
    }

    HorizontalLayout buttons = new HorizontalLayout();
    for (Object col : table.getContainerPropertyIds()) {
      buttons.addComponent(createResetButton(col, table));
    }

    addComponent(table);
    addComponent(buttons);
  }
  @Override
  protected void setup(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();

    final Table table = new Table();
    table.setColumnReorderingAllowed(true);
    table.setSizeFull();

    BeanItemContainer<TestItem> cont = new BeanItemContainer<>(TestItem.class);

    for (int i = 0; i < ROW_COUNT; i++) {
      TestItem ti = new TestItem();
      ti.setValue1("Value1_" + i);
      ti.setValue2("Value2_" + (ROW_COUNT - i));
      ti.setValue3("Value3_" + i);
      ti.setValue4("Value4_" + (ROW_COUNT - i));
      ti.setValue5("Value5_" + i);
      cont.addBean(ti);
    }

    table.setContainerDataSource(cont);
    table.setImmediate(true);
    table.setSelectable(true);
    table.setMultiSelect(false);

    table.setPageLength(10);
    table.setDragMode(Table.TableDragMode.ROW);

    table.setDropHandler(
        new DropHandler() {
          @Override
          public void drop(DragAndDropEvent dragAndDropEvent) {}

          @Override
          public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
          }
        });

    table.addColumnReorderListener(
        new ColumnReorderListener() {

          @Override
          public void columnReorder(ColumnReorderEvent event) {
            System.out.println("columnReorder");
          }
        });

    table.addHeaderClickListener(
        new HeaderClickListener() {

          @Override
          public void headerClick(HeaderClickEvent event) {
            System.out.println("Header was clicked");
          }
        });

    layout.addComponent(table);

    addComponent(layout);
  }