Tuesday, November 10, 2009

returnListener from dialog page not invoke when pressing x button

In a button that opens an other page as dialog if you define a returnListener method in managed bean then when you return form dialog page by a button that has af:returnActionListener then it works fine.

But if you close the dialog page with explorer x button then return listener is not invoked!

i also noticed a worning in log:

WARNING: The application is running with the new window detect flag off. It is highly recommended that this flag be turned on to ensure proper functioning of your application when new browser windows are launched. In web.xml set the context parameter oracle.adf.view.rich.newWindowDetect.OPTIONS to 'on'.

But even when i did that there was no difference appart from no worning.

Is this a bug?

How can we ensure that when a dialog closes (no matter how) a method will be executed?

Test case:

Friday, November 6, 2009

Attribute Validation on Input List of Values attribute

If you have an attribute validation in an Entity Attribute that is used in a view object as Input List of values then validation does not work correctly.

For testing i added a simple validation in departmentId of Employees Entity that it should be less than 100:


I set departmentId as Input List of values and autosubmit.
When I run the page and i select an invalid department then the value is not set to the field and i have no validation Error


So in the page it looks that nothing have changed. But if i submit the page, the invalid value appears in department and the error message also.


So is this a bug?

The workaround we are using is to filter LOV to show only valid values to select, or to override the setter of the entity, which i do not consider as a good practice.

test case:
http://adfbugs.googlecode.com/files/TestLOVValidation.zip

Tuesday, November 3, 2009

Returning Multiple values from LOV in af:query with bind variables bug

We get nullPointerException when returning multiple values from LOV in view criteria with bind variables.

To reproduce it in EmployeesView for departmentId I added LOV that also return ManagerId.



It work fine for Forms (TestForm) and for tables(TestTable), but not for af:query with bind variables:

I created 2 view criteria with departmentId and ManagerId, 1 with bind variables and 1 with no bind variables. And 2 pages 1 for each
TestQuery1 with af:query with bind variables
TestQuery with af:query with no bind variables

When trying to select department in TestQuery1 we get:


Caused by: java.lang.NullPointerException
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfCriterionValues.(FacesCtrlSearchBinding.java:2834)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfAttributeCriterion.(FacesCtrlSearchBinding.java:1732)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion._loadCriterionList(FacesCtrlSearchBinding.java:2775)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion._loadCriterionList(FacesCtrlSearchBinding.java:2725)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion.getCriterionList(FacesCtrlSearchBinding.java:2633)
at sun.reflect.GeneratedMethodAccessor840.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


Yet TestQuery return correctly departmentId and ManagerId.

So I guess the workaround is not to use bind variables in view criteria.

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

Sunday, November 1, 2009

Workaround for Page Fragment Design view when using resource bundle

Since the layout of the fragments i am working on was messed up due to bug:


I was working on the structure view and i noticed the following worning:


So i thought what will happen if i move c:set deeper inside the tree:

And then the Design view is back to normal! and no problems at runtime also.
Note: It must be above all components that use c:set.

Sunday, October 25, 2009

Page Fragment Design view is messed up when using resource bundle

Design view of pages in jdeveloper is very usefull to find and layout components.

Yet in page fragments the Design layout is messed up when you use resource bundle for texts.

In the test case i created a simple page fragment with oracle default template and added 2 panel boxes:

but if i try to Select Text Resourse for Panel Box Title, the design view of the fragment is messed up.

You cant work any more in design view.
When you run application it looks ok, but not having a design view in fragments is quite a problem.
If i remove c:set component from the fragment then the Design view is fixed, but the text from bundles does not show in run time.
Is this a bug?

Test case:

Tuesday, October 20, 2009

How to check and throw exception after all data are posted

Thanks to Oracle Suport and Didier Laurent a workaround is found to problem:

http://adfbugs.blogspot.com/2009/10/open-locks-in-optimistic-locking-bug.html

By Design optimistick locking locks before doCommit.

In order to remove locks and not loose entities data and to restore entity states, set the configuration parameter jbo.txn.handleafterpostexc to true.



Thanks Didier and Oracle Suport.

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

Saturday, October 17, 2009

Number precision and scale bug

Milos showed me this bug the other day and I could not believe it.

Number precision and scale does not work correctly in default ADF input field.

I searched metalink, I could not find something relevant

I reproduced it in a simple test case with Employees view object.

Employees Table has Salary field which is NUMBER(8,2) and CommissionPct NUMBER(2,2)
I also added a field on Employees table TO_PAY which is NUMBER(20,5)
I created a default input form.

When I try to enter value 123456.78 to salary which is a valid value I could not enter 8 digit
When I try to enter value 0.12 to CommissionPct I could not enter either 1 or 2 digit
When I try to enter value -123456789012345.12345 to ToPay field I could not enter the last 2 fields.

This issue is because when you drag and drop items on page it set precision the precision of the number ignoring fragment separator, sign symbol or 0 before fragment separator.

This is defined in input field property: maximumLength="#{bindings.Salary.hints.precision}"

You can eather remove maximumLength or set it to "#{bindings.Salary.hints.precision+1}" for Salary or +2 for percentages or even +3 for cases that you have only fragment digits like CommissionPct but you could also put negative number.
Take also into account that in some locale the negative number may have (###) format, meaning that you need +4 on maximumLength.

Also the number converter does not work correctly for numbers with more than 3 digits.
I tried to put 12345.12345 in ToPay field but when I submit I get back 12345.123 loosing the last 2 digits.

I try to fix this by setting ToPay converter min and maxFractionDigits
af:convertNumber groupingUsed="false"
pattern="#{bindings.ToPay.format}"
minFractionDigits="5" maxFractionDigits="5"


then I could enter, see and submit all 5 fraction digits.

But when I try on an empty field to put number 123456789012345.12345 it is automatically converted to 123456789012345.12000 when I press tub. When I change it again it works ok.

Are these bugs?

Test case:
[http://adfbugs.googlecode.com/files/TestDigits.zip]