Exemplo n.º 1
0
  /**
   * Registers item within the group.
   *
   * @param item item.
   * @return index within the group.
   */
  public int register(ResultItemPanel item) {
    int visibleItemsCount = getVisibleItemsCount();

    boolean priority = item.getItem().isPriority();
    int index = priority ? 0 : items.size();
    items.add(index, item);

    boolean filtered = isFiltered(item);
    item.setFiltered(filtered);

    if (!filtered) recalcView();
    if (visibleItemsCount == 0) setVisible(true);

    return index;
  }
Exemplo n.º 2
0
  /**
   * Sets filtering time. If the time is set to <code>-1</code> then filtering is off. Otherwise it
   * shows the time after which all items are allowed.
   *
   * @param aLimitTime the time used for limiting.
   */
  public void setLimitTime(long aLimitTime) {
    limitTime = aLimitTime;

    int shown = 0;
    int hidden = 0;
    for (ResultItemPanel item : items) {
      item.setFiltered(isFiltered(item));
      item.setVisibility(!item.isFiltered() && shown < itemLimit);

      if (item.isVisible()) shown++;
      else if (!item.isFiltered()) hidden++;
    }

    setVisible(shown > 0);
    moreItem.setCount(hidden);
  }