Better date picker for ApEx 3.2?

One of my least-liked features in ApEx 3.2 is the poor performance of the date picker popup. It redraws whenever the user changes the month or year, and it takes so long, that I've found most of the time, a user will change both fields in the time it takes for the first one to take effect, so the second change ends up being ignored.
Ideally, I would like to find a drop-in replacement for the built-in date picker that will do everything in JavaScript, within the window, and bonus points for some additional validation options (like min/max date). The date picker in ApEx 4 is actually perfect, I think.
So, my question: 1) Has anybody tried to backport the date picker from ApEx 4 into an ApEx 3.2 application? Can this be done without substantial rewiring of the calling page? 2) If not, can anybody recommend a good replacement for the built-in one in 3.2? Again, my goal is to just replace the JavaScript call on that form element with a different one, and require no other changes to the page.
Thanks,
Keith

Thanks, Dan -- you mentioned this in another thread, too, and I was just starting to look into whether I could simply drop in this datepicker in place of the one in ApEx. It looks like I can, but if you're verifying that this is the case, then this definitely meets my needs, and I'll eagerly start looking into this.
Still, I think it would be cool if someone backported the one in ApEx 4. That one is so much nicer! :-)
Cheers!

Similar Messages

  • Date picker for af:inputDate   is not picking up the correct input date

    view source:
    <af:inputDate value="#{bindings.DateField.attributeValue}" label="#{bindings.DateField.hints.label}"
    required="#{bindings.DateField.hints.mandatory}"
    valueChangeListener="#{pageFlowScope.CollectApplicantInformation.datesItemChanged}"
    columns="#{bindings.DateField.hints.displayWidth}" shortDesc="#{CustomTooltip[DateField]}"
    autoSubmit="true" helpTopicId="AppDt" id="DateField" simple="true">
    <f:validator binding="#{bindings.DateField.validator}"/>
    *<f:converter converterId="CustomConverter"/>*
    </af:inputDate>
    Here I am not using <af:ConvertDateTime> insted using customConverter, so what code changes do I need to make sure the date picker always picks the already existind date in the inputDate rather picking the current date?
    Here is my CustomConverter.java
    CustomConverter.java
    public class CustomConverter extends DateTimeConverter implements ClientConverter, Converter
    public Object getAsObject(FacesContext context, UIComponent component, String value)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType != null && !dataType.equalsIgnoreCase("oracle.jbo.domain.Date") && !dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    String test = null;
    if (context == null || component == null)
    throw new NullPointerException();
    if (value != null)
    // To solve DB transaction dirty issue, Check isEmpty and return null.
    if (value.isEmpty())
    return null;
    // the "value" is stored on the value property of the component.
    // The Unified EL allows us to check the type
    ValueExpression expression = component.getValueExpression("value");
    if (expression != null)
    Class<?> expectedType = expression.getType(context.getELContext());
    if (expectedType != null)
    System.out.println("expectedType Value:::" + expectedType.getName());
    // try to convert the value (Object) to the TYPE of the "value" property
    // of the underlying JSF component
    try
    return TypeFactory.getInstance(expectedType, value);
    catch (DataCreationException e)
    String errorMessage;
    if (expectedType.equals(CustomNumber.class))
    errorMessage = "You can enter only Numbers in this field";
    else
    errorMessage = e.getMessage();
    if (errorMessage != null)
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Format" , errorMessage);
    ctx.addMessage(component.getClientId(), fm);
    catch (CustomDomainException e)
    int errorCode = e.getErrorMessageCode();
    String[] errorMessage = e.getErrorMessageParams();
    if (errorCode == 7 && errorMessage != null)
    String msg = "Invalid " + errorMessage[0];
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application Error: ", msg);
    ctx.addMessage(component.getClientId(), fm);
    catch (JboException e)
    Throwable cause = e.getCause();
    if (cause == null)
    cause = e;
    test = "not good format";
    throw e;
    return null;
    else
    return value != null? value: null;
    public String getAsString(FacesContext context, UIComponent component, Object value)
    return value != null? value.toString(): null;
    public String getClientLibrarySource(FacesContext context)
    return null;
    @Override
    public Collection<String> getClientImportNames()
    return Collections.emptySet();
    @Override
    public String getClientScript(FacesContext context, UIComponent component)
    String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (formatMask != null)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    if (component == null)
    _LOG.severe("The component is null, but it is needed for the client id, so no script written");
    return null;
    // Add a JavaScript Object to store the datefield formats
    // on the client-side. We currently store the format string
    // for each and every field. It'd be more efficient to have
    // an array of formats, then store for each field the
    // index of the format, especially if we could delay outputting
    // these objects to when the <form> closes.
    String clientId = component.getClientId(context);
    if (clientId != null)
    // =-=AEW Only if Javascript...
    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
    // this fetch could be at the place where we append, but has been
    // moved ahead to optimize use of StringBuilder
    String jsPattern = getJSPattern(context, component);
    String loc = _getLocaleString(context);
    // FIX - figure out size!!!
    // 127 chars for javascript + length of jspattern + locale + 12 chars for
    // tranforming to name in the worst case.
    StringBuilder buff = new StringBuilder(139 + jsPattern.length() + loc.length());
    if (requestMap.get(_PATTERN_WRITTEN_KEY) == null)
    requestMap.put(_PATTERN_WRITTEN_KEY, Boolean.TRUE);
    // only create the _dfs object if it doesn't exist, so we don't
    // wipe out _dfs[xxx] values if we ppr the first date field on a
    // page with multiple date fields.
    buff.append("if(window['_dfs'] == undefined){var _dfs=new Object();}if(window['_dl'] == undefined){var _dl=new Object();}");
    buff.append("_dfs[\"");
    buff.append(clientId);
    buff.append("\"]=");
    buff.append(jsPattern);
    buff.append(";");
    buff.append("_dl[\"");
    buff.append(clientId);
    buff.append("\"]=");
    buff.append(loc);
    buff.append(";");
    return buff.toString();
    else
    LOG.severe("NULLCLINET_ID_NO_SCRIPT_RENDERED");
    return null;
    else
    return null;
    else
    return null;
    private String _getLocaleString(FacesContext context)
    Locale dateTimeConverterLocale = getLocale();
    if (dateTimeConverterLocale != null)
    Locale defaultLocale = RenderingContext.getCurrentInstance().getLocaleContext().getFormattingLocale();
    if (!(dateTimeConverterLocale.equals(defaultLocale)))
    String loc = dateTimeConverterLocale.toString();
    StringBuffer sb = new StringBuffer(2 + loc.length());
    sb.append("'");
    sb.append(loc);
    sb.append("'");
    return (sb.toString());
    return "null";
    @Override
    @Deprecated
    public String getClientConversion(FacesContext context, UIComponent component)
    String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (formatMask != null)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    String jsPattern = getJSPattern(context, component);
    Map<String, String> messages = new HashMap<String, String>();
    if (jsPattern != null)
    Class<?> formatclass = formatMask.getClass();
    System.out.println("FormatClass::" + formatclass);
    System.out.println(" Format Mask : " + formatMask);
    // SimpleDateFormat sdfDestination = new SimpleDateFormat(formatMask);
    String pattern = formatMask; //getPattern();
    if (pattern == null)
    pattern = getSecondaryPattern();
    String key = getViolationMessageKey(pattern);
    Object[] params = new Object[]
    { "{0}", "{1}", "{2}" };
    Object msgPattern = getMessagePattern(context, key, params, component);
    //if hintFormat is null, no custom hint for date, time or both has been specified
    String hintFormat = _getHint();
    FacesMessage msg = null;
    String detailMessage = null;
    if (msgPattern != null)
    msg = MessageFactory.getMessage(context, key, msgPattern, params, component);
    detailMessage = XhtmlLafUtils.escapeJS(msg.getDetail());
    Locale loc = context.getViewRoot().getLocale();
    SimpleDateFormat formatter = new SimpleDateFormat(pattern, loc);
    java.lang.Object obj = resolveExpression("#{bindings." + component.getId() + ".attributeValue}");
    String databaseDate=null;
    if(obj!=null)
    databaseDate = obj.toString();
    DateFormat df = new SimpleDateFormat(pattern,loc);
    System.out.println("DateComponent input value :::::::::::::::::::::::::"+databaseDate);
    Date today;
    try {
    // System.out.println("Before Conversion::::::::::::"+df.parse(databaseDate).toString());
    if(databaseDate!=null)
    today = df.parse(databaseDate);
    else
    today = new Date();
    System.out.println("After Conversion Date :::::::::::::::::::::::::::::"+today.toString());
    //Date today = new Date();
    String dt = formatter.format(today);
    String exampleString = dt;
    String escapedType = XhtmlLafUtils.escapeJS(getType().toUpperCase());
    StringBuilder outBuffer = new StringBuilder();
    outBuffer.append("new TrDateTimeConverter(");
    outBuffer.append(jsPattern);
    // loc = getLocale();
    if (loc != null)
    outBuffer.append(",'");
    outBuffer.append(loc.toString());
    outBuffer.append("','");
    else
    outBuffer.append(",null,'");
    outBuffer.append(exampleString);
    outBuffer.append("','");
    outBuffer.append(escapedType);
    outBuffer.append("'");
    if (msgPattern != null || hintFormat != null)
    messages.put("detail", detailMessage);
    messages.put("hint", hintFormat);
    outBuffer.append(',');
    // try
    // JsonUtils.writeMap(outBuffer, messages, false);
    // catch (IOException e)
    // outBuffer.append("null");
    outBuffer.append(')'); // 2
    return outBuffer.toString();
    catch(ParseException e)
    System.out.println("Parse Exception :::::::::::::::::::::"+e);
    return null;
    else
    // no pattern-matchable date
    return null;
    else
    return null;
    else
    return null;
    protected String getJSPattern(FacesContext context, UIComponent component)
    String jsPattern = null;
    String datePattern = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (datePattern != null)
    String secondaryPattern = getSecondaryPattern();
    if (datePattern != _NO_JS_PATTERN)
    int length = datePattern.length() * 2 + 2;
    if (secondaryPattern != null)
    length = length + 3 + secondaryPattern.length() * 2;
    StringBuilder outBuffer = new StringBuilder(length);
    jsPattern = _getEscapedPattern(outBuffer, datePattern, secondaryPattern);
    else
    jsPattern = datePattern;
    return jsPattern;
    private static void _escapePattern(StringBuilder buffer, String pattern)
    buffer.append('\'');
    XhtmlUtils.escapeJS(buffer, pattern);
    buffer.append('\'');
    private static String _getEscapedPattern(StringBuilder buffer, String pattern, String secondaryPattern)
    if (secondaryPattern != null)
    buffer.append('[');
    _escapePattern(buffer, pattern);
    if (secondaryPattern != null)
    buffer.append(",'");
    XhtmlUtils.escapeJS(buffer, secondaryPattern);
    buffer.append("']");
    return buffer.toString();
    private String _getHint()
    String type = getType();
    if (type.equals("date"))
    return getHintDate();
    else if (type.equals("both"))
    return getHintBoth();
    else
    return getHintTime();
    public static Object resolveExpression(String pExpression)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp = null;
    valueExp = elFactory.createValueExpression(elContext, pExpression, Object.class);
    return valueExp.getValue(elContext);
    private static final String _NO_JS_PATTERN = new String();
    private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(DateTimeConverter.class);
    // RenderingContext key indicating the _dateFormat object
    // has been created
    private static final String _PATTERN_WRITTEN_KEY = "org.apache.myfaces.trinidadinternal.convert.DateTimeConverter._PATTERN_WRITTEN";
    *Problem is if any input date componet is displaying other than current date then the date picker is always picking the current date rather existing date*
    Please suggest me where to make changes?
    Edited by: 858782 on Oct 3, 2011 7:43 AM
    Edited by: 858782 on Oct 3, 2011 11:44 PM

    I need custom date foramts to be applied for different inputDates which are not defined in <af:convertDateTime>
    Thanks
    Edited by: 858782 on Oct 13, 2011 4:59 PM

  • Date picker for 64 bit windows 8 and 32 bit 2010 excel

    I'm looking for step by step instructions on how to add a pop up calender to chose a date in 2010 Excel.  There is none listed in the addition toolbox controls, where and how would I install this? 

    Hi,
    Please go to the following path to find the Microsoft Date and Time Picker:
    Excel 2010 > Developer tabe > Insert > ActiveX bottom right > More > MIcrosoft Date and Time Picker (SP4). 
    For more detail information, please refer to the following link:
    http://social.msdn.microsoft.com/Forums/en-US/26f6adea-c723-4815-92ba-59a0c846a80a/microsoft-date-picker-excel-2010?forum=exceldev
    http://www.logicwurks.com/CodeExamplePages/EDatePickerControl.html
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Date Picker for Adobe 10

    From the little bit of research I've done, there is no date picker feature currently in Adobe 10.  I've been trying to find some kind of plug-in/add-on/something along those lines so I can include a date picker in an adobe form that I am setting up.  From what I understand, the jQuery widget is used for web pages which does me no good, unless of course I misunderstood that.  Any help would be appreciated.  Thanks.

    Thanks for your help "try67".  It works like a charm.  The setup in Adobe 10 is a little different than it looks like it is in Adobe 9, but it still works well.  Although for one reason or another, my Javascripts folder isn't at any of the locations on your blog.  It is at:
    C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Javascripts
    This could be because the machine that I use with Adobe 10 is a virtual machine, so I'm not sure if that has anything to do with it.
    Thanks again.

  • Date Picker for Query Variable

    Hello,
    I have a query, which has a input variable as date. For the Query Variables when i drag and create an input form, i have the field as input field. How do i change this field to a date picker drop down...I do not get any option to make it as a date picker/calendar...
    REgards,
    Vikram

    Hello Vikram,
    If I understand correctly, the field type is String, but it represents a Date. You want to be able to edit it as such.
    1. In the input Form open the Define Data dialog (using the Right Click context menu) and add a field of type Date (letu2019s say its name is u201CDATE1u201D).
    2. On the link between the input Form and the Service Open the Map Data dialog using Right Click => Map Datau2026
    3. Find the relevant Field Assign in the table. Here you want to get the Date value converted into a String. From the Assign Value drop down you can choose Define Expression to open the Dynamic Expression Editor (you can skip this and write the value yourself in the Assign Value input if you know what to write).
    4. On the right hand side you have model elements and functions to create an expression. You can use the function DSTR(@DATE,[format]) u2013 where parameter 1 is the Date field and parameter 2 is the Format (optional). The function returns a String representation of a given Date.
    5. Your expression can look like this for example: =DSTR(@DATE1,"dd/mm/yyyy"), assuming the name of the new Date field in the Form is DATE1.
    6. You can remove the old Text field from the Input Form if you donu2019t need it u2013 using the Define Data dialog.
    Hope this helps,
    Udi

  • Date picker not showing up in iOS Reader with multiple dates?

    Hi all,
    The date picker for iOS shows up for forms with a single date box. However, with multiple forms, the keyboard pops up instead of the date picker. It still handles correctly formatting-wise, but it's become a bit of hassle with having to type the date instead of simply filling out today. Is this a bug or by design?

    Hi jncasino,
    We are not able to reproduce this issue at our end. Could you please share the file having this issue to help us investigate and fix this issue?
    Thanks,
    -Shilpi

  • Discoverer viewer date picker

    Hi All,
    Is it possible to have a date picker for date fields in discoverer viewer?
    Regards,
    Nav

    Hi
    There is no code to use here, this is all done by the end user inside the Plus worksheet.
    First of all, your Discoverer administrator needs to create two or more lists of values on related items within the folder, for example on the Year, Quarter, Month and Date.
    In the end user tool, the user creates a set of conditions on these items presenting the highest level first, for example the year, followed by the next item in the chain, for example the Quarter and so on.
    In the sub conditions, for example on the Quarter, the user checks the box which asks whether the values for this item should be based on a previous selection. You then tell Discoverer to use the previous selection thus the list of values for Quarter will be restricted to the year or years selected in the first condition. You simply repeat this exercise for Month and then Day.
    Do you have a copy of my Oracle Discoverer 10g Handbook? If so, you will find a full description of cascading parameters in there.
    If you or your users don't know how to do this you may want to consider taking some training as this is standard functionality within the Plus tool and you would expect report writers to know how to do this.
    Best wishes
    Michael

  • Date Picker based on transient field

    Hi,
    JDev 10.1.3, ADF, BC4J:
    I have a jsp with two date fields that I use for searching. I have created a form bean that stores these fields as java.sql.Date types, and also generated a data control from this form bean.
    The problem is, I want to display these fields as date pickers in my browser.
    If I have a data-bound date field I can just drag it on to the page and select to drop it as type "Input render". This will create the date picker for me.
    However, if I do the same thing with my non-data-bound dates, they do not appear on the resulting page.
    Is there a way of creating date pickers based on transient (non-data-bound) fields?
    Cheers,
    Alex.

    Field validation assumes that the field being validated is to the left of the operator in the syntax. Since your validation requirement is complex, you would use the IIf statement.
    This is the syntax you should use for the Status field:
    =IIf((FieldValue('&lt;Status&gt;') = 'Commit' AND &#91;&lt;ClosedDate&gt;&#93; &gt; Today() + 90) OR (FieldValue('&lt;Status&gt;') &lt;&gt; 'Commit'),&#91;&lt;Status&gt;&#93;,"Invalid")
    You would build the syntax for Closed Date similarly. You would want to place this on all the affected fields to ensure it is called at the appropriate time. You should also test that it runs as expected when you edit other fields as well. This is another thread that talks about this issue: Re: Contact Field Validation (Email, Work Phone #, Mobile Phone #)
    Good Luck,
    Thom

  • Date Field Input Box in data  table does not provide date picker???

    hello everybody,
    In my JSF page i have a data table in which i have a input text field of date type. my problem is for the input box date picker is not available. though i can have date picker for a date filed outside the datatable. another problem is for the date filed validation in the browser is not available too. so how can i get the helper calender and browser validation? plz help. ASAP
    with regards,
    sailajoy
    Edited by: sailajoy on Jan 7, 2009 12:42 PM

    You are absolutely correct Sir.
    I am using IBM Websphere for developing JSF and the component is
    <h:inputText id="txtBirthDt" size="11">
    <f:convertDateTime pattern="dd/MM/yyyy" /><hx:inputHelperDatePicker />          
    <hx:inputHelperAssist validation="true" errorClass="inputText_Error" errorAction="selected"/>
    <hx:validateDateTimeRange maximum="#{now}" /></h:inputText>
    Both the helper calender and the validation part for the date field is not working if it is included in data table. Please Help.

  • Java Swing Date Picker

    Hi all,
    can any one tell me the best date picker for my swing application, it should be very simple and work fast for my application

    Hi,
    Here is one more DatePicker, the usage is mentioned in the main()
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Cursor;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.GridLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.EventObject;
    import java.util.GregorianCalendar;
    import java.util.LinkedList;
    import javax.swing.*;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.LineBorder;
    import javax.swing.event.CellEditorListener;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.EventListenerList;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableCellEditor;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableColumnModel;
    * This is a simple Calendar component written in single class. This is a
    * JInternalFrame. Instantiate with public constructor and add AbstractAction
    * using addAction() method and implement action performed method the,
    * ActionEvent source contains the GregorianCalendar of selected Date on the
    * component. Example usage is in main()
    class JCalendar extends JInternalFrame {
         //Define the Button ActionCommands
         private final static String incMonth = "INC_MONTH";
         private final static String incYear = "INC_YEAR";
         private final static String incDecade = "INC_DECADE";
         private final static String decMonth = "DEC_MONTH";
         private final static String decYear = "DEC_YEAR";
         private final static String decDecade = "DEC_DECADE";
         private AbstractTableModel tableModel;
         private JTable table;
         private JScrollPane scrollPane;
         private String[] monthNames = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
                   "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
         private String[] columnNames = { "SUN", "MON", "TUE", "WED", "THU", "FRI",
                   "SAT" };
         private volatile GregorianCalendar calendar = new GregorianCalendar();
         private volatile int selectedYear = calendar.get(Calendar.YEAR);
         private volatile int selectedMonth = calendar.get(Calendar.MONTH);
         private volatile int selectedDate = calendar.get(Calendar.DATE);
         private LinkedList<Action> actionListenerList = new LinkedList<Action>();
         private JLabel status = new JLabel();
         public JCalendar() {
              super("", false, false, false, false);
              buildMonthYearGUI();
              buildGUI();
              getContentPane().add(status, BorderLayout.SOUTH);
              // setDates();
              ((javax.swing.plaf.basic.BasicInternalFrameUI) getUI())
                        .setNorthPane(null);
              setBorder(new LineBorder(Color.BLACK));
              setSize(230, 140);
         private GregorianCalendar getSelectedDate() {
              GregorianCalendar finalCalendar = new GregorianCalendar();
              finalCalendar.set(Calendar.DATE, calendar.get(Calendar.DATE));
              finalCalendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH));
              finalCalendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR));
              return finalCalendar;
         public void addAction(Action action) {
              actionListenerList.add(action);
         protected void buildMonthYearGUI() {
              final JLabel label = new JLabel(monthNames[selectedMonth] + " "
                        + selectedYear);
              label.setAlignmentX(JLabel.CENTER);
              label.setForeground(Color.DARK_GRAY);
              label.setBorder(new LineBorder(Color.DARK_GRAY));
              class Convenience {
                   public JHyperLink buildLink(String label, String actionCmd,
                             Action listener) {
                        JHyperLink link = new JHyperLink();
                        link.setText(label);
                        listener.putValue(Action.ACTION_COMMAND_KEY, actionCmd);
                        link.addAction(listener);
                        link.setBorder(new LineBorder(Color.DARK_GRAY));
                        return link;
              }// end convenience
              Convenience convenience = new Convenience();
                   class IncDecAction extends AbstractAction {
                   private String getLabelText() {
                        return monthNames[selectedMonth] + " " + selectedYear;
                   public void actionPerformed(ActionEvent e) {
                        String actionCmd = e.getActionCommand().trim();
                        if(actionCmd.equalsIgnoreCase(decDecade)){
                             selectedYear = selectedYear-10;
                             label.setText(getLabelText());
                        }else if(actionCmd.equalsIgnoreCase(incDecade)){
                             selectedYear = selectedYear +10;
                             label.setText(getLabelText());
                        }else if (actionCmd.equalsIgnoreCase(decYear)) {
                             selectedYear--;
                             calendar.set(Calendar.YEAR, selectedYear);
                             label.setText(getLabelText());
                        } else if (actionCmd.equalsIgnoreCase(incYear)) {
                             selectedYear++;
                             calendar.set(Calendar.YEAR, selectedYear);
                             label.setText(getLabelText());
                        } else if (actionCmd.equalsIgnoreCase(decMonth)) {
                             if (selectedMonth == Calendar.JANUARY) {
                                  selectedMonth = Calendar.DECEMBER;
                                  selectedYear--;
                                  calendar.set(Calendar.YEAR, selectedYear);
                             } else {
                                  selectedMonth--;
                             calendar.set(Calendar.MONTH, selectedMonth);
                             label.setText(getLabelText());
                        } else if (actionCmd.equalsIgnoreCase(incMonth)) {
                             if (selectedMonth == Calendar.DECEMBER) {
                                  selectedMonth = Calendar.JANUARY;
                                  selectedYear++;
                                  calendar.set(Calendar.YEAR, selectedYear);
                             } else {
                                  selectedMonth++;
                             calendar.set(Calendar.MONTH, selectedMonth);
                             label.setText(getLabelText());
                        if (tableModel != null) {
                             tableModel.fireTableStructureChanged();
                             tableModel.fireTableDataChanged();
              //AbstractAction listener = new IncDecAction();
              JHyperLink decDecButton = convenience.buildLink("<<<", decDecade, new IncDecAction());
              JHyperLink incDecButton = convenience.buildLink(">>>", incDecade, new IncDecAction());
              JHyperLink decYearButton = convenience.buildLink(" << ", decYear, new IncDecAction());
              JHyperLink incYearButton = convenience.buildLink(" >> ", incYear, new IncDecAction());
              JHyperLink decMonthButton = convenience.buildLink(" < ", decMonth, new IncDecAction());
              JHyperLink incMonthButton = convenience.buildLink(" > ", incMonth, new IncDecAction());
              JPanel monthYearPane = new JPanel();
              monthYearPane.setLayout(new GridBagLayout());
              GridBagConstraints constraints = new GridBagConstraints();
              constraints.insets = new Insets(2,2,2,2);
              constraints.gridx = 0;
              monthYearPane.add(decDecButton, constraints);
              constraints.gridx = 1;
              monthYearPane.add(decYearButton, constraints);
              constraints.gridx = 2;
              monthYearPane.add(decMonthButton, constraints);
              constraints.gridx = 3;
              constraints.weightx = 1;
              monthYearPane.add(label, constraints);
              constraints.gridx = 4;
              constraints.weightx = 0;
              monthYearPane.add(incMonthButton, constraints);
              constraints.gridx = 5;
              monthYearPane.add(incYearButton, constraints);
              constraints.gridx = 6;
              monthYearPane.add(incDecButton, constraints);
              monthYearPane.setBorder(new LineBorder(Color.GRAY));
              getContentPane().add(monthYearPane, BorderLayout.NORTH);
         protected void buildGUI() {
              tableModel = new AbstractTableModel() {
                   public boolean isCellEditable(int row, int column) {
                        return true;
                   public Class getColumnClass(int columnIndex) {
                        return String.class;
                   @Override
                   public String getColumnName(int columnIndex) {
                        return columnNames[columnIndex];
                   public int getRowCount() {
                        return calendar.getActualMaximum(Calendar.WEEK_OF_MONTH);
                        // throw new UnsupportedOperationException("Not supported
                        // yet.");
                   public int getColumnCount() {
                        return 7;
                        // throw new UnsupportedOperationException("Not supported
                        // yet.");
                   public Object getValueAt(int rowIndex, int columnIndex) {
                        //System.out.println("Get Value method called");
                        int day_of_week = columnIndex + 1;
                        int week_of_month = rowIndex + 1;
                        GregorianCalendar localCalendar = new GregorianCalendar();
                        localCalendar.set(Calendar.MONTH, selectedMonth);
                        localCalendar.set(Calendar.YEAR, selectedYear);
                        int current_month = localCalendar.get(Calendar.MONTH);
                        localCalendar.set(Calendar.WEEK_OF_MONTH, week_of_month);
                        localCalendar.set(Calendar.DAY_OF_WEEK, day_of_week);
                        if (current_month != localCalendar.get(Calendar.MONTH))
                             return null;
                        return localCalendar.get(Calendar.DATE);
                        // throw new UnsupportedOperationException("Not supported
                        // yet.");
              class JHyperLinkRenderer extends JHyperLink implements TableCellRenderer,     TableCellEditor
                   protected String plainText = "";
                   public JHyperLinkRenderer() {
                   private void setDate() {
                        calendar.set(Calendar.DATE, Integer.parseInt(plainText));
                   public void setText(String text) {
                   plainText = text;
                   super.setText("<html><u>" + text + "</u></html>");
                   if(plainText != null && !plainText.equalsIgnoreCase("")){
                        this.setToolTipText(new Integer(selectedMonth+1).toString()+"/"+plainText+"/"+new Integer(selectedYear).toString());
                   protected void fireMouseEntered(MouseEvent me) {
                        fireActionEvent();
                   protected void fireMouseExited(MouseEvent me) {
                   //This is overiden to change the behavior
                   protected void fireActionEvent() {
    * The actionListenerList variable is defined at Global
    * JCalendar Level
                        for (Action l : actionListenerList) {
                             Object source = null;
                             if (plainText != null && !plainText.equalsIgnoreCase("")) {
                                  // calendar.set(Calendar.DATE, Integer.parseInt(plainText));
                                  setDate();
                                  source = getSelectedDate();
                             } else {
                                  source = this;
                             ActionEvent e = new ActionEvent(source,
                                       ActionEvent.ACTION_PERFORMED, (String) l
                                                 .getValue(Action.ACTION_COMMAND_KEY));
                             l.actionPerformed(e);
                   public Component getTableCellRendererComponent(JTable table,
                             Object value, boolean isSelected, boolean hasFocus,
                             int row, int column) {
                        value = tableModel.getValueAt(row, column);
                        setText("");
                        setBorder(null);
                        setOpaque(true);
                        if (column == 0 || column == 6) {
                             setBackground(Color.LIGHT_GRAY);
                        } else {
                             setBackground(table.getBackground());
                        if (value != null) {
                             setText(value.toString());
                             this.setHorizontalAlignment(JLabel.CENTER);
                             // this.setBorder(border);
                             this.setForeground(Color.DARK_GRAY);
                             // this.setBackground(Color.RED);
                             if (isSelected) {
                                  setForeground(Color.BLUE);
                                  // setBorder(new LineBorder(Color.BLUE));
                                  BevelBorder border = new BevelBorder(BevelBorder.RAISED);
                                  setBorder(border);
                             if(value.toString().equalsIgnoreCase(new Integer(selectedDate).toString())) {
                                  setBackground(Color.GREEN);
                                  BevelBorder border = new BevelBorder(BevelBorder.RAISED);
                        return this;
              //Cell Editor Implementations
                   public Component getTableCellEditorComponent(JTable table,
                             Object value, boolean isSelected, int row, int column) {
                        // setText("");
                        if (value != null) {
                             setText(value.toString());
                             this.setHorizontalAlignment(JLabel.CENTER);
                             setForeground(Color.BLUE);
                             BevelBorder border = new BevelBorder(BevelBorder.RAISED);
                             setBorder(border);
                        } else {
                             setText("");
                        return this;
                   protected EventListenerList listenerList = new EventListenerList();
                   protected ChangeEvent changeEvent = new ChangeEvent(this);
                   public void addCellEditorListener(CellEditorListener listener) {
                        listenerList.add(CellEditorListener.class, listener);
                   public void removeCellEditorListener(CellEditorListener listener) {
                        listenerList.remove(CellEditorListener.class, listener);
                   protected void fireEditingStopped() {
                        CellEditorListener listener;
                        Object[] listeners = listenerList.getListenerList();
                        for (int i = 0; i < listeners.length; i++) {
                             if (listeners[i] == CellEditorListener.class) {
                                  listener = (CellEditorListener) listeners[i + 1];
                                  listener.editingStopped(changeEvent);
                   protected void fireEditingCanceled() {
                        CellEditorListener listener;
                        Object[] listeners = listenerList.getListenerList();
                        for (int i = 0; i < listeners.length; i++) {
                             if (listeners[i] == CellEditorListener.class) {
                                  listener = (CellEditorListener) listeners[i + 1];
                                  listener.editingCanceled(changeEvent);
                   public void cancelCellEditing() {
                        fireEditingCanceled();
                   public boolean stopCellEditing() {
                        fireEditingStopped();
                        return true;
                   public boolean isCellEditable(EventObject event) {
                        boolean flag = false;
                        if(event instanceof MouseEvent) {
                             MouseEvent evt = (MouseEvent)event;
                             if(evt.getClickCount() > 1) flag = true;
                        return flag;
                   public boolean shouldSelectCell(EventObject event) {
                        return true;
                   public Object getCellEditorValue() {
                        //return null;
                        return this.getText();
              JHyperLinkRenderer editorRenderer = new JHyperLinkRenderer();
              table = new JTable(tableModel);
              // Set the CellRenderer
              table.setDefaultRenderer(String.class, editorRenderer);
              table.setDefaultEditor(String.class, editorRenderer);
              table.getTableHeader().setReorderingAllowed(false);
              table.getColumnModel().setColumnMargin(5);
              table.putClientProperty("terminateEditOnFocusLost",Boolean.TRUE);
              table.setRequestFocusEnabled(false);
              table.setRowSelectionAllowed(false);
              // table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
              // table.setCellSelectionEnabled(true);
              // table.setShowGrid(false);
              scrollPane = new JScrollPane(table);
              scrollPane.setBorder(new LineBorder(Color.GRAY));
              getContentPane().add(scrollPane, BorderLayout.CENTER);
         // Local Inner JHyperLink Label class
         class JHyperLink extends JLabel {
              //This should be Strictly private
              private final LinkedList<Action> actionListenerList = new LinkedList<Action>();
              public JHyperLink() {
                   super("");
                   addMouseListener(new MouseAdapter() {
                        public void mouseEntered(MouseEvent me) {
                             fireMouseEntered(me);
                        public void mouseExited(MouseEvent me) {
                             fireMouseExited(me);
                             // status.removeAll();
                        public void mouseClicked(MouseEvent me) {
                             fireActionEvent();
                   //setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
              protected void fireMouseEntered(MouseEvent me) {
              protected void fireMouseExited(MouseEvent me) {
              public void addAction(Action l) {
                   if (!actionListenerList.contains(l)) {
                        actionListenerList.add(l);
              public void removeAction(Action l) {
                   actionListenerList.remove(l);
              protected void fireActionEvent() {
                   for (Action l : actionListenerList) {
                        Object source = null;
                             source = this;
                        ActionEvent e = new ActionEvent(source,
                                  ActionEvent.ACTION_PERFORMED, (String) l
                                            .getValue(Action.ACTION_COMMAND_KEY));
                        l.actionPerformed(e);
         public static void main(String[] args) {
              final String calCmd = "CALENDAR_ACTION";
              final JCalendar calendar = new JCalendar();
              calendar.setVisible(true);
              calendar.setLocation(75, 75);
              AbstractAction calendarAction = new AbstractAction() {
                   public void actionPerformed(ActionEvent e) {
                        if (e.getActionCommand().equalsIgnoreCase(calCmd)) {
                             if (e.getSource() != null
                                       && e.getSource() instanceof GregorianCalendar) {
                                  GregorianCalendar selCal = (GregorianCalendar) e
                                            .getSource();
                                  System.out.println("The Selected Date is :"
                                            + selCal.get(Calendar.MONTH) + "/"
                                            + selCal.get(Calendar.DATE) + "/"
                                            + selCal.get(Calendar.YEAR));
                                  calendar.dispose();
              calendarAction.putValue(Action.ACTION_COMMAND_KEY, calCmd);
              calendar.addAction(calendarAction);
              // calendar.pack();
              JFrame frame = new JFrame();
              JDesktopPane desk = new JDesktopPane();
              frame.setContentPane(desk);
              desk.add(calendar);
              frame.setLocation(50, 50);
              frame.setSize(400, 400);
              frame.setVisible(true);
    Cheers
    Ram

  • Date Picker visbile by default in Apex.

    Hi All,
    I have created two date pickers by default i will be dsiplaying only one, but when they click on that link i wil diplsay the other date picker report.
    I have created demo in my application but that is showing fine in 4.0 version but when i had tried in lower version 3.0 the date picker calendar is showing by deafult. But no erros are dsiplayed in script.
    Can you please let us know how we can hide the samll part of calendar icon.
    Here is an examplei had created whcih is replaicted what i had done im original application.
    workspace-apex_demo_bosu
    [email protected]
    password-bosuseshu
    URL is http://apex.oracle.com/pls/apex/f?p=19104:1:246873615402401:::::
    Thanks,
    Anoo..

    I realized you were talking about a form with an "Automatic Row Fetcher" after I had clicked submit;
    Let me see if I can understand this:
    you have a date column in your table (I hope it is a date)
    you have created a "form on a table" page that has an Automatic Row Fetcher process in it.
    If the row you are displaying has a value for the date column, you want that value to show up in the Date Picker item type (this should already happen)
    If the row you are displaying does not have a value, you want the Date Picker to have a default value of sysdate. (eg a NEW row of data)
    If #3 is not happening, let us know.
    #4 just requires a process that runs after the Automatic Row Fetcher.
    eg
    begin
      if :P11_DATE is null
      then
        :P11_DATE := to_char(sysdate, 'DD-MM-YYYY');
      end if;
    end;
    I'm sure there is  better way to do it.  I just don't know it right off.
    Mk

  • Date Picker problem in Apex 3.1

    Hi,
    I upgraded my apex to 3.1 and found that the date picker icon behaviour become quite strange.
    If I set the label of the date picker Horizontal/Vertical Alignment to Above, the picker icon will show below the text box instead of right side. And the pop-up calendar for Date Picker (DD-MM-YYYY HH24:MI) also not high enought to show the Close and OK button, I have to manually adjust the pop-up calendar height.
    All this problems were not there in 3.01, is these some kind of bug?
    Thanks
    Vincent

    Hello,
    Can you put an example of your particular layout on apex.oracle.com. The solution I had worked in most of the case's I tested , obviously yours is different.
    The next best solution would be to either shim the items with images, or to specifically set the widths of the containing table cells.
    The reason all this is happening is sometimes , depending on the region templates and CSS the regions will collapse down on the content, and the the browsers will do there best to fit the content in the smallest place possible, Unfortunately, in some cases the browsers ignore both nowrap="nowrap" and/or style="white-space:nowrap", why would I want to put nowrap on something and still have it wrap, I don't know it's not me it's the browsers.
    The solution in the patch I'm leaning towards is wrap item into a table. As it will work perfectly everywhere , and greatly annoy people that want tableless layouts, but that won't be available till the patch.
    Regards,
    Carl
    blog : http://carlback.blogspot.com/
    apex examples : http://apex.oracle.com/pls/otn/f?p=11933:5

  • Date Picker BUG on APEX 4.2.1

    Hi all could you please open a ticket for the following bug.
    Reproducing the bug very simple.
    Apex specification :
    version 4.2.1.00.08
    I'm not using HTML 5 template but the classic "Blue and Tan" one.
    1) Create a page with date picker with mask (DD-MON-YYY HH24.MI).
    2) set as default value the SYSDATE using the PLSQL expression (not specifying the mask to_char()).
    3) Try to use it and you will see that the year shown is not the correct one but is something like 1911.
    I fixed using to_char(SYSDATE,'DD-MON-YYY HH24.MI') in the PLSQL expression.

    Hi Zere,
    one very important thing to remember when dealing with session state (the value of a page item) is that everything is stored as string.
    If you specify SYSDATE as your default expression, then the Oracle database will evaluate that as date data type, but as soon as it's stored in session state, the database will do an implicit data type conversion using the default format mask specified for your database session.
    That's why it works when you do the TO_CHAR with the explicit format mask.
    Regards
    Patrick
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf
    Edited by: Patrick Wolf on Apr 10, 2013 3:37 PM

  • SQL query for date picker

    On a reports page there are two 2 date picker items ( a datefrom and a dateto) along with a text field with autocomplete item
    When the page loads the following query is called
    SELECT
    "COL1",
    "COL2",
    "COL3",
    from "TABLE"
    WHERE MYDATES BETWEEN :DATEFROM AND :DATETO
    Which returns no records as no dates have been selected.
    How can I alter this so the WHERE clause on the date item searches is called only if and when the dates are chosen, and by default all records are shown.
    The other related issue is when I have selected a from and to date and search when I go back into the report view page after viewing other pages in the apex app, the form fields are still populated, how can I clear the session down for these fields when the user leaves the page?
    Hope this all makes sense?

    To_date('01.01.2100', 'dd.mm.yyyy') is going to give wrong results on 02.01.2100 :D
    A solution (maybe there is a cleaner one...) :
    WHERE
    ((:DATEFROM IS NOT NULL AND mydates >= :DATEFROM) OR :DATEFROM IS NULL)
    AND
    ((:DATETO IS NOT NULL AND mydates <= :DATETO) OR :DATETO IS NULL)You can change the "No data found" message by modifiying the "When No Data Found Message" report attribute.
    EDIT : And for the 2nd issue, Alex is right, but also be aware that Firefox retains form element values on page refresh, you have to switch the "Form Auto Complete" page security attribute to "Off" if you don't want to retain form element values.
    Edited by: Yann39 on 27 juin 2012 06:30

  • Apex 3.1 Upgrade Issue - dba_lock and date picker display

    A couple of minor issues I've seen with my upgrade from 3.0.1 to 3.1. Just wondered if anyone else has seen them and if anyone has a simple fix for the date picker problem :
    1. DBA_LOCK - the upgrade process itself complains about the SYS.DBA_LOCK view not existing - easily remedied by running catblock.sql before you start the upgrade (but not listed as a pre-req)
    2. DATE PICKER display - I have a date picker item in a navigation region - before the upgrade the calendar icon happily appeared directly to the right of the date cell, since the upgrade the icon has moved to underneath the cell, messing up the look and feel. (Also the size of the pop up calendar doesn't quite fit its contents now and you have to resize to see the close and ok buttons )
    Any confirmation that others can replicate the second issue or a quick fix would be very helpful.
    Many thanks,
    Rich.

    Rich,
    >> Unfortunate that something has changed between 3.0 and 3.1 then that will require us to change the formatting. Hopefully not too much work to sort out a form region that looks the same though.
    I know the templates were revised for APEX 3.1, but that should not have affected existing applications. So you're saying that application used a Navigation Template before just fine without issues? I'll ask Carl to investigate.
    >> The issue of the default size of the pop up window cutting off the buttons at the bottom still remains in your example however. (obviously users can resize it but not ideal)
    Well, that really sucks. The worst thing we can do is break the behavior of existing applications, and it appears we've done it here. I filed Bug 6864371 on this issue. We'll get it fixed in the very first patch set for APEX 3.1.
    Joel

Maybe you are looking for