Environment (JDeveloper 11.1.2.3.0,ADF Faces)
The inputDate component creates a text field for entering dates and (optionally) a glyph which opens a popup for picking dates from a calendar. However in some cases we need to prevent the user from picking a specific days from the calender. In this post I will explain how to do this use case.
1- Create a simple JSF page and drag and drop af:inputDate component from the component palette into the newly created page.
2- Create a java class which implements org.apache.myfaces.trinidad.model.DateListProvider interface. This interface is used for providing a list of individual dates within a given range.
3- Override the getDateList method, This method will generate a List of individual Date objects which will be rendered as disabled in a datePicker component. An example is shown below.
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; import javax.faces.context.FacesContext; import org.apache.myfaces.trinidad.model.DateListProvider; public class DaysBean implements…
View original post 172 more words