Exemple #1
0
 /**
  * Tests whether all keys of {@link Label}s are known to {@link LabelsManager}.
  *
  * @param keys list of keys to be tested
  * @return whether all keys are known to {@link LabelsManager}
  */
 protected boolean hasAllLabels(Iterable<Key> keys) {
   boolean hasAll = true;
   for (Key key : keys) {
     if (Managers.LABELS_MANAGER.getLabelByKey(key) == null) {
       hasAll = false;
     }
   }
   return hasAll;
 }
Exemple #2
0
  /**
   * Sets new value of row if the {@link UserItem} is already shown.
   *
   * @param value new value to show
   */
  public void setValue(final UserItem value) {
    if (!hasAllLabels(value.getLabels())) {
      Managers.LABELS_MANAGER.refresh(
          new AsyncCallback<Void>() {
            public void onSuccess(Void result) {
              doSetValue(value);
            }

            public void onFailure(Throwable caught) {}
          });
    } else {
      doSetValue(value);
    }
  }
Exemple #3
0
  /** Makes all pending {@link UserItem}s below the last one show. */
  public void showTail() {
    Set<Key> labels = new HashSet<Key>();
    for (UserItem ui : tail) {
      labels.addAll(ui.getLabels());
    }
    if (!hasAllLabels(labels)) {
      Managers.LABELS_MANAGER.refresh(
          new AsyncCallback<Void>() {
            public void onSuccess(Void result) {
              addTail();
            }

            public void onFailure(Throwable caught) {}
          });
    } else {
      addTail();
    }
  }