Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Component


   * The parent tree item is actually the grandparent if any.
   *
   * @since 3.0.0
   */
  public Treeitem getParentItem() {
    final Component p = getParent();
    final Component gp = p != null ? p.getParent(): null;
    return gp instanceof Treeitem ? (Treeitem)gp: null;
  }
View Full Code Here


    if (parent != null && !(parent instanceof Treechildren))
      throw new UiException("Wrong parent: "+parent);
    super.beforeParentChanged(parent);
  }
  public void setParent(Component parent) {
    final Component oldp = getParent();
    if (oldp == parent)
      return; //nothing changed

    final Tree oldtree = oldp != null ? getTree(): null;
    super.setParent(parent);
View Full Code Here

  /** Converts an AU request to a render event.
   * @since 5.0.0
   */
  public static final PagingEvent getPagingEvent(AuRequest request) {
    final Component comp = request.getComponent();
    final Map data = request.getData();
    int pgi = AuRequests.getInt(data, "", 0);
    final Pageable pageable = (Pageable)comp;
    if (pgi < 0) pgi = 0;
    else {
View Full Code Here

        if (max < 0) min = 0;
        else min = max - cnt + 1;
      if (min > oldsz) min = oldsz;

      RowRenderer renderer = null;
      final Component next =
        min < oldsz ? (Component)rows.getChildren().get(min): null;
      while (--cnt >= 0) {
        if (renderer == null)
          renderer = (RowRenderer) getRealRenderer();
        rows.insertBefore((Row)newUnloadedItem(renderer, min++), next);
      }
      break;

    case ListDataEvent.INTERVAL_REMOVED:
      cnt = oldsz - newsz;
      if (cnt <= 0) {
        syncModel(-1, -1); //out of sync, force sync
        return;
        //throw new UiException("Removal causes a larger list?");
      }
      if (min >= 0) max = min + cnt - 1;
      else if (max < 0) max = cnt - 1; //0 ~ cnt - 1     
      if (max > oldsz - 1) max = oldsz - 1;

      //detach from end (due to groopfoot issue)
      Component comp = (Component)rows.getChildren().get(max);
      while (--cnt >= 0) {
        Component p = comp.getPreviousSibling();
        comp.detach();
        comp = p;
      }
      break;
View Full Code Here

      groupfoot.applyProperties();
    }
    return groupfoot;
  }
  private Component newUnloadedCell(RowRenderer renderer, Row row) {
    Component cell = null;
    if (renderer instanceof RowRendererExt)
      cell = ((RowRendererExt)renderer).newCell(row);

    if (cell == null) {
      cell = newRenderLabel(null);
      cell.applyProperties();
    }
    cell.setParent(row);
    return cell;
  }
View Full Code Here

    final boolean inPaging = inPagingMold();

    int newcnt = newsz - oldsz;
    int atg = pgi != null ? _grid.getActivePage(): 0;
    RowRenderer renderer = null;
    Component next = null;   
    if (oldsz > 0) {
      if (min < 0) min = 0;
      else if (min > oldsz - 1) min = oldsz - 1;
      if (max < 0) max = oldsz - 1;
      else if (max > oldsz - 1) max = oldsz - 1;
      if (min > max) {
        int t = min; min = max; max = t;
      }

      int cnt = max - min + 1; //# of affected
      if (model instanceof GroupsListModel) {
      //detach all from end to front since groupfoot
      //must be detached before group
        newcnt += cnt; //add affected later
        if (newcnt > INVALIDATE_THRESHOLD && !inPaging)
          _grid.invalidate(); //performance is better

        Component comp = (Component)rows.getChildren().get(max);
        next = comp.getNextSibling();
        while (--cnt >= 0) {
          Component p = comp.getPreviousSibling();
          comp.detach();
          comp = p;
        }
      } else { //ListModel
        int addcnt = 0;
        Component row = (Component)rows.getChildren().get(min);
        while (--cnt >= 0) {
          next = row.getNextSibling();

          if (cnt < -newcnt) { //if shrink, -newcnt > 0
            row.detach(); //remove extra
          } else if (((LoadStatus)((AbstractComponent)row).getExtraCtrl()).isLoaded()) {
            if (renderer == null)
              renderer = (RowRenderer)getRealRenderer();
            row.detach(); //always detach
            rows.insertBefore((Row) newUnloadedItem(renderer, min), next);
            ++addcnt;
          }
          ++min;
          row = next;
View Full Code Here

        if (max < 0) min = 0;
        else min = max - cnt + 1;
      if (min > oldsz) min = oldsz;

      ListitemRenderer renderer = null;
      final Component next =
        min < oldsz ? _listbox.getItemAtIndex(min): null;
      while (--cnt >= 0) {
        if (renderer == null)
          renderer = (ListitemRenderer) getRealRenderer();
        _listbox.insertBefore(newUnloadedItem(renderer, min++), next);
      }
      break;

    case ListDataEvent.INTERVAL_REMOVED:
      cnt = oldsz - newsz;
      if (cnt <= 0)
        throw new UiException("Removal causes a larger list?");
      if (min >= 0) max = min + cnt - 1;
      else if (max < 0) max = cnt - 1; //0 ~ cnt - 1     
      if (max > oldsz - 1) max = oldsz - 1;

      //detach from end (due to groopfoot issue)
      Component comp = _listbox.getItemAtIndex(max);
      while (--cnt >= 0) {
        Component p = comp.getPreviousSibling();
        comp.detach();
        comp = p;
      }
      break;
View Full Code Here

    final boolean inPaging = inPagingMold();

    int newcnt = newsz - oldsz;
    int atg = _pgi != null ? _listbox.getActivePage(): 0;
    ListitemRenderer renderer = null;
    Component next = null;   
    if (oldsz > 0) {
      if (min < 0) min = 0;
      else if (min > oldsz - 1) min = oldsz - 1;
      if (max < 0) max = oldsz - 1;
      else if (max > oldsz - 1) max = oldsz - 1;
      if (min > max) {
        int t = min; min = max; max = t;
      }

      int cnt = max - min + 1; //# of affected
      if (_model instanceof GroupsListModel) {
      //detach all from end to front since groupfoot
      //must be detached before group
        newcnt += cnt; //add affected later
        if (newcnt > INVALIDATE_THRESHOLD && !inPaging)
          _listbox.invalidate(); //performance is better

        Component comp = _listbox.getItemAtIndex(max);
        next = comp.getNextSibling();
        while (--cnt >= 0) {
          Component p = comp.getPreviousSibling();
          comp.detach();
          comp = p;
        }
      } else { //ListModel
        int addcnt = 0;
        Component item = _listbox.getItemAtIndex(min);
        while (--cnt >= 0) {
          next = item.getNextSibling();

          if (cnt < -newcnt) { //if shrink, -newcnt > 0
            item.detach(); //remove extra
          } else if (((Listitem)item).isLoaded()) {
            if (renderer == null)
              renderer = (ListitemRenderer) getRealRenderer();
            item.detach(); //always detach
            _listbox.insertBefore(newUnloadedItem(renderer, min), next);
            ++addcnt;
          }
          ++min;
          item = next;//B2100338.,next item could be Paging, don't use Listitem directly
View Full Code Here

    int pgsz = limit;
    int ofs = offset;
   
    if (_listbox.getItemCount() > 0) {
      Component item = (Component) _listbox.getItems().get(0);
      while(item != null) {
        if (pgsz == 0) break;
        if (item.isVisible() && item instanceof Listitem) {
          if (--ofs < 0) {
            --pgsz;
            avail.add(item);
          }
        }
        if (item instanceof Listgroup) {
          final Listgroup g = (Listgroup) item;
          if (!g.isOpen()) {
            for (int j = 0, len = g.getItemCount(); j < len; j++)
              item = (Listitem) item.getNextSibling();
          }
        }
        if (item != null)
          item = item.getNextSibling();
      }
    }
    return avail;
  }
View Full Code Here

    if (_instantMode &&_afterComposed)
      return; //instant mode (done by redrawChildren())

    final UiEngine ueng =
      ((WebAppCtrl)getDesktop().getWebApp()).getUiEngine();
    Component old = ueng.setOwner(this);
    try {
      if (_progressStatus == 1) {
        _progressStatus = 2;
      } else if (_src != null && _src.length() > 0) {
        final StringWriter sw = new StringWriter();
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Component

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.