Saturday, November 28, 2009

ActionListener and showPopupBehavior

Many times developers complain that actionListener of a button is not invocked when they add a showPopupBehavior. Yet that is not a bug.

By default showPopupBehavior the action type is Action that is a client event and does not invoke server actions. That is described in af:showPopupBehavior documentation:

The af:showPopupBehavior tag is a declarative way to show a af:popup in response to a client-side event. The client event is specified using the triggerType attribute. The "action" event is the default triggerType if one is not provided.
....

All actionListener method bindings and associated action listeners will not be invoked when the triggerType of "action" is used.

So the solution is to just set the triggerType of ShowPopupBehavior to click.



Then the actionListener and popup are invoked.



Edit 19/12/12:
As posted in the comments bellow, this is not the best possible workaround. It is more like a quick and dirty solution. With this solution even if the button is disabled the popup is still opened without the Action listener invoked.
A better solution if you need an action listener on buttons that opens a popup is not to use the showPopupBehavior but to open the popup from within the action listener by binding the popup to the managed bean and use popup.show() method.

Tuesday, November 24, 2009

Setting value programmatically on required field.

It is common requirement when you set a value in one field to also set a value to a second field.

This we usually do on setter of view object of the first field or the valueChangeListener also by adding a partialTrigger on the second field.

Yet if the second field is required and the previous value is null then nor the setter nor the valueChangeListener are invoked because of validation error.

This is because the partialTrigger is trying to refresh the second field before even submitting the first field.

Is this a bug or intended behavior?

The workaround we found is to remove partial trigger from second field and on valueChangeListener of the first field to use addPartialTarget

In the test case when you select department we want to set manager also, so in the setter of department id there is:
public void setDepartmentId(Number value) {
setAttributeInternal(DEPARTMENTID, value);
this.setManagerId(new Number(100));
}

Also managerId field is set required=true

Test case:
http://adfbugs.googlecode.com/files/TestRequired.zip

Sunday, November 22, 2009

Carousel does not make the selected row current

Carousel is a realy nice new component in jdeveloper 11 patch1
When you create a data binded carousel item it just uses an iterator and a tree model as a table.
Every item in carusel is from a diferent row of the iterator.
Yet when you select a new item the current row of the iterator is not changed.
So if you want to have other fields of the same iterator in the page or detail view objects iterators the data are not refreshed while navigating in Carousel.
I think a selectionListener as in the table component is missing.

In order to achieve the above behaviour i did the following:
I binded carouselSpinListener property to a backing bean method where
i get the carusel event NewItemKey and i find the Key of the row and i set iterator current row to the carusel selected row.
public void caruselSpin(CarouselSpinEvent event) {
List l =(List)event.getNewItemKey();
Key k = (Key)l.get(0);
DCIteratorBinding iter = getDCBindingContainer .findIteratorBinding ("DepartmentsView1Iterator");
iter.setCurrentRowWithKey(k.toStringFormat(true));


}


Now Every time you select new item in carusel the iterator has the selected row.

Test case:
http://adfbugs.googlecode.com/files/TestCarousel.zip

Sunday, November 15, 2009

Still reproduced bugs in jdeveloper patch 1

Yet there are still a lot of bugs that can reproduced in jdeveloper 11.1.1.2.0.

Those bugs are:

Attribute Validation on Input List of Values attribute
http://adfbugs.blogspot.com/2009/11/attribute-validation-on-input-list-of.html

Page Fragment Design view is messed up when using resource bundle
http://adfbugs.blogspot.com/2009/10/page-fragment-design-view-is-messed-up.html

Workaround for Page Fragment Design view when using resource bundle
http://adfbugs.blogspot.com/2009/11/workaround-for-page-fragment-design.html

Number precision and scale bug
http://adfbugs.blogspot.com/2009/10/number-precision-and-scale-bug.html

unexpected error on graph preview when security enabled
http://adfbugs.blogspot.com/2009/10/unexpected-error-on-graph-preview-when.html

Tab selection and Enable User Customization on Session bug.
http://adfbugs.blogspot.com/2009/09/tab-selection-and-enable-user.html

Unsaved changes uncommittedDataWarning bug
http://adfbugs.blogspot.com/2009/09/unsaved-changes-uncommitteddatawarning.html

ExecuteEmptyRowSet and Range Paging.
http://adfbugs.blogspot.com/2009/09/executeemptyrowset-and-range-paging.html

LOV execute query many times ***Improved but not fixed
http://adfbugs.blogspot.com/2009/08/lov-execute-query-many-times.html

