Package javax.faces.convert

Examples of javax.faces.convert.DateTimeConverter


    // for convenience, we will set the time zone of the converter to that
    // specified by the context or, if that is not present, to the time zone
    // of the server
    if (converter instanceof DateTimeConverter)
    {
      DateTimeConverter dtc = (DateTimeConverter) converter;

      boolean trinidadDTC = _isTrinidadDateTimeConverter(converter);

      if (!trinidadDTC)
      {
        // if it is not the Trinidad DateTimeConverter, set the date style to
        // short
        dtc.setDateStyle("short");
      }

      // if it is not the Trinidad DateTimeConverter or (it is AND
      // no time zone is set) then we want to set the
      // time zone to the one in the faces context or use
      // the default server time zone on the converter
      if (!trinidadDTC || dtc.getTimeZone() == null)
      {
        TimeZone tz = null;

        RequestContext requestContext = RequestContext.getCurrentInstance();
        tz = requestContext.getTimeZone();
        if(tz == null)
        {
          tz = TimeZone.getDefault();
        }

        dtc.setTimeZone(tz);
      }
    }

    return converter;
  }
View Full Code Here


        setConverterId(DateTimeConverter.CONVERTER_ID);
    }

    protected Converter createConverter() throws JspException
    {
        DateTimeConverter converter = (DateTimeConverter)super.createConverter();

        FacesContext facesContext = FacesContext.getCurrentInstance();
        setConverterDateStyle(facesContext, converter, _dateStyle);
        setConverterLocale(facesContext, converter, _locale);
        setConverterPattern(facesContext, converter, _pattern);
View Full Code Here

    if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
      UITime time = (UITime) timePanel.findComponent("time");
      Measure popupHeight = popup.getCurrentHeight();
      popupHeight = popupHeight.add(getResourceManager().getThemeMeasure(facesContext, time, "preferredHeight"));
      popup.setHeight(popupHeight);
      DateTimeConverter dateTimeConverter
          = (DateTimeConverter) facesContext.getApplication().createConverter(DateTimeConverter.CONVERTER_ID);
      if (converterPattern.indexOf('s') > -1) {
        dateTimeConverter.setPattern("HH:mm:ss");
      } else {
        dateTimeConverter.setPattern("HH:mm");
      }
      dateTimeConverter.setTimeZone(TimeZone.getDefault());
      time.setConverter(dateTimeConverter);
    } else {
      timePanel.setRendered(false);
    }
  }
View Full Code Here

    // for convenience, we will set the time zone of the converter to that
    // specified by the context or, if that is not present, to the time zone
    // of the server
    if (converter instanceof DateTimeConverter)
    {
      DateTimeConverter dtc = (DateTimeConverter) converter;
     
      boolean trinidadDTC = _isTrinidadDateTimeConverter(converter);
     
      if (!trinidadDTC)
      {
        // if it is not the Trinidad DateTimeConverter, set the date style to
        // short
        dtc.setDateStyle("short");
      }
     
      // if it is not the Trinidad DateTimeConverter or (it is AND
      // no time zone is set) then we want to set the
      // time zone to the one in the faces context or use
      // the default server time zone on the converter
      if (!trinidadDTC || dtc.getTimeZone() == null)
      {
        TimeZone tz = null;
       
        RequestContext requestContext = RequestContext.getCurrentInstance();
        tz = requestContext.getTimeZone();
        if(tz == null)
        {
          tz = TimeZone.getDefault();
        }
       
        dtc.setTimeZone(tz);
      }
    }
   
    return converter;
  }
View Full Code Here

                throw new IllegalStateException("Improper type converter has been specified. DateTimeConverter is expected. The actual type of the specified converter is: " + explicitlySpecifiedConverter.getClass().getName());
            dateChooser.getAttributes().put(converterSpecifiedExplicitlyAttr, converterSpecifiedExplicitly);
        }
        if (converterSpecifiedExplicitly) return;

        DateTimeConverter converter = new DateTimeConverter();
        converter.setPattern(dateChooser.getPattern());
        converter.setDateStyle(dateChooser.getDateFormat());
        converter.setLocale(dateChooser.getLocale());

        TimeZone timeZone = (dateChooser.getTimeZone() != null)
                ? dateChooser.getTimeZone()
                : TimeZone.getDefault();
        converter.setTimeZone(timeZone);

        dateChooser.setConverter(converter);
    }
View Full Code Here

        DateChooser dc = (DateChooser) dropDown;

        String pattern = null;
        Converter c = dc.getConverter();
        if (c != null && c instanceof DateTimeConverter) {
            DateTimeConverter dtc = (DateTimeConverter) c;
            pattern = dtc.getPattern();
        }

        // Related to JSFC-2042. Send date adjusted to GMT on client. It'll be used to set correct date to calendar
        String formatDate = null;
        Object value = dc.getValue();
View Full Code Here

    // Methods from ConverterTag
    //

    protected Converter createConverter() throws JspException {

        DateTimeConverter result = (DateTimeConverter) super.createConverter();
        assert (null != result);

        evaluateExpressions();
        result.setDateStyle(dateStyle);
        result.setLocale(locale);
        result.setPattern(pattern);
        result.setTimeStyle(timeStyle);
        result.setTimeZone(timeZone);
        result.setType(type);

        return result;
    }
View Full Code Here

    final Converter converter = super.getConverter();
    if (converter == null) {
      // setting required default converter
      final Application application
          = FacesContext.getCurrentInstance().getApplication();
      final DateTimeConverter dateTimeConverter
          = (DateTimeConverter) application.createConverter(DateTimeConverter.CONVERTER_ID);
      dateTimeConverter.setPattern("HH:mm");
      dateTimeConverter.setTimeZone(TimeZone.getDefault());
      setConverter(dateTimeConverter);
    }
    return converter;
  }
View Full Code Here

      // Todo: in Tobago 3.0 TimeRenderer should extend InRenderer, and this can cleaned up!
      String pattern = null;
      final Converter help = getConverter(facesContext, time);
      if (help instanceof DateTimeConverter) {
        final DateTimeConverter converter = (DateTimeConverter) help;
        pattern = DateFormatUtils.findPattern(converter);
      }
      if (pattern == null) {
        pattern = "HH-mm";
        LOG.warn("Can't find the pattern for the converter! DatePicker may not work correctly. "
View Full Code Here

    super.writeAdditionalAttributes(facesContext, writer, input);

    String pattern = null;
    final Converter help = getConverter(facesContext, input);
    if (help instanceof DateTimeConverter) {
      final DateTimeConverter converter = (DateTimeConverter) help;
      pattern = DateFormatUtils.findPattern(converter);
    }
    if (pattern == null) {
      pattern = "yyyy-MM-dd";
      LOG.warn("Can't find the pattern for the converter! DatePicker may not work correctly. "
View Full Code Here

TOP

Related Classes of javax.faces.convert.DateTimeConverter

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.