Creating the User Interface

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.
Task
  1. In Package Explorer, right-click SUP101Sample, and select New > Package.
  2. 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.
  3. 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.
    1. Right-click the com.sybase.sup.samples.objectapi package and select New > Class.
    2. In the Java Class page, for the name, enter one of the Java class names, for example: CustomerSample, and click Finish.
      Java Class page
      In the SUP101Sample, under the src\com.sybase.sup.samples.objectapi package, you see the new Java class: CustomerSample.java.
    3. Browse to the directory where you saved the ZIP file.
    4. Copy the content of the Java text file with the same name: CustomerSample.java.
    5. In Package Explorer, open the new Java class with the same name: CustomerSample.java.
    6. Paste the copied text code into the new Java class: CustomerSample.java. Copy over any existing content.
      CustomerSample.java text
    7. Select File > Save.
      The package contains errors until you create the other classes. Ignore these errors and continue.
    8. 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.
  4. Modify the host name or IP address in the ObjectAPIUtil.java file to point to the Sybase Unwired Server.
    1. In Package Explorer, expand the SUP101Sample project.
    2. Under the \src\com.sybase.sup.samples.objectapi package, double-click the ObjectAPIUtil.java file.
    3. Modify the host name or IP address, and Save.