// 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 de.datenhahn.vaadin.componentrenderer.grid.ComponentGrid;
import com.vaadin.ui.Button;
import com.vaadin.v7.ui.Label;
import com.vaadin.v7.ui.VerticalLayout;
/*
 * 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.
 */

/**
 * 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;


/**
 * Demonstrates the use of the typed ComponentGrid
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
public class TestbenchComponentGridTab extends VerticalLayout {

    private static final String GENERATED_FOOD_ICON = "foodIcon";
    private static final String GENERATED_RATING = "rating";
    private static final String GENERATED_DELETE = "delete";
    private static final String GENERATED_DETAILS_ICONS = "detailsIcons";

    public TestbenchComponentGridTab() {
        init();
    }

    private void init() {

        setSizeFull();
        setMargin(true);
        setSpacing(true);

        addComponent(new Label("Look at the sourcecode to see the difference between the typed ComponentGrid and using" +
                " the classic grid"));
// 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/TestbenchComponentGridTab.java
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGrid;
import com.vaadin.ui.Button;
import com.vaadin.v7.ui.Label;
import com.vaadin.v7.ui.VerticalLayout;

/*
 * 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.
 */

/**
 * 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;


/**
 * Demonstrates the use of the typed ComponentGrid
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
public class TestbenchComponentGridTab extends VerticalLayout {

    private static final String GENERATED_FOOD_ICON = "foodIcon";
    private static final String GENERATED_RATING = "rating";
    private static final String GENERATED_DELETE = "delete";
    private static final String GENERATED_DETAILS_ICONS = "detailsIcons";

    public TestbenchComponentGridTab() {
        init();
    }

    private void init() {

        setSizeFull();
        setMargin(true);
        setSpacing(true);

        addComponent(new Label("Look at the sourcecode to see the difference between the typed ComponentGrid and using" +
                " the classic grid"));
        ComponentGrid<Customer> grid = new ComponentGrid<>(Customer.class);