Hallo,
I'm try to add a CanvasItem to the DynamicForm
but i get following exceptions
SmartGWT 2.2
FireFox 3.6.6
Win7x64
HostedMode
in Browser:
in GWT Development Mode(Console)
this is my code
I'm try to add a CanvasItem to the DynamicForm
but i get following exceptions
SmartGWT 2.2
FireFox 3.6.6
Win7x64
HostedMode
in Browser:
Code:
Uncaught exception escaped : com.google.gwt.core.client.JavaScriptException (TypeError): this.form is null fileName: http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js lineNumber: 1379 stack: isc_FormItem_isDisabled()@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:1379 isc_FormItem_iconIsDisabled([object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:1388 isc_FormItem__setUpIcon([object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:1014 isc_FormItem__setUpIcons()@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:1013 isc_FormItem_init([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:748 isc_c_Class_invokeSuper(null,"init")@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Core.js:265 isc_c_Class_Super("init",[object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Core.js:257 isc_TextItem_init([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:1740 isc_Class_completeCreation([object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Core.js:322 isc_DynamicForm_createItem([object Object],"TextItem")@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:277 isc_DynamicForm__addItems([object Array],null,true,(void 0))@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:264 isc_DynamicForm_setItems([object Array])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:253 isc_DynamicForm_setFields([object Array])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Forms.js:254 isc_Class_setProperties([object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Core.js:346 isc_Class_setProperty("fields",[object Array])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/sc/modules/ISC_Core.js:344 ("fields",[object Array])@http://localhost:8080:293 @:0 ([object GWTJavaObject],25690113,[object XMLHttpRequest])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/hosted.html?de_it_p_kaso_gwt_Frontend:56 ([object Event])@http://localhost:8080:84 ((function () {__gwt_makeJavaInvoke(1)(handler, 25690113, _this);}),[object XMLHttpRequest],[object Object])@http://localhost:8080:72 @:0 (null,27,(function () {__gwt_makeJavaInvoke(1)(handler, 25690113, _this);}),[object XMLHttpRequest],[object Object])@http://localhost:8080/kaso/de.it_p.kaso.gwt.Frontend/hosted.html?de_it_p_kaso_gwt_Frontend:56 ([object Event])@http://localhost:8080:3 See the Development console log for details. Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling.
Code:
00:23:56,285 [ERROR] 12:56:31.916:WARN:Log:ClassFactory.addGlobalID: ID:'isc_TextItem_49' for object '[TextItem ID:isc_TextItem_49 name:isc_SearchTextItemAF4J_0]' collides with ID of existing object '[TextItem ID:isc_TextItem_49 name:isc_TextItemAF4J_51]'. The global reference to this object will be replaced com.smartgwt.client.core.JsObject$SGWT_WARN: 12:56:31.916:WARN:Log:ClassFactory.addGlobalID: ID:'isc_TextItem_49' for object '[TextItem ID:isc_TextItem_49 name:isc_SearchTextItemAF4J_0]' collides with ID of existing object '[TextItem ID:isc_TextItem_49 name:isc_TextItemAF4J_51]'. The global reference to this object will be replaced at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.BaseWidget.setProperty(BaseWidget.java) at com.smartgwt.client.widgets.BaseWidget.setAttribute(BaseWidget.java:611) at com.smartgwt.client.widgets.form.DynamicForm.setFields(DynamicForm.java:2444) at de.it_p.kaso.gwt.client.af4j.DynamicFormAF4J.addField(DynamicFormAF4J.java:32) at de.it_p.kaso.gwt.client.main.controller.layout.widgets.ThreeFormColumnOneButtonRowLayoutSmartGWT.addComponentToPanels(ThreeFormColumnOneButtonRowLayoutSmartGWT.java:140) at de.it_p.kaso.gwt.client.main.controller.layout.widgets.ThreeFormColumnOneButtonRowLayoutSmartGWT.addComponent(ThreeFormColumnOneButtonRowLayoutSmartGWT.java:108) at de.it_p.kaso.gwt.client.main.controller.search.SearchControllerSmartGWT$8.onSuccess(SearchControllerSmartGWT.java:593) at de.it_p.kaso.gwt.client.main.controller.search.SearchControllerSmartGWT$8.onSuccess(SearchControllerSmartGWT.java:1) at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:216) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:396) at sun.reflect.GeneratedMethodAccessor73.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:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 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:188) at sun.reflect.GeneratedMethodAccessor69.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:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) at java.lang.Thread.run(Thread.java:619)
Code:
public class MultiSearchItemAF4J extends CanvasItem implements ChangedHandler { private DynamicForm form = new DynamicForm(); private ComboBoxItemAF4J comboBoxItem = new ComboBoxItemAF4J(); private TextItemAF4J textItem = new TextItemAF4J(); private ListGridField[] listGridFields; private String textItemFieldName; private String comboBoxFieldName; private BaseDataSource<?> dataSource; private String title; /** * only for test */ @Deprecated public MultiSearchItemAF4J() { setTitle(title); comboBoxItem.setShowTitle(false); comboBoxItem.setWidth("*"); comboBoxItem.setName("comboBoxItem_my1"); textItem.setShowTitle(false); textItem.setDisabled(true); textItem.setWidth("*"); textItem.setName("textItem_my2"); form.setFields(comboBoxItem, textItem); form.setWidth("*"); //Per default form.setColWidths("40%", "60%"); form.setID("formitem_my1"); setName("multisearchitem_my1"); setCanvas(form); } @Override public void onChanged(ChangedEvent event) { if (comboBoxItem.getValue() != null) { selectValue(); comboBoxItem.fetchData(new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { selectValue(); } }); // } else { // staat.setValue(""); textItem.clearValue(); } } private void selectValue() { if (comboBoxItem.getSelectedRecord() != null) { ListGridRecord lg = (ListGridRecord) comboBoxItem.getSelectedRecord(); if (lg != null) { textItem.setValue(lg.getAttribute(textItemFieldName)); } } else { textItem.clearValue(); } } /** * Liefert den Wert aus der ComboBox. */ @Override public Object getValue() { return comboBoxItem.getValue(); } @Override public void setValue(boolean value) { comboBoxItem.setValue(value); } @Override public void setValue(Date value) { comboBoxItem.setValue(value); } @Override public void setValue(double value) { comboBoxItem.setValue(value); } @Override public void setValue(float value) { comboBoxItem.setValue(value); } @Override public void setValue(int value) { comboBoxItem.setValue(value); } @Override public void setValue(String value) { comboBoxItem.setValue(value); } public DynamicForm getForm() { return form; } public void setForm(DynamicForm form) { this.form = form; } /** * Liefert das * * @return */ public ComboBoxItemAF4J getComboBoxItem() { return comboBoxItem; } public void setComboBoxItem(ComboBoxItemAF4J comboBoxItem) { this.comboBoxItem = comboBoxItem; } public TextItemAF4J getTextItem() { return textItem; } public void setTextItem(TextItemAF4J textItem) { this.textItem = textItem; } }
Code:
DynamicFormAF4J myForm = new DynamicFormAF4J (); ..... myForm.addField(new MultiSearchItemAF4J()); .....
Code:
public class DynamicFormAF4J extends DynamicForm{ public DynamicFormAF4J() { super(); // setIsGroup(true); } public DynamicFormAF4J(JavaScriptObject jsObj) { super(jsObj); // TODO Auto-generated constructor stub } public void addField(FormItem formItem) { List<FormItem> fields = new ArrayList<FormItem>(Arrays.asList(this.getFields())); fields.add(formItem); FormItem[] formItems =fields.toArray(new FormItem[fields.size()]); this.setFields(formItems); } }
Comment