Examples of IConverter


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

        reportValidationError(e, 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

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

    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

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

  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

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

    {
      private static final long serialVersionUID = 1L;

      public IConverter getConverter(Class type)
      {
        IConverter c = AjaxEditableChoiceLabel.this.getConverter(type);
        return c != null ? c : super.getConverter(type);
      }

      protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
      {
        String displayValue = getModelObjectAsString();
        if (renderer != null)
        {
          Object displayObject = renderer.getDisplayValue(getModelObject());
          Class objectClass = (displayObject == null ? null : displayObject.getClass());

          if (objectClass != null && objectClass != String.class)
          {
            final IConverter converter = getConverter(objectClass);

            displayValue = converter.convertToString(displayObject, getLocale());
          }
        }

        if (Strings.isEmpty(displayValue))
        {
View Full Code Here

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

    {
      private static final long serialVersionUID = 1L;

      public IConverter getConverter(Class type)
      {
        IConverter c = AjaxEditableLabel.this.getConverter(type);
        return c != null ? c : super.getConverter(type);
      }

      protected void onModelChanged()
      {
View Full Code Here

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

    {
      private static final long serialVersionUID = 1L;

      public IConverter getConverter(Class type)
      {
        IConverter c = AjaxEditableLabel.this.getConverter(type);
        return c != null ? c : super.getConverter(type);
      }

      protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
      {
View Full Code Here

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

      // 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

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

public class ConverterTest extends GeoServerWicketTestSupport {

    public void testConvertEmtpyString() {
        // Wicket forms rely on converters returning null from an empty string conversion
        IConverterLocator locator = tester.getApplication().getConverterLocator();
        IConverter convert = locator.getConverter(Integer.class);
        assertNotNull(convert);
        assertNull(convert.convertToObject("", Locale.getDefault()));
    }
View Full Code Here

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

    // the converter both ways
    ColorPickerField textField = new ColorPickerField("paramValue",
        paramVale, Color.class) {
      @Override
      public IConverter getConverter(Class type) {
        return new IConverter() {

          public String convertToString(Object value, Locale locale) {
            String input = (String) value;
            if (input.startsWith("#"))
              return input.substring(1);
View Full Code Here

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

            // 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
TOP
Copyright © 2018 www.massapi.com. 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.