Package org.apache.wicket.util.convert

Examples of org.apache.wicket.util.convert.IConverter


    Class<?> objectClass = displayValue == null ? null : displayValue.getClass();
    // Get label for choice
    String label = "";
    if (objectClass != null && objectClass != String.class)
    {
      @SuppressWarnings("rawtypes")
      IConverter converter = getConverter(objectClass);
      label = converter.convertToString(displayValue, getLocale());
    }
    else if (displayValue != null)
    {
      label = displayValue.toString();
    }
View Full Code Here


    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

            // for String vars, e.g. {label}
            return (String)value;
          }
          else
          {
            IConverter converter = getConverter(value.getClass());
            if (converter == null)
            {
              return Strings.toString(value);
            }
            else
            {
              return converter.convertToString(value, getLocale());
            }
          }
        }
      }.toString();
    }
View Full Code Here

    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

        error((IValidationError)error);
      }
    }
    else
    {
      final IConverter converter = getConverter(getType());
      try
      {
        convertedInput = converter.convertToObject(getInput(), getLocale());
      }
      catch (ConversionException e)
      {
        ValidationError error = new ValidationError();
        if (e.getResourceKey() != null)
View Full Code Here

      // don't provide a format
    }

    if (format == null)
    {
      IConverter converter = component.getConverter(DateTime.class);
      if (!(converter instanceof DateConverter))
      {
        converter = component.getConverter(Date.class);
      }
      format = ((SimpleDateFormat)((DateConverter)converter).getDateFormat(component
View Full Code Here

  public final String getModelObjectAsString(final Object modelObject)
  {
    if (modelObject != null)
    {
      // Get converter
      final IConverter converter = getConverter(modelObject.getClass());

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

      // TextField using a custom converter.
      add(new TextField("urlProperty", URL.class)
      {
        public IConverter getConverter(final Class type)
        {
          return new IConverter()
          {
            public Object convertToObject(String value, Locale locale)
            {
              try
              {
View Full Code Here

    {
      // were ok
      return;
    }

    IConverter converter = component.getConverter(DateTime.class);
    if (converter == null)
    {
      converter = component.getConverter(Date.class);
    }
    if (converter instanceof DateConverter)
View Full Code Here

      return ((ITextFormatProvider)component).getTextFormat();
    }
    else
    {
      // cast from hell, but we checked before whether we could
      IConverter converter = component.getConverter(DateTime.class);
      if (converter == null)
      {
        converter = component.getConverter(Date.class);
      }
      return ((SimpleDateFormat)((DateConverter)converter).getDateFormat(component
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.convert.IConverter

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.