We are using TileGrid to show a datasource in tile form. We have created a custom class which is extending DynamicForm to create tile. In our Tile we have one StaticTextItem with some other fields. Our requirement is to provide click handler on this static text item from outside. Below is the code for CustomTileGrid :
public class CustomTileGrid extends TileGrid{ public interface ProductSelectorMetaFactory extends BeanFactory.MetaFactory { BeanFactory<ProductSelectorTile> getProductSelectorTileFactory(); } public CustomTileGrid(DataSource cardViewDataSource, ProductSelectorTile tileType, String fieldState, List<DetailViewerField> list) { setDataSource(cardViewDataSource); setAutoFetchData(true); GWT.create(ProductSelectorMetaFactory.class); setTileConstructor(tileType.getClass().getName()); // I want to pass a clickhandler here to my tile class but do not have any option } } public class ProductSelectorTile extends DynamicForm { StaticTextItem pdfOpenImage = new StaticTextItem(); public ProductSelectorTile(ClickHandler clickHandler) { pdfOpenImage.addClickHandler(clickHandler); setFields(pdfOpenImage); } } Here ProductSelectorTile is our tile class which is extending DynamicForm which inside have one SelectTextItem. Till now what we found is that we can not pass any ClickHandler to Tile class constructor. It always look for default constructor and if ClickHandler passed via any setter method : it is not effective on that tile. Could you please help us to understand if there is any way using that we can pass our click handlers to Tile class. Any help is appreciated.
public class CustomTileGrid extends TileGrid{ public interface ProductSelectorMetaFactory extends BeanFactory.MetaFactory { BeanFactory<ProductSelectorTile> getProductSelectorTileFactory(); } public CustomTileGrid(DataSource cardViewDataSource, ProductSelectorTile tileType, String fieldState, List<DetailViewerField> list) { setDataSource(cardViewDataSource); setAutoFetchData(true); GWT.create(ProductSelectorMetaFactory.class); setTileConstructor(tileType.getClass().getName()); // I want to pass a clickhandler here to my tile class but do not have any option } } public class ProductSelectorTile extends DynamicForm { StaticTextItem pdfOpenImage = new StaticTextItem(); public ProductSelectorTile(ClickHandler clickHandler) { pdfOpenImage.addClickHandler(clickHandler); setFields(pdfOpenImage); } } Here ProductSelectorTile is our tile class which is extending DynamicForm which inside have one SelectTextItem. Till now what we found is that we can not pass any ClickHandler to Tile class constructor. It always look for default constructor and if ClickHandler passed via any setter method : it is not effective on that tile. Could you please help us to understand if there is any way using that we can pass our click handlers to Tile class. Any help is appreciated.
Comment