Add sample code from the ZIP archive to the SUP101Sample application.
The files provide the functionality and layout of the user interface.
Prerequisites
Obtain text files from the
SUP_BB_Custom_Dev_Tutorial_code.zip file. The text files contain code
snippets that you need to build the user interface. You will create these classes for the
interface:
CustomerSample,
CustomerSampleScreen,
CustomerList,
CustomerDBCallback, and
ObjectAPIUtil.
- If you are viewing this guide online from the Sybase Product
Documention Web site, click SUP_BB_Custom_Dev_Tutorial_code.zip to access the ZIP
archive containing the text files.
- If you are viewing this guide as a PDF, go to the Sybase Product
Documentation Web site at http://sybooks.sybase.com/sybooks/sybooks.xhtml. Select
Sybase Unwired Platform. Select the appropriate version,
navigate to this topic in the tutorial, then click the link for the ZIP file to save
the files locally.
Task- In Package Explorer, right-click
SUP101Sample, and select .
- In the New Java Package wizard, use these values and click
Finish.
- Source folder – verify SUP101Sample/src appears.
- Name – enter com.sybase.sup.samples.objectapi.
- In Package Explorer, you will create one new Java class for the
application in the com.sybase.sup.samples.objectapi package, and then copy the remaining
four classes in the ZIP file into the package. Here is the list of files in the
ZIP:
- CustomerDBCallback.java – implements the
CallbackHandler to demonstrate how to track changed entities in the
onSynchronize callback method.
- CustomerList.java – populates the customer
list.
- CustomerSample.java – creates the main
customer application.
- CustomerSampleScreen.java – creates the
customer screen.
- ObjectAPIUtil.java – governs how the
application initializes and synchronizes data in the background.
- Right-click the com.sybase.sup.samples.objectapi
package and select .
- In the Java Class page, for the name, enter one of the Java
class names, for example: CustomerSample, and click Finish.
In the SUP101Sample, under the
src\com.sybase.sup.samples.objectapi package, you see
the new Java class: CustomerSample.java.
- Browse to the directory where you saved the ZIP file.
- Copy the content of the Java text file with the same name:
CustomerSample.java.
- In Package Explorer, open the new Java class with the same name:
CustomerSample.java.
- Paste the copied text code into the new Java class:
CustomerSample.java. Copy over any
existing content.
- Select .
The package contains errors until you create the other classes. Ignore
these errors and continue.
- For the remaining four classes, copy the Java files from the ZIP archive to
the SUP101Sample\src\com.sybase.sup.samples.objectapi
package.
The compilation errors in the Java files resolve when you finish
creating the classes.
- Modify the host name or IP address in the ObjectAPIUtil.java file to point to the Sybase Unwired
Server.
- In Package Explorer, expand the SUP101Sample
project.
- Under the \src\com.sybase.sup.samples.objectapi package,
double-click the ObjectAPIUtil.java file.
- Modify the host name or IP address, and Save.