Java Code Examples for org.apache.wicket.util.convert.IConverter

The following examples show how to use org.apache.wicket.util.convert.IConverter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: projectforge-webapp   Author: micromata   File: SingleTextFieldPanel.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("serial")
public static SingleTextFieldPanel createMinMaxNumberField(final String id, final IModel<Integer> model, final Integer minimum,
    final Integer maximum, final IConverter converter)
{
  final SingleTextFieldPanel panel = new SingleTextFieldPanel(id);
  final MinMaxNumberField<Integer> textField;
  if (converter != null) {
    textField = new MinMaxNumberField<Integer>("text", model, minimum, maximum) {
      /**
       * @see org.projectforge.web.wicket.components.MinMaxNumberField#getConverter(java.lang.Class)
       */
      @Override
      public <C> IConverter<C> getConverter(final Class<C> type)
      {
        return converter;
      }
    };
  } else {
    textField = new MinMaxNumberField<Integer>("text", model, minimum, maximum);
  }
  panel.setTextField(textField);
  return panel;
}
 
Example #2
Source Project: nextreports-server   Author: nextreports   File: PivotTable.java    License: Apache License 2.0 6 votes vote down vote up
protected Label createValueLabel(String id, Object value, final PivotField pivotField) {
	return new Label(id, Model.of((Serializable) value)) {
		
		private static final long serialVersionUID = 1L;

		@SuppressWarnings("unchecked")
		@Override
		public <C> IConverter<C> getConverter(Class<C> type) {
			IConverter<C> converter = (IConverter<C>) pivotField.getConverter();
			if (converter != null) {
				return converter;
			}
			
			return super.getConverter(type);
		}

	};
}
 
Example #3
Source Project: inception   Author: inception-project   File: ConceptFeatureEditor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public <C> IConverter<C> getConverter(Class<C> aType)
{
    if (aType != null && aType.isAssignableFrom(this.getType())) {
        return (IConverter<C>) converter;
    }
    
    return super.getConverter(aType);
}
 
Example #4
Source Project: onedev   Author: theonedev   File: FormComponent.java    License: MIT License 5 votes vote down vote up
private String substitute(String string, final Map<String, Object> vars)
	throws IllegalStateException
{
	return new VariableInterpolator(string, Application.get()
		.getResourceSettings()
		.getThrowExceptionOnMissingResource())
	{
		private static final long serialVersionUID = 1L;

		@SuppressWarnings({ "rawtypes", "unchecked" })
		@Override
		protected String getValue(String variableName)
		{
			Object value = vars.get(variableName);
			
			if (value == null ||value instanceof String)
			{
				return String.valueOf(value);
			}
			
			IConverter converter = getConverter(value.getClass());
			
			if (converter == null)
			{
				return Strings.toString(value);
			}
			else
			{
				return converter.convertToString(value, getLocale());
			}
		}
	}.toString();
}
 
Example #5
Source Project: openmeetings   Author: apache   File: OmDateTimePicker.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected FormComponent<LocalDateTime> newInput(String wicketId, String dateFormat) {
	return new LocalDateTimeTextField(wicketId, getModel(), dateFormat) {
		private static final long serialVersionUID = 1L;

		@Override
		protected IConverter<?> createConverter(Class<?> clazz) {
			if (LocalDateTime.class.isAssignableFrom(clazz)) {
				return converter;
			}
			return null;
		}
	};
}
 
Example #6
Source Project: pm-wicket-utils   Author: premium-minds   File: TemporalTextField.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the default converter if created without pattern; otherwise it returns a
 * pattern-specific converter.
 * 
 * @param type
 *            The type for which the convertor should work
 * 
 * @return A pattern-specific converter
 * 
 * @see org.apache.wicket.markup.html.form.TextField
 */
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
	if (Temporal.class.isAssignableFrom(type))
	{
		return (IConverter<C>)converter;
	}
	else
	{
		return super.getConverter(type);
	}
}
 
