I'm adding the use of DrawPane and various DrawItems to my smartgwt application.
Per documentation, I have added inherits for the com.smartgwt.Drawing to my xxx.gwt.xml file as shown below:
======================================================
<!-- Other module inherits -->
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
<inherits name="com.smartgwt.Drawing"/>
<inherits name="com.smartgwt.SmartGwtNoTheme"/>
<inherits name="com.smartclient.theme.blackops.BlackOps"/>
=======================================================
However, when I try to create a simple test case from the showcase examples, and then add it as an item to a portlet I have previously created and used, a failure occurs at the moment of calling addItem(mainPane).
=======================================================
mainPane = new DrawPane();
mainPane.setWidth(400);
mainPane.setHeight(300);
mainPane.addDrawHandler( new DrawHandler() {
@Override
public void onDraw(DrawEvent event )
{
DrawTriangle drawTriangle = new DrawTriangle();
drawTriangle.setPoints(new Point(100, 50), new Point(150, 150), new Point(50, 150));
drawTriangle.setTitle("Triangle");
drawTriangle.setDrawPane(mainPane);
drawTriangle.draw();
}
});
Trace.LogX("ABOUT TO ADD ITEM");
try {
getPortlet().addItem(mainPane);
}
catch( Exception e)
{
Trace.LogX("Exception encountered: " + e.getMessage() );
}
=======================================================
The output produced is shown below. A TypeError exception occurs after logging "ABOUT TO ADD ITEM" message.
=======================================================
ABOUT TO ADD ITEM
Exception encountered: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
AppBlock::AppBlock exception: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
EXCEPTION: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
=======================================================
I suspect that I haven't fully configured my project or run-time for using the drawing libraries. When I do a compile, everything reports okay though.
=======================================================
Invoking Linker SmartGwtScriptInjector
Creating loadScriptTagFiles.js to manually load the following script tags:
sc/modules/ISC_Drawing.js
sc/modules/ISC_Core.js
sc/modules/ISC_Foundation.js
sc/modules/ISC_Containers.js
sc/modules/ISC_Grids.js
sc/modules/ISC_Forms.js
sc/modules/ISC_RichTextEditor.js
sc/modules/ISC_Calendar.js
sc/modules/ISC_DataBinding.js
sc/skins/BlackOps/load_skin.js
Link succeeded
Compilation succeeded -- 48.256s
=======================================================
My eclipse project has the smartgwt.jar and the smartgwt-skins.jar files explicitly specified in the explorer-tree, but nothing specific to drawing.
Any suggestions you may be able to provide will be greatly appreciated. Thank you.
Per documentation, I have added inherits for the com.smartgwt.Drawing to my xxx.gwt.xml file as shown below:
======================================================
<!-- Other module inherits -->
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
<inherits name="com.smartgwt.Drawing"/>
<inherits name="com.smartgwt.SmartGwtNoTheme"/>
<inherits name="com.smartclient.theme.blackops.BlackOps"/>
=======================================================
However, when I try to create a simple test case from the showcase examples, and then add it as an item to a portlet I have previously created and used, a failure occurs at the moment of calling addItem(mainPane).
=======================================================
mainPane = new DrawPane();
mainPane.setWidth(400);
mainPane.setHeight(300);
mainPane.addDrawHandler( new DrawHandler() {
@Override
public void onDraw(DrawEvent event )
{
DrawTriangle drawTriangle = new DrawTriangle();
drawTriangle.setPoints(new Point(100, 50), new Point(150, 150), new Point(50, 150));
drawTriangle.setTitle("Triangle");
drawTriangle.setDrawPane(mainPane);
drawTriangle.draw();
}
});
Trace.LogX("ABOUT TO ADD ITEM");
try {
getPortlet().addItem(mainPane);
}
catch( Exception e)
{
Trace.LogX("Exception encountered: " + e.getMessage() );
}
=======================================================
The output produced is shown below. A TypeError exception occurs after logging "ABOUT TO ADD ITEM" message.
=======================================================
ABOUT TO ADD ITEM
Exception encountered: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
AppBlock::AppBlock exception: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
EXCEPTION: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'create' of undefined
=======================================================
I suspect that I haven't fully configured my project or run-time for using the drawing libraries. When I do a compile, everything reports okay though.
=======================================================
Invoking Linker SmartGwtScriptInjector
Creating loadScriptTagFiles.js to manually load the following script tags:
sc/modules/ISC_Drawing.js
sc/modules/ISC_Core.js
sc/modules/ISC_Foundation.js
sc/modules/ISC_Containers.js
sc/modules/ISC_Grids.js
sc/modules/ISC_Forms.js
sc/modules/ISC_RichTextEditor.js
sc/modules/ISC_Calendar.js
sc/modules/ISC_DataBinding.js
sc/skins/BlackOps/load_skin.js
Link succeeded
Compilation succeeded -- 48.256s
=======================================================
My eclipse project has the smartgwt.jar and the smartgwt-skins.jar files explicitly specified in the explorer-tree, but nothing specific to drawing.
Any suggestions you may be able to provide will be greatly appreciated. Thank you.
Comment