コード例 #1
0
  @SuppressWarnings("unchecked")
  public String getStringValue(M model, String property) {
    if (propertyProviders != null && propertyProviders.containsKey(property)) {
      return propertyProviders.get(property).getStringValue(model, property);
    }

    if (classProviders != null && model.get(property) != null) {
      Class<?> clz = model.<Object>get(property).getClass();
      if (classProviders.containsKey(clz)) {
        return classProviders.get(clz).getStringValue(model, property);
      }
    }
    ModelStringProvider<M> temp =
        stringProvider != null ? stringProvider : (ModelStringProvider) defaultProvider;
    return temp.getStringValue(model, property);
  }
コード例 #2
0
 @Override
 public Optional<M> fill(DataHolder dataHolder, M manipulator, MergeFunction overlap) {
   if (!supports(dataHolder)) {
     return Optional.empty();
   } else {
     final M merged =
         checkNotNull(overlap).merge(manipulator.copy(), from(dataHolder).orElse(null));
     return Optional.of(manipulator.set(this.key, merged.get(this.key).get()));
   }
 }
コード例 #3
0
  /**
   * Returns <code>true</code> if search string is found in any of the properties collection passed
   * in the constructor.<br>
   * Before the search is performed, all characters are cleaned (no 'exotic' characters) and
   * upper-cased. (non-Javadoc)
   *
   * @see com.extjs.gxt.ui.client.widget.StoreFilterField
   *     #doSelect(com.extjs.gxt.ui.client.store.Store, com.extjs.gxt.ui.client.data.ModelData,
   *     com.extjs.gxt.ui.client.data.ModelData, java.lang.String, java.lang.String)
   */
  @Override
  protected boolean doSelect(Store<M> store, M parent, M record, String property, String filter) {

    String upperFilter = Util.cleanString(filter.toUpperCase());

    boolean found = false;
    Iterator<String> it = properties.iterator();
    while (!found && it.hasNext()) {
      String p = it.next(); // current property
      Object v = record.get(p); // current property value
      found = v != null && Util.cleanString(v.toString().toUpperCase()).contains(upperFilter);
    }

    return found;
  }