Hi there,
I'm using SmartGWT 3.1p-2013-06-14 with GWT 2.5.1.
I'm creating some custom types for recurring form items and I'm having trouble when using editorTypes that aren't standard FormItems (TextItem, ComboBoxItem, etc...). I have some form items that are Canvas Items and when setting them as editorType, it doesn't show on the form.
Here's some sample code:
Looking at the isc console I can see that a canvas has been created.
Is it possible to use custom CanvasItems with SimpleType?
I'm using SmartGWT 3.1p-2013-06-14 with GWT 2.5.1.
I'm creating some custom types for recurring form items and I'm having trouble when using editorTypes that aren't standard FormItems (TextItem, ComboBoxItem, etc...). I have some form items that are Canvas Items and when setting them as editorType, it doesn't show on the form.
Here's some sample code:
Code:
import com.smartgwt.client.data.SimpleType; import com.smartgwt.client.types.FieldType; import com.smartgwt.client.widgets.form.fields.FormItem; public class ComplexType extends SimpleType { public ComplexType() { super("complicado", FieldType.CUSTOM); FormItem complexItem = new ComplexItem(); setEditorType(complexItem); } }
Code:
import com.smartgwt.client.types.Alignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.HTMLFlow; import com.smartgwt.client.widgets.form.fields.CanvasItem; import com.smartgwt.client.widgets.layout.HLayout; final class ComplexItem extends CanvasItem { @Override public Canvas getCanvas() { final HLayout hLayoutAlignCenter = new HLayout(); // Specifying the width creates space within which to center the members. hLayoutAlignCenter.setWidth100(); hLayoutAlignCenter.setHeight100(); hLayoutAlignCenter.setLayoutMargin(6); hLayoutAlignCenter.setMembersMargin(6); hLayoutAlignCenter.setBorder("1px dashed blue"); hLayoutAlignCenter.setAlign(Alignment.CENTER); // As promised! hLayoutAlignCenter.addMember(new Canvas() {{ setHeight(40); setWidth(40); setBackgroundColor("red"); }}); hLayoutAlignCenter.addMember(new Canvas() {{ setHeight(40); setWidth(40); setBackgroundColor("green"); }}); hLayoutAlignCenter.addMember(new Canvas() {{ setHeight(40); setWidth(40); setBackgroundColor("blue"); }}); return hLayoutAlignCenter; } }
Is it possible to use custom CanvasItems with SimpleType?
Comment