Package org.apache.myfaces.trinidad.component.core.input

Examples of org.apache.myfaces.trinidad.component.core.input.CoreChooseDate


    //
    // Create the calendar row
    //
    UIComponent calendarRow = _createRow(isDesktop,
                                         XhtmlConstants.H_ALIGN_END);
    CoreChooseDate ccd = CalendarUtils.createChooseDate(context);
    calendarRow.getChildren().add(ccd);

    // Get a destination that points back to this dialog, including
    // any viewIDs
    String destination =
      GenericEntry.getGenericEntryURL(context,
                                      GenericEntry.CALENDAR_DIALOG_ENTRY);
    ccd.getAttributes().put("destination", destination);

    //
    // Create a spacer
    //
    UIComponent spacerRow = _createRow(isDesktop, null);
    CoreSpacer cos = new CoreSpacer();
    spacerRow.getChildren().add(cos);
    cos.setHeight("8");

    //
    // Create the button row
    //
    UIComponent buttonRow = _createRow(isDesktop, XhtmlConstants.H_ALIGN_END);

    CoreGoButton cancelButton =
       JspUtils.createGoButton(arc, _CANCEL_LABEL_KEY);
    buttonRow.getChildren().add(cancelButton);

    Object cap = arc.getAgent().getCapabilities().get(
                     TrinidadAgent.CAP_MULTIPLE_WINDOWS);
    boolean multWindowsSupported = Boolean.TRUE.equals( cap );
    if (multWindowsSupported )
    {
      cancelButton.setOnclick("return _doCancel()");
    }
    else
    {
      // create the destination of the cancel button
      StringBuffer cancelDest = new StringBuffer();
      EncoderUtils.appendURLArguments(cancelDest,
                                      destination,
                                      new String[]{
                                        XhtmlConstants.EVENT_PARAM,
                                        XhtmlConstants.CANCEL_EVENT
                                      });

      // Prepend a slash, because this destination already
      // includes the context root
      cancelButton.setDestination("/" + cancelDest.toString());

      String value = __getParam(context, XhtmlConstants.VALUE_PARAM);
      if (value != null)
      {
        long lg = Long.parseLong(value);
        ccd.getAttributes().put("value", new Date(lg));
      }

      // get the scrolled value
      String month = __getParam(context,XhtmlConstants.MONTH_PARAM);
      String year = __getParam(context,XhtmlConstants.YEAR_PARAM);

      // try to create scrolledValue
      if ( month != null && year != null )
      {
        try
        {
          long scrolledValue = Long.parseLong(month) + Long.parseLong(year);


          ccd.getAttributes().put("scrolledValue", new Date(scrolledValue));
        }
        catch ( NumberFormatException nfe){;}
      }
    }
View Full Code Here


  public static CoreChooseDate createChooseDate(FacesContext context)
  {
    final String id = CalendarDialogJSP.__getParam(context,
                                                   XhtmlConstants.SOURCE_PARAM);
   
    CoreChooseDate ccd = new CoreChooseDate()
    {
      @Override
      public String getClientId(FacesContext context)
      {
        return id;
      }
    };

    String minTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.MIN_VALUE_PARAM);
    if (minTimeString != null)
    {
      ccd.setMinValue(parseTime(minTimeString));
    }

    String maxTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.MAX_VALUE_PARAM);
    if (maxTimeString != null)
    {
      ccd.setMaxValue(parseTime(maxTimeString));
    }

    String selectedTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.VALUE_PARAM);
    if (selectedTimeString != null)
    {
      ccd.getAttributes().put("value",
                              parseTime(selectedTimeString));
    }

    String displayTimeString = CalendarDialogJSP.__getParam(context,
                                                            "scrolledValue");
    if (displayTimeString != null)
    {
      ccd.getAttributes().put("scrolledValue",
                              parseTime(displayTimeString));
    }

    return ccd;
  }
View Full Code Here

