Using Star Rating component (dvt:ratingGauge) in ADF 12c (12.1.3 new component)

Sharing is Caring

Hello all
As ADF 12.1.3. is out, there is a lot of enhancement in UI layer, Star rating component is available in this release that is rating gauge (dvt:ratingGauge)
see how this rating gauge look like-

1.XML Source- Simple Rating Gauge with Star Symbol

<dvt:ratingGauge id="ratingGauge2" value="2" minimum="1" maximum="5" inlineStyle="width:300px;height:80px;"/>

 

Star Rating component

2. XML Source- Rating Gauge with Circular Symbol

<dvt:ratingGauge id="ratingGauge2" value="2" minimum="1" maximum="5" inlineStyle="width:300px;height:80px;"
                     shape="circle" inputIncrement="half" readOnly="false"/>

 

2. XML Source- Rating Gauge with Circular Symbol, Rectangular Unselected Symbol

<dvt:ratingGauge id="ratingGauge2" value="2" minimum="1" maximum="5" inlineStyle="width:300px;height:80px;"
                     shape="circle" inputIncrement="half" readOnly="false" unselectedShape="rectangle"/>

 

Sample Application for star rating component is based on Departments Table of Default HR Schema

    • Added a column in HR’s Departments table for Rating

 

 

    • Now create the model using Departments table and drop on the page (page fragment in bounded task flow)as table and form, select Rating attribute from Data Control and drop as Gauge–>Rating Gauge(Minimum-0 Maximum-9)
    • See on the page it is ready to show Rating of Department, but still not able to take input

 

 

    • By default rating gauge is read-only means it doesn’t take input from the user, set read-only to false and set increment (full or half) values
    • So I have tried this, but when I select any rating and commit data, it doesn’t reflect changes in the Database table, it is still showing previously saved value
    • I don’t know why this is happening, so i have used valueChangeListener and set new rating in current row of Department, in this way it is working fine

    /**ValueChange Listener to SetRating
     * @param vce
     */
    public void ratingVCE(ValueChangeEvent vce) {
        if (vce.getNewValue() != null) {
            System.out.println("New Rating -" + vce.getNewValue());
            DCIteratorBinding iter = (DCIteratorBinding) getBindings().get("Departments1Iterator");
            iter.getViewObject().getCurrentRow().setAttribute("Rating", vce.getNewValue());
        }
    }

 

  • Now run and enjoy new rating gauge 🙂

 

Download- Sample ADF Application

Cheers 🙂 Happy Learning

Related Posts

I’m an Oracle ACE, Blogger, Reviewer,
Technical Lead working on Oracle ADF

Leave a Reply

Your email address will not be published. Required fields are marked *