Display data for last 15 days and next 30 days in af:calendar in ADF | Techartifact.

Requirment – In calendar component , we need to show data for last 15 days and next 30 days in list mode.

Solution-Seems little tricky. But not much.Let check out in calendar property.

Well there is property called ActiveDay and ListCount. We will be binding the ActiveDay with a managed bean and setting ActiveDay from that bean.

Create a varible like “private Date currentDate;” and generate getter setter method of it in myCalendarBean. Override the getter method of current Date.

    public void setCurrentDate(Date currentDate) {
        this.currentDate = currentDate;
    }

    public Date getCurrentDate() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -15);
        Date date = calendar.getTime();
        
        return date;
    }


And we need to show last 15 days and next 30 days. that mean total 45 days. We will putting 45 in ListCount.

See in below screenshot.Today is 18 nov. And we getting date range from 3 nov to 17 Dec. 🙂

And that all. nothing to do.

Happy Coding with Techartifact.

Navigating from calendar activity by clicking in Oracle ADF – Techartifact

af:calendar component in ADF is widely used.It is same as Google calendar we used. In calendar we are having different activities .We are having different calendar facet inside the calendar component i. e activitydetail, activityDelete, activityHover, activityContextMenu, create , contextMenu.

If you look down the property of calendar component inside property pallet. you will not find action or actionListener property instead of you will get
calendarActivity, calendarListener etc.

Now my requirment is to clicking on the calendar component , it should navigate to diffrent page in same taskflow. How to do that.Little tricky
According to calendar component we can have this navigation easily by the child component or from the calendar facet. We can have a show a popup
in the activityHover facet. In the popup window we can have the button ,inside the button action property we can define the control flow case or some string which we defined in the taskflow diagram for navigation. If you do like this when you hover over the calendar activity a pop up window will come and you will get button with some other detail , when you click the button you will be navigated to new page. look easy…….

But my requirment is navigate after clicking the acitivity . Then i made that button visible property to false .I created a managed bean and inside the activityListener of calendar component i wrote a method and invoke the button action programmatic and queue the action event as i described in my old post

 
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, "buttonId");
        }
        
        
        // UIViewRoot root = facesContext.getViewRoot();
        //cb1 is the fully qualified name of the button
        RichCommandButton button = (RichCommandButton)component;
        ActionEvent actionEvent = new ActionEvent(button);
        actionEvent.queue();