Creating a Widget with Google Web Toolkit and opentaps
Create new hot-deploy/crmsfa/src/org/opentaps/gwt/crmsfa/cases with cases.gwt.xml
Create hot-deploy/crmsfa/src/org/opentaps/gwt/crmsfa/cases/client/Entry.java
Link Entry.java to opentaps page by modifying hot-deploy/crmsfa/webapp/crmsfa/cases/screenlets/quickCreateCase.ftl and adding:
<@gwtWidget id="quickNewCase"/>
Entry.java references the same quickNewCase:
private static final String QUICK_CREATE_CASE_ID = "quickNewCase"; public void onModuleLoad() { if (RootPanel.get(QUICK_CREATE_CASE_ID) != null) { // ...
Add cases to crmsfa build.xml:
<property name="gwt.module.list" value="contacts,accounts,leads,partners,orders,cases"/>
Now create QuickNewCaseForm and QuickNewCaseConfiguration. QuickNewCaseForm extends ScreenletFormPanel and is the form. For example, it has a TextField for subjectInput and so forth. QuickNewCaseConfiguration is used to hold the literal values on the QuickNewCaseForm, such as the names of the fields. They could be strings in QuickNewCaseForm as well. UI labels are available through UtilUi.MSG: for example, UtilUi.MSG.crmCreateCase() is CrmCreateCase
Finally, load the GWT widget on the opentaps screen by adding it to the list of GWT scripts for your screen. This is done by modifying the screens XML definition in hot-deploy/crmsfa/widget/crmsfa/screens/cases/CasesScreens.xml and adding our GWT widget to the main decorator, which causes it to show up for all the case screens:
<screen name="main-section-decorator"> <section> <actions> <set field="gwtScripts[]" value="crmsfagwt/org.opentaps.gwt.crmsfa.cases.cases" global="true"/> <set field="sectionName" value="cases" global="true"/>
To hook it up to the back end, use the gwt service event handler in the controller, like this:
<request-map uri="gwtQuickNewCase"> <security https="true" auth="true"/> <event type="gwtservice" invoke="crmsfa.createCase"/> <response name="success" type="none"/> <response name="error" type="none"/> </request-map>