Example #7
Source Project: Orienteer   Author: OrienteerBAP   File: CommonUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Convert given object to localized string
 * Uses Wicket {@link IConverter}
 * @param value {@link Object} value which need convert to string
 * @param defaultValue {@link String} default value if can't convert value to string or value is null
 * @return {@link String} value converted into string
 */
public static final String objectToString(Object value, String defaultValue) {
	String ret = null;
	if(value!=null) {
		final Class<?> objectClass = value.getClass();
		final IConverter converter = OrienteerWebApplication.get().getConverterLocator().getConverter(objectClass);
		ret = converter.convertToString(value, OrienteerWebSession.get().getLocale());
	}
	return ret!=null?ret:defaultValue;
}
 
Example #8
Source Project: Orienteer   Author: OrienteerBAP   File: CommonUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Safe method to get String representation of an object.
 * Wicket convertions are also has been used
 * @param data
 * @return
 */
@SuppressWarnings("unchecked")
public static String toString(Object data) {
	if(data==null) return "null";
	else if (data instanceof CharSequence) return data.toString();
	else {
		IConverter<Object> converter = (IConverter<Object>)OrienteerWebApplication.lookupApplication()
																.getConverterLocator().getConverter(data.getClass());
		if(converter!=null) {
			return converter.convertToString(data, Session.exists()?Session.get().getLocale():Locale.getDefault());
		} else {
			return data.toString();
		}
	}
}
 
Example #9
Source Project: projectforge-webapp   Author: micromata   File: PaymentSchedulePanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("serial")
public void rebuildEntries()
{
  final List<PaymentScheduleDO> entries = model.getObject().getPaymentSchedules();
  if (entries != null) {
    entrysRepeater.removeAll();
    for (final PaymentScheduleDO entry : entries) {
      final WebMarkupContainer item = new WebMarkupContainer(entrysRepeater.newChildId());
      entrysRepeater.add(item);
      final DatePanel datePanel = new DatePanel("scheduleDate", new PropertyModel<Date>(entry, "scheduleDate"), DatePanelSettings.get()
          .withTargetType(java.sql.Date.class));
      item.add(datePanel);
      final TextField<String> amount = new TextField<String>("amount", new PropertyModel<String>(entry, "amount")) {
        @SuppressWarnings({ "rawtypes", "unchecked"})
        @Override
        public IConverter getConverter(final Class type)
        {
          return new CurrencyConverter();
        }
      };
      item.add(amount);
      item.add(new MaxLengthTextField("comment", new PropertyModel<String>(entry, "comment")));
      item.add(new CheckBox("reached", new PropertyModel<Boolean>(entry, "reached")));
      if (UserRights.getAccessChecker().hasRight(user, RechnungDao.USER_RIGHT_ID, UserRightValue.READWRITE) == true) {
        final DivPanel checkBoxDiv = new DivPanel("vollstaendigFakturiert", DivType.BTN_GROUP);
        item.add(checkBoxDiv);
        checkBoxDiv.add(new CheckBoxButton(checkBoxDiv.newChildId(), new PropertyModel<Boolean>(entry, "vollstaendigFakturiert"),
            getString("fibu.auftrag.vollstaendigFakturiert")));
      } else {
        item.add(WicketUtils.getInvisibleComponent("vollstaendigFakturiert"));
      }
    }
  }
}
 
Example #10
Source Project: projectforge-webapp   Author: micromata   File: GanttChartEditTreeTablePanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("serial")
private void addProgressColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject,
    final TaskDO task)
{
  final MinMaxNumberField<Integer> progressField = new MinMaxNumberField<Integer>("progress", new PropertyModel<Integer>(ganttObject,
      "progress"), 0, 100) {
    @Override
    public IConverter getConverter(final Class type)
    {
      return new IntegerPercentConverter(0);
    }
  };
  addColumn(item, progressField, null);
  new RejectSaveLinksFragment("rejectSaveProgress", item, progressField, task,
      task != null ? NumberHelper.getAsString(task.getProgress()) : "") {
    @Override
    protected void onSave()
    {
      task.setProgress(ganttObject.getProgress());
      taskDao.update(task);
    }

    @Override
    protected void onReject()
    {
      ganttObject.setProgress(task.getProgress());
    }
  };
}
 
