Wednesday, May 16, 2012

SmartGWT - how to create a .jar file for a smartGWT UI dialog

I created a SmartGWT application that displays a UI dialog (shows some controls on a dialog).



This dialog app is tested and works well, but now I have to distribute this as a jar file, so that other SmartGWT projects can use this as a widget.



I am looking at a way, how to ship this component "RemoteFileDialog" as a jar file, so that any other SmartGWT web app can use it for showing a file browser. Is there any detailed document / reference which I can go through to understand fully?



I created the jar file for for this dialog application using jar cvf ... command.



When I use this .jar in a target smartGwt sample project, it is unable to find the classes contained in the .jar



To be sure, I did the following steps in my eclipse ide.




  1. Added the jar to build path via "add external jars"


  2. module inheritance:
    changes to gwt.xml file






3 Did gwtc to test if the module inherits properly. GWT compile works with no warnings or errors.



However, when I tried to create an instance of dialog class (part of the jar file) in the test code given below, eclipse doesn't recognize or prompt me to add the required import, like the way it does for all other jar files.
Code:



Even if I manually add the import statement myself, still it gives compile error at those lines.



I want to a proper way to create a .jar file from a SmartGWT project, so that it can be used as a .jar file in another smartGWT project.



Any help and clues are most appreciated..



This is my environment, if it makes sense:!



SmartGWT 3.0
GWT 2.4
Browser : Firefox 7.0.1
Dev environment: Eclipse Indigo on Ubuntu11.10



regards,
RV



Adding the contents of .gwt.xml files...



This one for the widget project file: RemoteFileBrowser.gwt.xml



<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='remotefilebrowser'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

<!-- Other module inherits -->
<inherits name='com.smartgwt.SmartGwt'></inherits>
<inherits name="com.smartgwt.tools.SmartGwtTools"></inherits>
<!-- Specify the app entry point class. -->
<entry-point class='com.comviva.remotefilebrowser.client.RemoteFileBrowser'/>

<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>

</module>


this one for the host project that uses the widget:file: GWTSample.gwt.xml



    <?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gwtsample'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<inherits name="com.smartgwt.SmartGwt" />
<!-- <inherits name="com.comviva.scheduler.SchedulerWidget"></inherits> -->
<inherits name="com.comviva.remotefilebrowser.RemoteFileBrowser"></inherits>
<inherits name="com.smartgwt.tools.SmartGwtTools"></inherits>

<!-- Other module inherits -->

<!-- Specify the app entry point class. -->
<entry-point class='com.rv.gwtsample.client.GWTSample' />

<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />

</module>




No comments:

Post a Comment