{

  public void incrementMutable(ActionEvent ae)
  {
    FacesContext context = FacesContext.getCurrentInstance();
    CoreChooseDate cd = (CoreChooseDate)context.getViewRoot().findComponent("cdMutable");
    Date maxDate = cd.getMaxValue();

    Calendar cal = Calendar.getInstance();
    cal.setTime(maxDate);
    cal.add(Calendar.DAY_OF_YEAR, 1);
    maxDate.setTime(cal.getTimeInMillis());
View Full Code Here

  }
 
  public void incrementWithSet(ActionEvent ae)
  {
    FacesContext context = FacesContext.getCurrentInstance();
    CoreChooseDate cd = (CoreChooseDate)context.getViewRoot().findComponent("cdSet");
    Date maxDate = cd.getMaxValue();

    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(maxDate.getTime());
    cal.add(Calendar.DAY_OF_YEAR, 1);
    cd.setMaxValue(new Date(cal.getTimeInMillis()));
  }
View Full Code Here

{

  public void incrementMutable(ActionEvent ae)
  {
    FacesContext context = FacesContext.getCurrentInstance();
    CoreChooseDate cd = (CoreChooseDate)context.getViewRoot().findComponent("cdMutable");
    Date maxDate = cd.getMaxValue();

    Calendar cal = Calendar.getInstance();
    cal.setTime(maxDate);
    cal.add(Calendar.DAY_OF_YEAR, 1);
    maxDate.setTime(cal.getTimeInMillis());
View Full Code Here

  }
 
  public void incrementWithSet(ActionEvent ae)
  {
    FacesContext context = FacesContext.getCurrentInstance();
    CoreChooseDate cd = (CoreChooseDate)context.getViewRoot().findComponent("cdSet");
    Date maxDate = cd.getMaxValue();

    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(maxDate.getTime());
    cal.add(Calendar.DAY_OF_YEAR, 1);
    cd.setMaxValue(new Date(cal.getTimeInMillis()));
  }
View Full Code Here

    //
    // Create the calendar row
    //
    UIComponent calendarRow = _createRow(isDesktop,
                                         XhtmlConstants.H_ALIGN_END);
    CoreChooseDate ccd = CalendarUtils.createChooseDate(context);
    calendarRow.getChildren().add(ccd);

    // Get a destination that points back to this dialog, including
    // any viewIDs
    String destination =
      GenericEntry.getGenericEntryURL(context,
                                      GenericEntry.CALENDAR_DIALOG_ENTRY);
    ccd.getAttributes().put("destination", destination);

    //
    // Create a spacer
    //
    UIComponent spacerRow = _createRow(isDesktop, null);
    CoreSpacer cos = new CoreSpacer();
    spacerRow.getChildren().add(cos);
    cos.setHeight("8");

    //
    // Create the button row
    //
    UIComponent buttonRow = _createRow(isDesktop, XhtmlConstants.H_ALIGN_END);

    CoreGoButton cancelButton =
       JspUtils.createGoButton(arc, _CANCEL_LABEL_KEY);
    buttonRow.getChildren().add(cancelButton);

    Object cap = arc.getAgent().getCapabilities().get(
                     TrinidadAgent.CAP_MULTIPLE_WINDOWS);
    boolean multWindowsSupported = Boolean.TRUE.equals( cap );
    if (multWindowsSupported )
    {
      cancelButton.setOnclick("return _doCancel()");
    }
    else
    {
      // create the destination of the cancel button
      StringBuffer cancelDest = new StringBuffer();
      EncoderUtils.appendURLArguments(cancelDest,
                                      destination,
                                      new String[]{
                                        XhtmlConstants.EVENT_PARAM,
                                        XhtmlConstants.CANCEL_EVENT
                                      });

      // Prepend a slash, because this destination already
      // includes the context root
      cancelButton.setDestination("/" + cancelDest.toString());

      String value = __getParam(context, XhtmlConstants.VALUE_PARAM);
      if (value != null)
      {
        long lg = Long.parseLong(value);
        ccd.getAttributes().put("value", new Date(lg));
      }

      // get the scrolled value
      String month = __getParam(context,XhtmlConstants.MONTH_PARAM);
      String year = __getParam(context,XhtmlConstants.YEAR_PARAM);

      // try to create scrolledValue
      if ( month != null && year != null )
      {
        try
        {
          long scrolledValue = Long.parseLong(month) + Long.parseLong(year);


          ccd.getAttributes().put("scrolledValue", new Date(scrolledValue));
        }
        catch ( NumberFormatException nfe){;}
      }
    }
View Full Code Here

  public static CoreChooseDate createChooseDate(FacesContext context)
  {
    final String id = CalendarDialogJSP.__getParam(context,
                                                   XhtmlConstants.SOURCE_PARAM);
   
    CoreChooseDate ccd = new CoreChooseDate()
    {
      @Override
      public String getClientId(FacesContext context)
      {
        return id;
      }
    };

    String minTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.MIN_VALUE_PARAM);
    if (minTimeString != null)
    {
      ccd.setMinValue(parseTime(minTimeString));
    }

    String maxTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.MAX_VALUE_PARAM);
    if (maxTimeString != null)
    {
      ccd.setMaxValue(parseTime(maxTimeString));
    }

    String selectedTimeString = CalendarDialogJSP.__getParam(context,
                                             XhtmlConstants.VALUE_PARAM);
    if (selectedTimeString != null)
    {
      ccd.getAttributes().put("value",
                              parseTime(selectedTimeString));
    }

    String displayTimeString = CalendarDialogJSP.__getParam(context,
                                                            "scrolledValue");
    if (displayTimeString != null)
    {
      ccd.getAttributes().put("scrolledValue",
                              parseTime(displayTimeString));
    }

    return ccd;
  }
