How do I use property classes in combination with JavaServer Faces Components for Crystal Enterprise?

Many of the attributes for the UI components and properties for the managed beans need to be set to instances of property classes. To illustrate how to use these property classes in an application, consider the following example.

Example

The Logon component has an attribute called logonButton. That attribute must be set to an instance of the SubmitButton class, which contains the properties that define the look and behavior of the button for the logon form. To access and manipulate these properties, the Logon component must reference a bean that instantiates the SubmitButton class. You must first create the Java bean.

To create a Java bean
  1. In the Palette view, under the Data tab, click JavaBean and drag a bean onto the page in the visual designer.
  2. Tip:    Alternatively, you can right-click JSP scripting in the Page Data view, and click New > JavaBean.

  3. In the Add JavaBean dialog box, in the Name field, enter logonButton1.
  4. In the Class field, enter the fully qualified name of the SubmitButtonProps class:
  5. com.businessobjects.jsf.sdk.properties.SubmitButtonProps

    Tip:    Alternatively, you may search for a class to add by clicking on the button next to the Class field. A Class Selection dialog box will appear where you can perform an alphabetized search for a valid class by typing the beginning portion of the class name in the Choose a class field.

  6. Click Make this JavaBean reusable to make the bean available to other pages, and then on the Scope list click Session.
  7. Click Initialize Properties to configure initial default values for the properties of the SubmitButton class.
  8. In the Initialize JavaBean Properties dialog box, click Add to add a new property to the list.
  9. Click in the Name field, and select a property from the list.
  10. All available SubmitButton class properties that you can choose from are displayed in the list In this case, you will see properties such as text, imageUrl, type, alignment, and visible.

  11. Enter a value in the Value field for the property.
  12. For example, if you select the text property, enter the string that you want to appear on the logon button, such as "Log on", or "Submit".

  13. Repeat steps 6 through 8 until you have initialized default values for all desired properties.
  14. Click OK, and then click Finish.

A Java bean called logonButton1 is added to the page and made visible in the Page Data view. Next, add a reference to this bean from the Logon component.

To reference the property bean from the logonButton attribute
  1. Select the Logon component in the visual designer.
  2. In the Properties view, click the button next to the field of the logonButton attribute.
  3. In the Select Page Data Object dialog box, select logonButton1 and then click OK.

The formatting and behavior of the Logon component's logon button will now be governed by the data in the newly created bean. The bean can be further configured and its property values changed within the Page Data view. All component attributes that require property classes function this way.

In addition, the EnterpriseItems and Identity beans contain properties that must be configured for property classes. A reference to a property bean can be added similar to the way components are added, by initializing the EnterpriseItem or Identity bean's property from the Page Data view. For details, see How do I initialize the default values of Java beans?.

A list of the component attributes and managed bean properties that require property classes is shown in the following tables.

Note:    For detailed documentation on the property classes, see the Crystal Reports for Rational Application Developer Java API Reference.

UI ComponentAttributeProperty Class

Logon

authentication

AuthenticationProps

Logon

logoffButton

SubmitButtonProps

Logon

logonButton

SubmitButtonProps

Logon

system

SystemProps

ItemsGrid

alerts

AlertProps

ItemsGrid

pagerStyle

PagerProps

Path

showImages

ImagesProps

Managed BeanPropertyProperty Class

EnterpriseItems

paging

PagingProps

EnterpriseItems

sortBy

SortProps



Business Objects
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/