Visar inlägg med etikett adf. Visa alla inlägg
Visar inlägg med etikett adf. Visa alla inlägg

tisdag, juni 26, 2007

Altering the Show/Hide Text of a "detailStamp" Facet

Another question that is related to the one that I answered in my previous post is how you can alter the Show/Hide text in the <f:facet name="detailStamp">. The answer to this one is to use the <af:showDetail id="showDetail1"> component instead and set the attributes disclosedText and undisclosedText.

If you drag and drop a Master table with in-line details in a JSF page with JDeveloper, it will generate code like:


<f:facet name="detailStamp">
<af:table rows="#{bindings.DeptView1.rangeSize}"
emptyText="No rows yet." var="detailRow"
value="#{row.children}">
<af:column headerText="#{row.children[0].labels.Ename}"
sortable="false" sortProperty="Ename">
<af:outputText value="#{detailRow.Ename}"/>
</af:column>
<af:column headerText="#{row.children[0].labels.Job}"
sortable="false" sortProperty="Job">
<af:outputText value="#{detailRow.Job}"/>
</af:column>
</af:table>
</f:facet>


for the in-line table. Here you cannot change the generated Show/Hide text that ADF generates. See the image below (in Swedish):
If you want to modify these, to something like:


you need to use some code along the line of:

<af:column headerText="Test" sortable="false">
<af:showDetail id="showDetail1" disclosedText="Brown" undisclosedText="Charlie">
<af:table rows="#{bindings.DeptView1.rangeSize}"
emptyText="No rows yet." var="detailRow"
value="#{row.children}">
<af:column headerText="#{row.children[0].labels.Ename}"
sortable="false" sortProperty="Ename">
<af:outputText value="#{detailRow.Ename}"/>
</af:column>
<af:column headerText="#{row.children[0].labels.Job}"
sortable="false" sortProperty="Job">
<af:outputText value="#{detailRow.Job}"/>
</af:column>
</af:table>
</af:showDetail>
</af:column>

If you do not want to have any text at all, just set the attributes disclosedText="" and undisclosedText="".

torsdag, juni 21, 2007

Hiding the Header for the Selection Facet

A question that I have seen on a few occasions is how you can hide the "Select" heading in the table when using the selection facet. Here is a solution for that problem that is based on this entry: http://www.orablogs.com/fnimphius/archives/001973.html in Frank Nimphius blog. Please note that, as Frank writes, that "Note that the CSS uses translateable text (or here translateable component names) to identify the component, which makes this solution weak.".

You can hide the 'Select' text by setting the text size to 0 for the concerned table header style (using display:none will not work, as it will cause the table headers to display over the incorrect column).

Here is the Table as default:


The "Select" (or in Swedish "Välj") header is controlled by this style (th.x2z) element (see page source):

<th scope="col" width="1%" nowrap class="x2z">Välj</th>

Now you can alter the af:tableSelectMany by changing the code in the page to:

<f:facet name="selection">

<af:tableSelectMany text="Test">

<f:verbatim>

<style type="text/css">

th.x2z{font-size: 0};

</style>

</f:verbatim>

</af:tableSelectMany>

</f:facet>


This will result in the following table:



Now the "Select" (or "Välj") test is set to 0 size, thus will not be displayed.

onsdag, maj 30, 2007

ADF Faces Multi Select Table using JDeveloper 11g Technology Preview