Example #11
Source Project: projectforge-webapp   Author: micromata   File: JodaDateField.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  if (converter == null) {
    converter = new JodaDateConverter();
  }
  return (IConverter<C>)converter;
}
 
Example #12
Source Project: projectforge-webapp   Author: micromata   File: AjaxMaxLengthEditableLabel.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  if (converter != null) {
    return converter;
  } else {
    return super.getConverter(type);
  }
}
 
Example #13
Source Project: projectforge-webapp   Author: micromata   File: LanguageField.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  return converter;
}
 
Example #14
Source Project: projectforge-webapp   Author: micromata   File: MaxLengthTextField.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@SuppressWarnings("unchecked")
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  if (converter != null) {
    return converter;
  } else {
    return super.getConverter(type);
  }
}
 
Example #15
Source Project: projectforge-webapp   Author: micromata   File: MinMaxNumberField.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  if (converter != null) {
    return converter;
  } else {
    return super.getConverter(type);
  }
}
 
Example #16
Source Project: sakai   Author: sakaiproject   File: SakaiDateTimeField.java    License: Educational Community License v2.0 4 votes vote down vote up
@Override
public <ZonedDateTime> IConverter<ZonedDateTime> getConverter(Class<ZonedDateTime> type)
{
	return (IConverter<ZonedDateTime>) dateConverter;
}
 
Example #17
Source Project: ontopia   Author: ontopia   File: AssociationFieldAutoCompleteTextField.java    License: Apache License 2.0 4 votes vote down vote up
public AssociationFieldAutoCompleteTextField(String id, IModel<Topic> model, final RoleFieldModel valueFieldModel) {
  super(id);
      
  AutoCompleteSettings opts = new AutoCompleteSettings();
  opts.setCssClassName("ontopoly-autocompleter");
  opts.setAdjustInputWidth(false);
  opts.setPreselect(true);
  
  this.textField = new AutoCompleteTextField<Topic>("autoComplete", model, Topic.class, new AbstractAutoCompleteRenderer<Topic>() {
      @Override
      protected String getTextValue(Topic o) {
        return TOPIC_CONVERTER.convertToString(o);
      }
      @Override
      protected void renderChoice(Topic o, Response response, String criteria) {
        response.write(o.getName());
      }}, opts) {

    @Override
    public IConverter getConverter(Class<?> type) {
      if (Topic.class.equals(type)) {
        return new TopicConverter();
      } else {
        return super.getConverter(type);
      }
    }
  
    @Override
    protected Iterator<Topic> getChoices(String input) {
      List<Topic> result = new ArrayList<Topic>(valueFieldModel.getRoleField().searchAllowedPlayers(input));
      filterPlayers(result);
      Collections.sort(result, TopicComparator.INSTANCE);
      return result.iterator();
    }
    
    @Override
    protected void onModelChanged() {
  	super.onModelChanged();
      Topic topic = getModelObject();
      if (topic != null) {
        AssociationFieldAutoCompleteTextField.this.onTopicSelected(topic);
      }
    }
  };    
  add(textField);
}
 
