@Override
  public void query(
      final String term,
      final int page,
      final com.vaynberg.wicket.select2.Response<ObjectAdapterMemento> response) {

    final List<ObjectAdapterMemento> mementos = Lists.newArrayList(obtainMementos(term));
    // if not mandatory, and the list doesn't contain null already, then add it in.
    if (!scalarModel.isRequired() && !mementos.contains(null)) {
      mementos.add(0, null);
    }
    response.addAll(mementos);
  }
Ejemplo n.º 2
0
 private void setRequiredIfSpecified() {
   final ScalarModel scalarModel = getModel();
   final boolean required = scalarModel.isRequired();
   entityLink.setRequired(required);
 }