About a year ago Frank Nimphius wrote this post (http://www.orablogs.com/fnimphius/archives/001778.html) about multi-selection in ADF Faces tables. I tried out this approach recently using the JDeveloper 11g Technology Preview release and found that things have changed slightly since then. The purpose here is not to fully describe this feature, for that please see Frank's post, but to point to the changes between 10.1.3 and the 11g Preview version.

These are the main changes in short:
  • No need to create the selectMany component any longer.
  • A Slightly different way to iterate through the rows is needed.

Once you have created the table using 11g, you will notice that it looks slightly different:
























As mentioned before, you no longer needs to use a 'tableSelectMany' component to get multi-selections for the table, instead you define the 'rowSelection' and 'binding' attributes directly on the 'table' element, like:

<af:table value="#{bindings.DeptView1.collectionModel}" var="row"
rows="#{bindings.DeptView1.rangeSize}"
first="#{bindings.DeptView1.rangeStart}"
emptyText="#{bindings.DeptView1.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.DeptView1.rangeSize}"
rowSelection="multiple" id="table1"
selectionListener="#{api.table1_selectionListener}"
binding="#{api.myTable}"
>

Next, you need to map the managed bean to use the RichTable class, like:

<managed-property>
<property-name>myTable</property-name>
<property-class>oracle.adf.view.rich.component.rich.data.RichTable</property-class>
<value>#{table1}</value>
</managed-property>


and, also to use this class also in the backing bean:

private RichTable _table;

public RichTable getMyTable() {
return _table;
}

public void setMyTable(RichTable table) {
this._table = table;
}


As mentioned before, the way to iterate through the rows have also changed a bit. In 10.1.3 you could use:

Key _key = (Key) keyIter.next();

directly, in 11g I noticed that you have to use this approach instead:

List l = (List)rowSetIter.next();
Key key = (Key)l.get(0);

Also, you use the 'getSelectedRowKeys()' method instead of 'getSelectionState().getKeySet()'. The full code will look something like:

RichTable table = this.getMyTable();
RowKeySet rowSet = table.getSelectedRowKeys();
Iterator rowSetIter = rowSet.iterator();
DCBindingContainer bindings = this.getBindingContainer();
DCIteratorBinding iter = bindings.findIteratorBinding("DeptView1Iterator");

while (rowSetIter.hasNext()) {
List l = (List)rowSetIter.next();
Key key = (Key)l.get(0);
iter.setCurrentRowWithKey(key.toStringFormat(true));
Row r = iter.getCurrentRow();
System.out.println("selected dept " + r.getAttribute("Dname"));
}


Finally, with these changes in mind, the result of the above should end up in an output similar to:

07/05/30 13:36:33 selected dept SALES
07/05/30 13:36:33 selected dept RESEARCH


I hope this have illustrated the changes between the 10.1.3 and the 11g Preview Release for the multi-selection table.

torsdag, februari 01, 2007

Strange ADF Problem, Timepart of a Date Lost

Today I have been working on an issue that has intrigued me for a while. One of our customer has an application (ADF BC - Struts w. JSP) that first inserts some data into an Oracle DB by creating a new row in the corresponding ViewObject, then fetches some additional data from another DB, and updates the newly created ViewObject with this data, however, this process has failed. While debugging this problem I noticed that one of the parts of the Primary Key was a Date column, and in the log files there were entries like:

oracle.jbo.RowAlreadyDeletedException: JBO-25019: Riga entit? della chiave oracle.jbo.Key[1 2006-12-27 aaa] non trovata in MyTable.

I also noticed the following a bit further down in the log:

06/12/27 12:22:31 [515] Original value :2006-12-27 12:22:28.0
06/12/27 12:22:31 [516] Target value :2006-12-27

so, it seems quite obvious why the error occurs, the only question now would be why. Now, I wanted to have the error messages in English, so I then added -Duser.lang=en_US, and restarted the Application. Obviously I expected to get the error messages in English, but instead, it worked fine. Strange... I hope to find some explanation for this...

fredag, januari 12, 2007

Fix for Bug ADF JClient bug 5642176 Available

In the OTN thread:

http://forums.oracle.com/forums/thread.jspa?threadID=297913&start=15&tstart=0


there is a discusssion about a problem related to the ADF JClient bug 5642176. The patch for this bug is now available for download on MetaLink. To download it:

1) In MetaLink, click tab "Patches & Updates"
2) Click "Simple Search"
3) Select "Search By" "Patch Number"
4) Enter the patch number: 5642176
5) Select Microsoft Win-32 bit as the Platform (the patch is still Generic)
6) Click "Go"
7) Click "View Readme" and follow instructions to install the patch.

The patch is available for JDeveloper 10.1.2.2 and 10.1.3.1. Please also refer to the MetaLink Note 406050.1 for further details.