// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/FocusPreserveExtension.java
// public class FocusPreserveExtension extends Grid.AbstractGridExtension {
//     private final FocusPreservingRefreshClientRpc focusRpc = getRpcProxy(FocusPreservingRefreshClientRpc.class);
// 
//     private FocusPreserveExtension(final Grid grid) {
//         super.extend(grid);
//     }
// 
//     public static FocusPreserveExtension extend(Grid grid) {
//         return new FocusPreserveExtension(grid);
//     }
// 
//     /**
//      * Saves the grid's current focus in this extension's internal state.
//      */
//     public void saveFocus() {
//         focusRpc.saveFocus();
//     }
// 
//     /**
//      * Restores the grid's focus from  extension's internal state.
//      */
//     public void restoreFocus() {
//         focusRpc.restoreFocus();
//     }
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/ComponentHeaderGenerator.java
// public interface ComponentHeaderGenerator extends HeaderGenerator<Component> {
// 
//     @Override
//     Component getHeader(Object propertyId);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/HtmlHeaderGenerator.java
// public interface HtmlHeaderGenerator extends HeaderGenerator<String> {
// 
//     @Override
//     String getHeader(Object propertyId);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/TextHeaderGenerator.java
// public interface TextHeaderGenerator extends HeaderGenerator<String> {
// 
//     @Override
//     String getHeader(Object propertyId);
// }


import com.vaadin.v7.data.util.BeanItemContainer;
import com.vaadin.v7.data.util.GeneratedPropertyContainer;
import com.vaadin.v7.ui.Grid;
import de.datenhahn.vaadin.componentrenderer.FocusPreserveExtension;
import de.datenhahn.vaadin.componentrenderer.grid.header.ComponentHeaderGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.header.HtmlHeaderGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.header.TextHeaderGenerator;
import java.util.Collection;
/**
 * 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.grid;



/**
 * A typed version of the grid using a {@link BeanItemContainer} to store
 * the typed grid data and a {@link GeneratedPropertyContainer} to provide
 * generated component-columns.
 *
 * Also offers some convenience methods for this use-case (typed, use of components).
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
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;
    }

// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/FocusPreserveExtension.java
// public class FocusPreserveExtension extends Grid.AbstractGridExtension {
//     private final FocusPreservingRefreshClientRpc focusRpc = getRpcProxy(FocusPreservingRefreshClientRpc.class);
// 
//     private FocusPreserveExtension(final Grid grid) {
//         super.extend(grid);
//     }
// 
//     public static FocusPreserveExtension extend(Grid grid) {
//         return new FocusPreserveExtension(grid);
//     }
// 
//     /**
//      * Saves the grid's current focus in this extension's internal state.
//      */
//     public void saveFocus() {
//         focusRpc.saveFocus();
//     }
// 
//     /**
//      * Restores the grid's focus from  extension's internal state.
//      */
//     public void restoreFocus() {
//         focusRpc.restoreFocus();
//     }
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/ComponentHeaderGenerator.java
// public interface ComponentHeaderGenerator extends HeaderGenerator<Component> {
// 
//     @Override
//     Component getHeader(Object propertyId);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/HtmlHeaderGenerator.java
// public interface HtmlHeaderGenerator extends HeaderGenerator<String> {
// 
//     @Override
//     String getHeader(Object propertyId);
// }
// 
// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/header/TextHeaderGenerator.java
// public interface TextHeaderGenerator extends HeaderGenerator<String> {
// 
//     @Override
//     String getHeader(Object propertyId);
// }


// Path: componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGrid.java
import com.vaadin.v7.data.util.BeanItemContainer;
import com.vaadin.v7.data.util.GeneratedPropertyContainer;
import com.vaadin.v7.ui.Grid;
import de.datenhahn.vaadin.componentrenderer.FocusPreserveExtension;
import de.datenhahn.vaadin.componentrenderer.grid.header.ComponentHeaderGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.header.HtmlHeaderGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.header.TextHeaderGenerator;
import java.util.Collection;

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



/**
 * A typed version of the grid using a {@link BeanItemContainer} to store
 * the typed grid data and a {@link GeneratedPropertyContainer} to provide
 * generated component-columns.
 *
 * Also offers some convenience methods for this use-case (typed, use of components).
 *
 * @author Jonas Hahn (jonas.hahn@datenhahn.de)
 */
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() {