Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Creating a Java Client Application: A Tutorial

   

Controlling the User Interface

In Java Client applications you can give the interface controller (implemented in this project in StudioManager.java on the client) a controller display group. By creating associations between the controller display group and aspects of user-interface objects, you can use the interface controller to manage various facets of the user interface. In the following steps, you add a method as a property of the controller display group and bind this method to the enabled aspect of the Revenue field through an EOControlAssociation; since this method simply returns false, the field is disabled.

  1. Add a display group to the nib file.

    Drag a display group from the EOPalette to the nib file window.

    Double click the title of the display group to select it.

    Give the display group the name "Controller".

    As mentioned earlier, the owner of the nib file (File's Owner) is an instance of the custom EOInterfaceController automatically created by Project Builder. EOIntefaceController has a controllerDisplayGroup outlet; in the following step, connect the interface controller to this outlet.

  2. Connect the interface controller to its display group.

    Control-drag from File\xCDs Owner to the Controller icon.

    In the Connections inspector, select controllerDisplayGroup.

    Click Connect.

    Next add the neverEnabled method as a property of the controller display group.

  3. Add a property to the controller display group.

    Select the Controller display group in the nib file.

    In the Attributes inspector, enter \xF1neverEnabled\xEE in the field.

    Click Add.

    Now hook up the field to the display group using an EOControlAssocation to bind its enabled aspect to the neverEnabled method.

  4. Connect the field\xCDs enabled aspect to the display group property.

    Control-drag from the Revenue field to the Controller display group.

    In the Connections inspector, select EOControlAssoc from the pop-up list at the top of the left column.

    Select enabled in the left column.

    Select neverEnabled in the right column.

    Click OK.

  5. Implement the neverEnabled method.

    Now that the interface controller, the controller display group, and the Revenue field are interconnected via their outlets and associations, you can implement the method bound to the enabled aspect (in StudioManager.Java on the client).

    public boolean neverEnabled() {
          return false;
    }

  6. Build, run, and test the application.

    Build the project and test the application. The Revenue field has a gray background and cannot be written into.


© 1999 Apple Computer, Inc. – (Last Updated 13 Sep 99)