ObjectExtender User's Guide and Reference


Transacted variables in editable container parts

The next example using transacted variable parts will be illustrated with editable container parts. We will build a view that shows the list of all departments in a Container Details part in which the values can be edited directly in the container cells. We will show the departments that can be modified in the top-level transaction, we will have a non-editable container that shows the shared transaction.

  1. Create a new view called TstDepartmentEditableContainersView from the VisualAge organizer.
  2. Add a Container Details part, and four Container Details columns.
  3. Make these columns correspond to the attributes: department, phone, room, and building.
  4. Open the settings of the Container Details part and set the editable property to be false.
  5. Add the TstDepartmentHome part and create a transacted variable.
  6. Connect the allInstances attibute from the transacted variable to the items of the Container Details part.

The next step is to ensure that the transacted variabe will surface the collection of TstDepartment objects in the context of the shared transaction. By default, this will occur because if a transacted variable is not given an explicit transaction it will always use the shared transaction. However, we can also explicitly specify this by adding the shared transaction part and connecting its self attribute to the transaction attribute of the transacted variable containing the department home collection.


Figure pgs4mt1 not displayed.

The next step is to add another Container Details part that will allow the departments to be listed.

  1. Resize the Window part to make room for another Container Details part.
  2. Create a new transacted variable from the TstDepartmentHome part and name this part top-level department home.
  3. Set the editable property to true for the Container Details part.
  4. Set the editable property to false for the department column.

    Recall that department is the OID or key attribute for the department class and that key atttibutes cannot be modified.


Figure pgs5ec2 not displayed.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]