Hi,
We're running SmartGWT 4.1d pre-release version.
We're currently working on a tile grid which needs to display tiles composed of an image on the left and two labels on the right.
Overriding TileGrid.getTile(int recordNum) did the trick for customizing the layout. Instead of the SimpleTile normally created, we return a custom Canvas.
Layout is ok with that but we lost the default capabilities of SimpleTile like selection, hover styling, ...
Looking in previous posts, you recommend to override SimpleTile instead of Canvas in the custom tile class: what we did but didn't work as it raises several exceptions like
The custom TileGrid code:
Custom tile constructor code:
Help would be appreciated.
Thanks in advance
Regards
Antoine
We're running SmartGWT 4.1d pre-release version.
We're currently working on a tile grid which needs to display tiles composed of an image on the left and two labels on the right.
Overriding TileGrid.getTile(int recordNum) did the trick for customizing the layout. Instead of the SimpleTile normally created, we return a custom Canvas.
Layout is ok with that but we lost the default capabilities of SimpleTile like selection, hover styling, ...
Looking in previous posts, you recommend to override SimpleTile instead of Canvas in the custom tile class: what we did but didn't work as it raises several exceptions like
Code:
com.google.gwt.core.client.JavaScriptException: (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(6383), JavaScript object(6324), JavaScript object(10817)]): Unable to get property 'valuesShowDown' of undefined or null reference at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) at sun.reflect.GeneratedMethodAccessor315.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Thread.java:662)
Code:
@Override public Canvas getTile(int recordNum) { if (tileCache.get(recordNum) != null) return tileCache.get(recordNum); CaseElementTile elemTile = new CaseElementTile(); elemTile.setData(getRecordList().get(recordNum)); tileCache.put(recordNum, elemTile); return elemTile; }
Code:
public CaseElementTile() { form = new DynamicForm(); form.setNumCols(2); form.setHeight(40); form.setCellPadding(3); form.setColWidths("45", "*"); elementImg = new Img(); elementImageItem = new CanvasItem("ICON"); elementImageItem.setWidth(35); elementImageItem.setHeight(35); elementImageItem.setShouldSaveValue(true); elementImageItem.setShowTitle(false); elementImageItem.setCanvas(elementImg); label = new Label("<No label>"); label.setHeight(15); reference = new Label("<No ref>"); reference.setHeight(15); VLayout v = new VLayout(2); v.setHeight(35); v.setAlign(VerticalAlignment.CENTER); v.setMembers(label, reference); labelAndRef = new CanvasItem("labelAndRef"); labelAndRef.setShouldSaveValue(true); labelAndRef.setShowTitle(false); labelAndRef.setCanvas(v); form.setFields(elementImageItem, labelAndRef); addChild(form); }
Thanks in advance
Regards
Antoine
Comment