Example #18
Source Project: pm-wicket-utils   Author: premium-minds   File: TemporalTextField.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public TemporalTextField(String id, IModel<T> model,
		String pattern, final Class<T> type) {
	super(id, model, type);

	this.pattern = pattern;

	converter = new IConverter<T>() {
		private static final long serialVersionUID = 1L;

		public String convertToString(Temporal value, Locale locale) {
			if(null == locale) {
				return DateTimeFormatter.ofPattern(TemporalTextField.this.pattern).format(value);
			} else {
				return DateTimeFormatter.ofPattern(TemporalTextField.this.pattern).withLocale(locale).format(value);
			}
		}

		@SuppressWarnings("unchecked")
		public T convertToObject(String value, Locale locale) throws ConversionException {
			DateTimeFormatter formatter =
		            new DateTimeFormatterBuilder().appendPattern(TemporalTextField.this.pattern)
		            .parseDefaulting(ChronoField.HOUR_OF_DAY, 0)
		            .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
		            .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
		            .parseDefaulting(ChronoField.DAY_OF_MONTH, 1)
		            .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1)
		            .parseDefaulting(ChronoField.YEAR_OF_ERA, ZonedDateTime.now().getYear())
		            .toFormatter();
			if (null != locale) {
				formatter = formatter.withLocale(locale);
			}

			try {
				Method parser = type.getMethod("parse", CharSequence.class, DateTimeFormatter.class);
				return (T)parser.invoke(null, value, formatter);
			} catch (NoSuchMethodException | SecurityException e1) {
				log.error("Could not find parser for type " + type.getSimpleName());
			} catch(Exception e) {
				log.error("Could not convert [" + value +"] to a valid " + type.getSimpleName());
			}

			return null;
		}
	};
}
 
Example #19
Source Project: pm-wicket-utils   Author: premium-minds   File: FormatLabel.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public <C> IConverter<C> getConverter(Class<C> type) {
	return new CustomConverter<C>();
}
 
Example #20
Source Project: sakai   Author: sakaiproject   File: SakaiDateTimeField.java    License: Educational Community License v2.0 4 votes vote down vote up
@Override
public <ZonedDateTime> IConverter<ZonedDateTime> getConverter(Class<ZonedDateTime> type)
{
	return (IConverter<ZonedDateTime>) dateConverter;
}
 
Example #21
Source Project: projectforge-webapp   Author: micromata   File: NewProjektSelectPanel.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param id
 * @param model
 * @param caller
 * @param selectProperty
 */
@SuppressWarnings("serial")
public NewProjektSelectPanel(final String id, final IModel<ProjektDO> model, final String label, final ISelectCallerPage iCaller, final String selectProperty)
{
  super(id, model, iCaller, selectProperty);
  projectTextField = new PFAutoCompleteTextField<ProjektDO>("projectField", getModel()) {
    @Override
    protected List<ProjektDO> getChoices(final String input)
    {
      final BaseSearchFilter filter = new BaseSearchFilter();
      filter.setSearchFields("id", "name", "identifier", "nummer");
      filter.setSearchString(input);
      final List<ProjektDO> list = projektDao.getList(filter);
      return list;
    }

    @Override
    protected List<String> getRecentUserInputs()
    {
      return getRecentProjects().getRecents();
    }

    @Override
    protected String formatLabel(final ProjektDO project)
    {
      if (project == null) {
        return "";
      }
      return projektFormatter.format(project, false);
    }

    @Override
    protected String formatValue(final ProjektDO project)
    {
      if (project == null) {
        return "";
      }
      return projektFormatter.format(project, false);
    }

    @Override
    protected void convertInput()
    {
      final ProjektDO project = getConverter(getType()).convertToObject(getInput(), getLocale());
      setConvertedInput(project);
      if (project != null && (currentProject == null || project.getId() != currentProject.getId())) {
        getRecentProjects().append(projektFormatter.format(project, false));
      }
      currentProject = project;
    }

    /**
     * @see org.apache.wicket.Component#getConverter(java.lang.Class)
     */
    @SuppressWarnings({ "unchecked", "rawtypes"})
    @Override
    public <C> IConverter<C> getConverter(final Class<C> type)
    {
      return new IConverter() {
        @Override
        public Object convertToObject(final String value, final Locale locale)
        {
          if (StringUtils.isEmpty(value) == true) {
            getModel().setObject(null);
            return null;
          }

          final ProjektDO project = getProjekt(value);
          if (project == null) {
            error(getString("panel.error.projectNotFound"));
          }
          getModel().setObject(project);

          return project;
        }

        @Override
        public String convertToString(final Object value, final Locale locale)
        {
          if (value == null) {
            return "";
          }
          final ProjektDO project = (ProjektDO) value;
          return formatLabel(project);
        }

      };
    }
  };
  currentProject = getModelObject();
  projectTextField.enableTooltips().withLabelValue(true).withMatchContains(true).withMinChars(2).withAutoSubmit(false); // .withWidth(400);
}
 
