Package javax.faces.convert

Examples of javax.faces.convert.DateTimeConverter


    super.encodeEnd(facesContext, component);

    Converter help = getConverter(facesContext, component);
    // TODO is this really needed?
    if (help instanceof DateTimeConverter) {
      DateTimeConverter converter = (DateTimeConverter) help;
      String pattern = DateFormatUtils.findPattern(converter);

      if (pattern != null) {
        TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
        String id = component.getClientId(facesContext);
View Full Code Here


      final FacesContext facesContext, final UIPopup popup, final String converterPattern) {
    final UIComponent box = popup.getChildren().get(0);
    final UIComponent timePanel = box.findComponent("timePanel");
    if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
      final UITime time = (UITime) timePanel.findComponent("time");
      final 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

    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

        _type = type;
    }

    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

      final FacesContext facesContext, final UIPopup popup, final String converterPattern) {
    final UIComponent box = popup.getChildren().get(0);
    final UIComponent timePanel = box.findComponent("timePanel");
    if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
      final UITime time = (UITime) timePanel.findComponent("time");
      final 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

    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

    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.setTimeStyle("short");
      dateTimeConverter.setType("time");
      dateTimeConverter.setTimeZone(TimeZone.getDefault()); // TBD
      setConverter(dateTimeConverter);
      return dateTimeConverter;
    } else {
      return converter;
    }
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

        return super.doStartTag();
    }

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

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

        rootComponent.getChildren().add(form);

        //input1
        inputComponent1 = new HtmlInputText();
        inputComponent1.setId("input1");
        inputComponent1.setConverter(new DateTimeConverter());
        ((DateTimeConverter)inputComponent1.getConverter()).setPattern("dd.MM.yyyy");
        form.getChildren().add(inputComponent1);

        //input2
        inputComponent2 = new HtmlInputText();
        inputComponent2.setId("input2");
        inputComponent2.setConverter(new DateTimeConverter());
        ((DateTimeConverter)inputComponent2.getConverter()).setPattern("dd.MM.yyyy");
        form.getChildren().add(inputComponent2);
    }
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.