Tuesday, May 17, 2011

ADF Faces Layout Tips: Stretching an af:region inside af:dialog/popup component

The original solution to this post has been deprecated. Please see at bottom the proper solution.

I have a hard time stretching the height of an af:region inside a pop-up dialog, so to make the life of others easy, below is a sample to show what I have figured out.

<af:popup id="p1">
          <af:dialog id="d2" type="ok" resize="on" contentWidth="600"
                     contentHeight="400">
            <af:panelStretchLayout id="psl1"
                                   inlineStyle="height:inherit;"
                                   styleClass="AFStretchWidth">
              <f:facet name="center">
                <af:region value="#{bindings.sampletaskflow1.regionModel}"
                           id="r1"/>
              </f:facet>
            </af:panelStretchLayout>
          </af:dialog>
        </af:popup>
The trick is setting the 'inlineStyle' of the surrounding panelStretchLayout to 'height:inherit;'.

Cheers,
pino

Important update to this post:

To stretch a component inside a pop-up dialog you just need to set the ADF dialog's "stretchChildren" property to "first" as described by the following example:
  <af:popup id="p2">
      <af:dialog id="d3" type="ok"
                 resize="on" contentWidth="800" contentHeight="500"
                 stretchChildren="first">
           <af:region value="#{bindings.sampletaskflow1.regionModel}"
                      id="r3"/>
      </af:dialog>
  </af:popup>


Saturday, February 26, 2011

Bug: Boolean Accessors Prefixed with "is" not recognized as attribute in JDeveloper 11.1.1.4

The biggest fail that I noticed in JDeveloper 11.1.1.4.0 (aka Patch Set 3) is the inability to recognized boolean properties that are prefixed with "is" like isActive() as property in the entity xml files. My disappointment is that- this is properly recognized in earlier releases. We wanted to jive with the most recent release, so we have a lot of refactoring to make.
Below is a sample entity class and the corresponding entity xml file that was generated by JDev:
package model;

public class Employee {
    private Long id;
    private Boolean active;
    private String firstName;
    private String lastName;

    public void setActive(Boolean active) {
        this.active = active;
    }

    public Boolean isActive() {
        return active;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getLastName() {
        return lastName;
    }
}
Generated xml:
<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="11.1.1.59.23"
          id="Employee" Package="model" BeanClass="model.Employee"
          isJavaBased="true">
  <Attribute Name="id" Type="java.lang.Long"/>
  <Attribute Name="firstName" Type="java.lang.String"/>
  <Attribute Name="lastName" Type="java.lang.String"/>
  <MethodAccessor IsCollection="false" Type="void" id="setActive"
                  ReturnNodeName="Return">
    <ParameterInfo id="active" Type="java.lang.Boolean" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="java.lang.Boolean" id="isActive"
                  ReturnNodeName="Return"/>
  <ConstructorMethod IsCollection="true" Type="model.Employee"
                     BeanClass="model.Employee" id="Employee"/>
</JavaBean>
Notice that isActive() is not part of the attributes.