Example #22
Source Project: projectforge-webapp   Author: micromata   File: KontoFormComponent.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public IConverter getConverter(final Class type)
{
  return new KontoConverter();
}
 
Example #23
Source Project: projectforge-webapp   Author: micromata   File: NewCustomerSelectPanel.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param id
 * @param model
 * @param caller
 * @param selectProperty
 */
@SuppressWarnings("serial")
public NewCustomerSelectPanel(final String id, final IModel<KundeDO> model, final PropertyModel<String> kundeText,
    final ISelectCallerPage caller, final String selectProperty)
{
  super(id, model, caller, selectProperty);
  this.kundeText = kundeText;
  customerTextField = new PFAutoCompleteTextField<KundeDO>("customerField", getModel()) {
    @Override
    protected List<KundeDO> getChoices(final String input)
    {
      final BaseSearchFilter filter = new BaseSearchFilter();
      filter.setSearchFields("id", "name", "identifier", "division");
      filter.setSearchString(input);
      final List<KundeDO> list = kundeDao.getList(filter);
      return list;
    }

    @Override
    protected List<String> getRecentUserInputs()
    {
      return getRecentCustomers().getRecents();
    }

    @Override
    protected String formatLabel(final KundeDO customer)
    {
      if (customer == null) {
        return "";
      }
      return kundeFormatter.format(customer, false);
    }

    @Override
    protected String formatValue(final KundeDO customer)
    {
      if (customer == null) {
        return "";
      }
      return kundeFormatter.format(customer, false);
    }

    @Override
    protected void convertInput()
    {
      final KundeDO customer = getConverter(getType()).convertToObject(getInput(), getLocale());
      setConvertedInput(customer);
      if (customer != null && (currentCustomer == null || customer.getId() != currentCustomer.getId())) {
        getRecentCustomers().append(kundeFormatter.format(customer, false));
      }
      currentCustomer = customer;
    }

    /**
     * @see org.apache.wicket.Component#getConverter(java.lang.Class)
     */

    @SuppressWarnings({ "unchecked", "rawtypes"})
    @Override
    public <C> IConverter<C> getConverter(final Class<C> type)
    {
      return new IConverter() {
        @Override
        public Object convertToObject(final String value, final Locale locale)
        {
          if (StringUtils.isEmpty(value) == true) {
            getModel().setObject(null);
            return null;
          }
          final int ind = value.indexOf(" - ");
          final String idString = ind >= 0 ? value.substring(0, ind) : value;
          final Integer id = NumberHelper.parseInteger(idString);
          final KundeDO kunde = id != null ? kundeDao.getById(id) : null;
          if (kunde == null) {
            error(getString("panel.error.customernameNotFound"));
          }
          getModel().setObject(kunde);
          return kunde;
        }

        @Override
        public String convertToString(final Object value, final Locale locale)
        {
          if (value == null) {
            return "";
          }
          final KundeDO kunde = (KundeDO) value;
          return formatLabel(kunde);
        }

      };
    }
  };
  currentCustomer = getModelObject();
  customerTextField.enableTooltips().withLabelValue(true).withMatchContains(true).withMinChars(2).withAutoSubmit(false); // .withWidth(400);
}
 
Example #24
Source Project: projectforge-webapp   Author: micromata   File: AuftragsPositionFormComponent.java    License: GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked"})
@Override
public IConverter getConverter(final Class type)
{
  return new AuftragsPositionConverter();
}
 
