// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGenerator.java
// public interface ComponentGenerator<T> extends Serializable {
// 
//     /**
//      * Called to generate the component for a component cell based
//      * on the passed typed bean.
//      *
//      * @param bean the bean being the source for the current row's data
//      * @return a <b>new</b> instance of the component used to display the data
//      */
//     Component getComponent(T bean);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGrid.java
// public class ComponentGrid<T> extends Grid {
// 
//     private final ComponentGridDecorator<T> componentGridDecorator;
// 
//     public ComponentGrid(Class<T> typeOfRows) {
//         super();
//         setContainerDataSource(new BeanItemContainer<T>(typeOfRows));
//         componentGridDecorator = new ComponentGridDecorator<T>(this, typeOfRows);
//     }
// 
//     public ComponentGridDecorator<T> getComponentGridDecorator() {
//         return componentGridDecorator;
//     }
// 
//     public FocusPreserveExtension getFocusPreserveExtension() {
//         return componentGridDecorator.getFocusPreserveExtension();
//     }
// 
//     /**
//      * Remove a bean from the grid.
//      *
//      * @return the decorator for method chaining
//      */
//     public ComponentGrid<T> remove(T bean) {
//         componentGridDecorator.remove(bean);
//         return this;
//     }
// 
//     /**
//      * Add a bean to the grid.
//      *
//      * @return the decorator for method chaining
//      */
//     public ComponentGrid<T>  add(T bean) {
//         componentGridDecorator.add(bean);
//         return this;
//     }
// 
//     /**
//      * Add all beans to the decorated grid's container.
//      *
//      * @param beans a collection of beans
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> addAll(Collection<T> beans) {
//         componentGridDecorator.addAll(beans);
//         return this;
//     }
// 
//     /**
//      * Add a generated component column to the ComponentGrid.
//      *
//      * @param propertyId the generated column's property-id
//      * @param generator  the component-generator
//      * @return the grid for method chaining
//      */
//     public Grid.Column  addComponentColumn(Object propertyId, ComponentGenerator<T> generator) {
//         return componentGridDecorator.addComponentColumn(propertyId, generator);
//     }
// 
//     /**
//      * Refreshes the grid preserving its current cell focus.
//      */
//     public ComponentGrid<T>  refresh() {
//         componentGridDecorator.refresh();
//         return this;
//     }
// 
//     /**
//      * Remove all items from the underlying {@link BeanItemContainer} and add
//      * the new beans.
//      *
//      * @param beans a collection of beans
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T>  setRows(Collection<T> beans) {
//         componentGridDecorator.setRows(beans);
//         return this;
//     }
//     /**
//      * Generates component header fields using the passed {@link ComponentHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(ComponentHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// 
//     /**
//      * Generates text header fields using the passed {@link TextHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(TextHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// 
//     /**
//      * Generates html header fields using the passed {@link HtmlHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(HtmlHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// }


import com.vaadin.server.Sizeable;
import com.vaadin.ui.Component;
import com.vaadin.ui.TabSheet;
import com.vaadin.v7.ui.ComboBox;
import com.vaadin.v7.ui.Grid;
import com.vaadin.v7.ui.VerticalLayout;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGrid;
import java.util.HashMap;
import java.util.Map;
/*
 * Licensed under the Apache License,Version2.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 de.datenhahn.vaadin.componentrenderer.demo;



/**
 * Regression Test for
 * Issue #32: Vanishing components, when using cached components
 *
 * see also
 *
 * https://github.com/datenhahn/componentrenderer/pull/31
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
public class TestbenchCachingGridTab extends VerticalLayout {

    public TestbenchCachingGridTab() {
        init();
    }

// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGenerator.java
// public interface ComponentGenerator<T> extends Serializable {
// 
//     /**
//      * Called to generate the component for a component cell based
//      * on the passed typed bean.
//      *
//      * @param bean the bean being the source for the current row's data
//      * @return a <b>new</b> instance of the component used to display the data
//      */
//     Component getComponent(T bean);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGrid.java
// public class ComponentGrid<T> extends Grid {
// 
//     private final ComponentGridDecorator<T> componentGridDecorator;
// 
//     public ComponentGrid(Class<T> typeOfRows) {
//         super();
//         setContainerDataSource(new BeanItemContainer<T>(typeOfRows));
//         componentGridDecorator = new ComponentGridDecorator<T>(this, typeOfRows);
//     }
// 
//     public ComponentGridDecorator<T> getComponentGridDecorator() {
//         return componentGridDecorator;
//     }
// 
//     public FocusPreserveExtension getFocusPreserveExtension() {
//         return componentGridDecorator.getFocusPreserveExtension();
//     }
// 
//     /**
//      * Remove a bean from the grid.
//      *
//      * @return the decorator for method chaining
//      */
//     public ComponentGrid<T> remove(T bean) {
//         componentGridDecorator.remove(bean);
//         return this;
//     }
// 
//     /**
//      * Add a bean to the grid.
//      *
//      * @return the decorator for method chaining
//      */
//     public ComponentGrid<T>  add(T bean) {
//         componentGridDecorator.add(bean);
//         return this;
//     }
// 
//     /**
//      * Add all beans to the decorated grid's container.
//      *
//      * @param beans a collection of beans
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> addAll(Collection<T> beans) {
//         componentGridDecorator.addAll(beans);
//         return this;
//     }
// 
//     /**
//      * Add a generated component column to the ComponentGrid.
//      *
//      * @param propertyId the generated column's property-id
//      * @param generator  the component-generator
//      * @return the grid for method chaining
//      */
//     public Grid.Column  addComponentColumn(Object propertyId, ComponentGenerator<T> generator) {
//         return componentGridDecorator.addComponentColumn(propertyId, generator);
//     }
// 
//     /**
//      * Refreshes the grid preserving its current cell focus.
//      */
//     public ComponentGrid<T>  refresh() {
//         componentGridDecorator.refresh();
//         return this;
//     }
// 
//     /**
//      * Remove all items from the underlying {@link BeanItemContainer} and add
//      * the new beans.
//      *
//      * @param beans a collection of beans
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T>  setRows(Collection<T> beans) {
//         componentGridDecorator.setRows(beans);
//         return this;
//     }
//     /**
//      * Generates component header fields using the passed {@link ComponentHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(ComponentHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// 
//     /**
//      * Generates text header fields using the passed {@link TextHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(TextHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// 
//     /**
//      * Generates html header fields using the passed {@link HtmlHeaderGenerator} and
//      * sets them to the columns.
//      *
//      * @param generator the header generator
//      * @return the grid for method chaining
//      */
//     public ComponentGrid<T> generateHeaders(HtmlHeaderGenerator generator) {
//         componentGridDecorator.generateHeaders(generator);
//         return this;
//     }
// }


// Path: componentrenderer-demo/src/main/java/de/datenhahn/vaadin/componentrenderer/demo/TestbenchCachingGridTab.java
import com.vaadin.server.Sizeable;
import com.vaadin.ui.Component;
import com.vaadin.ui.TabSheet;
import com.vaadin.v7.ui.ComboBox;
import com.vaadin.v7.ui.Grid;
import com.vaadin.v7.ui.VerticalLayout;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGrid;
import java.util.HashMap;
import java.util.Map;

/*
 * Licensed under the Apache License,Version2.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 de.datenhahn.vaadin.componentrenderer.demo;



/**
 * Regression Test for
 * Issue #32: Vanishing components, when using cached components
 *
 * see also
 *
 * https://github.com/datenhahn/componentrenderer/pull/31
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
public class TestbenchCachingGridTab extends VerticalLayout {

    public TestbenchCachingGridTab() {
        init();
    }

    class TestComponentGenerator implements ComponentGenerator<Customer> {