Developer Tools
JDeveloper
Declarative components can have facets, attributes, and methods that enable page authors to configure how the declarative component is used on different pages or different portions of a page. For instance, you might add attributes to allow page authors to change the labels of the individual buttons in the declarative component.
A declarative component may or may not include facet definitions, attributes, or methods (or all three types). Depending on the composite component functionality you are providing, this means you might not have to add facet definitions, attributes, or methods when you create the declarative component metadata.
Like page templates, declarative components can define areas or facets within the composite component where content can be added by page authors when they use the declarative components to create portions of a page. If you wish to allow page authors to add their own content into a declarative component, then you would define one or more facets as placeholders for future content. For instance, if your declarative component includes a panel header component and you want page authors to add their own content anywhere within the panel header, you might add a facet definition with the name
pheader-contents. Later when you design the declarative component's layout, to allow page authors to drop content into the panel header component, you would insert the
af:facetRef tag into the
af:panelHeader component, with
af:facetRef referencing the
pheader-contents facet name. You will use the
af:facetRef tag to specify where additional content can be added in the next cue card.
If you wish to allow page authors to set or modify any property of a component within the composite component, you would define one or more attributes for the declarative component. For instance, if you want page authors to set their own title on the panel header component, you might add an attribute with the name
pheader-title and the type
java.lang.String. Later when you design the declarative component's layout, to allow page authors to set their own panel header title, you would insert an EL expression that uses the declarative component's
var attribute to reference
pheader-title on the
text property of
af:panelHeader. You will enter an EL expression that references a declarative component's attribute in the next cue card.
If your declarative component includes components with properties on which page authors can attach methods, you would define one or more methods. For instance, if your declarative component includes a command button and you want page authors to attach their own action listener method, you might add a method with the name
method1 and the method signature of
void method(javax.faces.event.ActionEvent). Later when you you design the layout of the declarative component, you would insert an EL expression that uses the declarative component's
componentVar attribute to reference
method1 on the
actionListener property of the button component. You will enter an EL expression that references a declarative component's method in the next cue card.
Copyright © 1997, 2009, Oracle. All rights reserved.