View Full Code Here

    //
    // Create the calendar row
    //
    UIComponent calendarRow = _createRow(isDesktop,
                                         XhtmlConstants.H_ALIGN_END);
    CoreChooseDate ccd = CalendarUtils.createChooseDate(context);
    calendarRow.getChildren().add(ccd);

    // Get a destination that points back to this dialog, including
    // any viewIDs
    String destination =
      GenericEntry.getGenericEntryURL(context,
                                      GenericEntry.CALENDAR_DIALOG_ENTRY);
    ccd.getAttributes().put("destination", destination);

    //
    // Create a spacer
    //
    UIComponent spacerRow = _createRow(isDesktop, null);
    CoreSpacer cos = new CoreSpacer();
    spacerRow.getChildren().add(cos);
    cos.setHeight("8");

    //
    // Create the button row
    //
    UIComponent buttonRow = _createRow(isDesktop, XhtmlConstants.H_ALIGN_END);

    CoreGoButton cancelButton =
       JspUtils.createGoButton(arc, _CANCEL_LABEL_KEY);
    buttonRow.getChildren().add(cancelButton);

    Object cap = arc.getAgent().getCapabilities().get(
                     TrinidadAgent.CAP_MULTIPLE_WINDOWS);
    boolean multWindowsSupported = Boolean.TRUE.equals( cap );
    if (multWindowsSupported )
    {
      cancelButton.setOnclick("return _doCancel()");
    }
    else
    {
      // create the destination of the cancel button
      StringBuffer cancelDest = new StringBuffer();
      EncoderUtils.appendURLArguments(cancelDest,
                                      destination,
                                      new String[]{
                                        TrinidadRenderingConstants.EVENT_PARAM,
                                        TrinidadRenderingConstants.CANCEL_EVENT
                                      });

      // Prepend a slash, because this destination already
      // includes the context root
      cancelButton.setDestination("/" + cancelDest.toString());

      String value = __getParam(context, TrinidadRenderingConstants.VALUE_PARAM);
      if (value != null)
      {
        long lg = Long.parseLong(value);
        ccd.getAttributes().put("value", new Date(lg));
      }

      // get the scrolled value
      String month = __getParam(context,TrinidadRenderingConstants.MONTH_PARAM);
      String year = __getParam(context,TrinidadRenderingConstants.YEAR_PARAM);

      // try to create scrolledValue
      if ( month != null && year != null )
      {
        try
        {
          long scrolledValue = Long.parseLong(month) + Long.parseLong(year);


          ccd.getAttributes().put("scrolledValue", new Date(scrolledValue));
        }
        catch ( NumberFormatException nfe){;}
      }
    }
View Full Code Here

  public static CoreChooseDate createChooseDate(FacesContext context)
  {
    final String id = CalendarDialogJSP.__getParam(context,
                                                   TrinidadRenderingConstants.SOURCE_PARAM);
   
    CoreChooseDate ccd = new CoreChooseDate()
    {
      @Override
      public String getClientId(FacesContext context)
      {
        return id;
      }
    };

    String minTimeString = CalendarDialogJSP.__getParam(context,
                                             TrinidadRenderingConstants.MIN_VALUE_PARAM);
    if (minTimeString != null)
    {
      ccd.setMinValue(parseTime(minTimeString));
    }

    String maxTimeString = CalendarDialogJSP.__getParam(context,
                                             TrinidadRenderingConstants.MAX_VALUE_PARAM);
    if (maxTimeString != null)
    {
      ccd.setMaxValue(parseTime(maxTimeString));
    }

    String selectedTimeString = CalendarDialogJSP.__getParam(context,
                                             TrinidadRenderingConstants.VALUE_PARAM);
    if (selectedTimeString != null)
    {
      ccd.getAttributes().put("value",
                              parseTime(selectedTimeString));
    }

    String displayTimeString = CalendarDialogJSP.__getParam(context,
                                                            "scrolledValue");
    if (displayTimeString != null)
    {
      ccd.getAttributes().put("scrolledValue",
                              parseTime(displayTimeString));
    }

    return ccd;
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.component.core.input.CoreChooseDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.