Range Paging in Master Detail bug.
http://adfbugs.blogspot.com/2009/08/range-paging-in-master-detail-bug.html

Table Filter Bug
http://adfbugs.blogspot.com/2009/08/table-filter-bug.html

Af:Query bind variable bug
http://adfbugs.blogspot.com/2009/08/afquery-bind-variable-bug.html

LOV view object Tuning: 'Only up to row number' bug
http://adfbugs.blogspot.com/2009/08/lov-view-object-tuning-only-up-to-row.html

Returning from dialog to a page that has f:verbatim tag bug
http://adfbugs.blogspot.com/2009/08/returning-from-dialog-to-page-that-has.html

Range paging and Table Selected Row Bugs
http://adfbugs.blogspot.com/2009/07/range-paging-and-table-selected-row.html
*** even though related metalink bug 8673654 is marked as fixed for this version

Partial Page Rendering ChangeEventPolicy="ppr" bug.
http://adfbugs.blogspot.com/2009/07/partial-page-rendering.html

Performance Tuning, LOVs and Range Paging bug
http://adfbugs.blogspot.com/2009/07/performance-tuning-lovs-and-range.html
*** now LOV with Range paging opens but when you return value you get exception.

ADF input list of values AutoSubmit bug.
http://adfbugs.blogspot.com/2009/07/adf-input-list-of-values-autosubmit-bug.html

Query Component Required Criterion bug ( r1 Bug)
http://adfbugs.blogspot.com/2009/07/query-component-required-criterion-bug.html

Query Component Focus bug
http://adfbugs.blogspot.com/2009/07/query-component-focus-bug.html

Fixed bugs in jdeveloper patch 1

So i tried to reproduce bugs posted in this blog to the new patch 1 of jdeveloper 11.

Many on them are not reproduced any more and i consider them fixed.

Fixed bugs are:

Returning Multiple values from LOV in af:query with bind variables bug
http://adfbugs.blogspot.com/2009/11/returning-multiple-values-from-lov-in.html

No inconsistency check after any Exception during posting data
http://adfbugs.blogspot.com/2009/10/no-inconsistency-check-after-any.html

Af:Query bind variable bug
http://adfbugs.blogspot.com/2009/08/afquery-bind-variable-bug.html

Region and dialog return bug
http://adfbugs.blogspot.com/2009/08/region-and-dialog-return-bug.html

Page with Region Validations bug
http://adfbugs.blogspot.com/2009/08/page-with-region-validations-bug.html

LOV criteria bug.
http://adfbugs.blogspot.com/2009/08/lov-criteria-bug.html

Table Validations Bug.
http://adfbugs.blogspot.com/2009/08/table-validations-bug.html

Jdeveloper 11 r1 An unexpected severe error has ocurred in Jdeveloper
http://adfbugs.blogspot.com/2009/07/jdeveloper-11-r1-unexpected-severe.html

LOVs Dont return Values when there is any validation error on page
http://adfbugs.blogspot.com/2009/07/lovs-dont-return-values-when-there-is.html

JDeveloper 11 r1 Cascading LOV bugs
http://adfbugs.blogspot.com/2009/07/jdeveloper-11-r1-cascading-lov-bugs.html

Query Component Save bug
http://adfbugs.blogspot.com/2009/07/query-component-save-bug.html

Query Component validations bug
http://adfbugs.blogspot.com/2009/07/query-component-validations-bug.html

Friday, November 13, 2009

New Feature Closing a Popup can now be captured.

My first impression of patch 1 of jdeveloper11 is that it looks like a new IDE,
diferent screens for overview and for security,
diferent menus and lots of new properties.

One thing that was missing and I was complaining about in the oracle forums was the capturing of an event when a popup dialog is closed.
http://forums.oracle.com/forums/message.jspa?messageID=3898637#3898637

Now a new property in popup component popupCanceledListener solves this problem.


You can just assign a backing bean method on it and it works no mater how you close the popup (with Cancel, with 'x' button or with ESC key).


This was realy needed. Thanks oracle team for the new feature

The only little bug in this is that in design view the popup is not visible when you place it in button facet popup

Test Case
http://adfbugs.googlecode.com/files/TestPopup.zip

Wednesday, November 11, 2009

Patch set 1 of Oracle JDeveloper 11g is now available

Oracle JDeveloper 11g (11.1.1.2.0) (Build 5536) is now available for download at
http://www.oracle.com/technology/software/products/jdev/htdocs/soft11.html

I will try to reproduce all bugs posted until now in this blog and will log the results shortly.