Example #25
Source Project: projectforge-webapp   Author: micromata   File: Kost1FormComponent.java    License: GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked"})
@Override
public IConverter getConverter(final Class type)
{
  return new Kost1Converter();
}
 
Example #26
Source Project: projectforge-webapp   Author: micromata   File: Kost2FormComponent.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public IConverter getConverter(final Class type)
{
  return new Kost2Converter();
}
 
Example #27
Source Project: projectforge-webapp   Author: micromata   File: NewGroupSelectPanel.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param id
 * @param model
 * @param caller
 * @param selectProperty
 */
@SuppressWarnings("serial")
public NewGroupSelectPanel(final String id, final IModel<GroupDO> model, final String label, final ISelectCallerPage caller,
    final String selectProperty)
{
  super(id, model, caller, selectProperty);
  groupTextField = new PFAutoCompleteTextField<GroupDO>("groupField", getModel()) {
    @Override
    protected List<GroupDO> getChoices(final String input)
    {
      final BaseSearchFilter filter = new BaseSearchFilter();
      filter.setSearchFields("id", "name");
      filter.setSearchString(input);
      final List<GroupDO> list = groupDao.getList(filter);
      return list;
    }

    @Override
    protected List<String> getRecentUserInputs()
    {
      return getRecentCustomers().getRecents();
    }

    @Override
    protected String formatLabel(final GroupDO group)
    {
      if (group == null) {
        return "";
      }
      return group.getName();
    }

    @Override
    protected String formatValue(final GroupDO group)
    {
      if (group == null) {
        return "";
      }
      return group.getName();
    }

    @Override
    protected void convertInput()
    {
      final GroupDO group = getConverter(getType()).convertToObject(getInput(), getLocale());
      setConvertedInput(group);
      if (group != null && (currentGoup == null || group.getId() != currentGoup.getId())) {
        getRecentCustomers().append(group.getName());
      }
      currentGoup = group;
    }

    /**
     * @see org.apache.wicket.Component#getConverter(java.lang.Class)
     */

    @SuppressWarnings({ "unchecked", "rawtypes"})
    @Override
    public <C> IConverter<C>  getConverter(final Class<C> type)
    {
      return new IConverter() {
        @Override
        public Object convertToObject(final String value, final Locale locale)
        {
          if (StringUtils.isEmpty(value) == true) {
            getModel().setObject(null);
            return null;
          }
          // ### FORMAT ###
          final GroupDO group = groupDao.getByName(value);
          if (group == null) {
            error(getString("panel.error.groupNotFound"));
          }
          getModel().setObject(group);
          return group;
        }

        @Override
        public String convertToString(final Object value, final Locale locale)
        {
          if (value == null) {
            return "";
          }
          final GroupDO group = (GroupDO) value;
          return formatLabel(group);
        }

      };
    }
  };
  currentGoup = getModelObject();
  groupTextField.enableTooltips().withLabelValue(true).withMatchContains(true).withMinChars(2).withAutoSubmit(false); //.withWidth(400);
}
 
Example #28
Source Project: projectforge-webapp   Author: micromata   File: I18nEnumAutoCompleteTextField.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  return new I18nEnumConverter(this, supportedValues);
}
 
Example #29
Source Project: projectforge-webapp   Author: micromata   File: TimeZoneField.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * @see org.apache.wicket.Component#getConverter(java.lang.Class)
 */
@Override
public <C> IConverter<C> getConverter(final Class<C> type)
{
  return converter;
}
 
Example #30
Source Project: projectforge-webapp   Author: micromata   File: AjaxMaxLengthEditableLabel.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * Setting a converter is more convenient instead of overriding method getConverter(Class).
 * @param converter
 * @return This for chaining.
 */
public <C> AjaxMaxLengthEditableLabel setConverter(final IConverter<C> converter)
{
  this.converter = converter;
  return this;
}