Hi,
according to http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/ComponentSchema.html (identically found in the smartgwtpower3.1 distribution) it should be possible to define Component Schema to extend basic classes or at least, to pre define some attributes on them.
I tried this
NewCustomGrid.ds.xml
Screen.ui.xml
CustomListGrid.java
and got the following error (in dev) when above Screen (using this component) was loaded:
Are the docs misleading here (in the sense that this is only possible when defining the component directly as JS class and not as GWT class (which for me is Java)) or did I omit something?
Thanks,
fatzopilot
according to http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/ComponentSchema.html (identically found in the smartgwtpower3.1 distribution) it should be possible to define Component Schema to extend basic classes or at least, to pre define some attributes on them.
I tried this
NewCustomGrid.ds.xml
Code:
<DataSource ID="NewCustomGrid" serverType="component" inheritsFrom="ListGrid" instanceConstructor="com.aCompany.client.ui.CustomListGrid" autoDraw="false"> </DataSource>
Code:
<isomorphicXML xmlns:fmt="WEB-INF/"> <DataSource> <loadID>someBean</loadID> </DataSource> <NewCustomGrid dataSource="ref:someBean" autoFetchData="true" ID="someBeanListGrid" autoDraw="false"> <fields> ... </fields> <listEndEditAction>next</listEndEditAction> <showFilterEditor>true</showFilterEditor> <canEdit>true</canEdit> <canRemoveRecords>true</canRemoveRecords> </NewCustomGrid> </isomorphicXML>
Code:
package com.aCompany.client.ui;
import com.google.gwt.core.client.JavaScriptObject;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
public class CustomListGrid extends ListGrid {
public CustomListGrid() {
super();
System.out.println("It workds!");
addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
SC.say("Record Pressed");
}
});
}
public CustomListGrid(DataSource dataSource) {
super(dataSource);
System.out.println("It workds!");
addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
SC.say("Record Pressed");
}
});
}
public CustomListGrid(JavaScriptObject jsObj) {
super(jsObj);
System.out.println("It workds!");
addRecordClickHandler(new RecordClickHandler() {
@Override
public void onRecordClick(RecordClickEvent event) {
SC.say("Record Pressed");
}
});
}
@Override
protected JavaScriptObject create() {
SC.say("It workds!");
return super.create();
}
}
Code:
12:35:26.719 [ERROR] [com.aCompany.GWTModule] 12:35:26.670:XRP1:WARN:Log:Error when executing loaded screen: TypeError: isc.com is undefined
Stack from error.stack:
unnamed() @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:306
unnamed(isc_c_Class_evaluat) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:213
unnamed(isc_c_Class_globalEvalWithCaptur) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:268
unnamed(isc_c_RPCManager_loadScreen/_6.callbac) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1242
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:311
unnamed(isc_c_RPCManager_fireReplyCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1221
unnamed($wnd.isc.RPCManager.fireReplyCallbac) @ :234
unnamed(isc_c_RPCManager_fireReplyCallback) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1224
unnamed(isc_c_RPCManager_performOperationRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1221
unnamed(isc_c_RPCManager__performTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1215
unnamed(isc_c_RPCManager_performTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1181
unnamed(anonymou) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:63
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_c_Comm_performXmlTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:930
unnamed(anonymou) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:63
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_c_Comm__fireXMLCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:912
unnamed(isc_c_Comm_sendXmlHttpRequest/_1) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:917
unnamed() @
com.smartgwt.client.core.JsObject$SGWT_WARN: 12:35:26.670:XRP1:WARN:Log:Error when executing loaded screen: TypeError: isc.com is undefined
Stack from error.stack:
unnamed() @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:306
unnamed(isc_c_Class_evaluat) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:213
unnamed(isc_c_Class_globalEvalWithCaptur) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:268
unnamed(isc_c_RPCManager_loadScreen/_6.callbac) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1242
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:311
unnamed(isc_c_RPCManager_fireReplyCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1221
unnamed($wnd.isc.RPCManager.fireReplyCallbac) @ :234
unnamed(isc_c_RPCManager_fireReplyCallback) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1224
unnamed(isc_c_RPCManager_performOperationRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1221
unnamed(isc_c_RPCManager__performTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1215
unnamed(isc_c_RPCManager_performTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_DataBinding.js:1181
unnamed(anonymou) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:63
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_c_Comm_performXmlTransactionRepl) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:930
unnamed(anonymou) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:63
unnamed(isc_c_Class_fireCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:256
unnamed(isc_c_Comm__fireXMLCallbac) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:912
unnamed(isc_c_Comm_sendXmlHttpRequest/_1) @ com.aCompany.GWTModule/sc/modules/ISC_Core.js:917
unnamed() @
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
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: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:722)
Thanks,
fatzopilot
Comment