Package org.zkoss.zul

Examples of org.zkoss.zul.ListModel


  private static final long serialVersionUID = 200808191439L;
 
  public Object coerceToUi(Object val, Component comp) { //load
    Listbox lbx = (Listbox) comp;
      if (val != null) {
        final ListModel xmodel = lbx.getModel();
        if (xmodel instanceof BindingListModel) {
          final BindingListModel model = (BindingListModel) xmodel;
          int index = model.indexOf(val);
          if (index >= 0) {
            final Listitem item = (Listitem) lbx.getItemAtIndex(index);
View Full Code Here


      //triggered by coerceToUi(), ignore this
      Executions.getCurrent().removeAttribute("zkoss.zkplus.databind.ON_SELECT"+lbx.getUuid());
      return TypeConverter.IGNORE;
    }
      if (val != null) {
        final ListModel model = lbx.getModel();
        //no model case, assume Listitem.value to be used with selectedItem
         return model != null ? model.getElementAt(((Listitem) val).getIndex()) : ((Listitem) val).getValue();
      }
     return null;
  }
View Full Code Here

    //For backward compatible, if by owner failed, try again with by item
    CollectionItem decor = myGetCollectionItemByOwner(owner);
    if (decor == null) {
      decor = getBindingCollectionItem(item);
    }
    final ListModel xmodel = decor.getModelByOwner(owner);
    if (isCollectionItem && comp == item) {
        if (xmodel instanceof BindingListModelExt && !((BindingListModelExt)xmodel).isDistinct()) {
          final BindingListModelExt model = (BindingListModelExt) xmodel;
          final int[] indexes = model.indexesOf(bean);
          final int sz = indexes.length;
          final List comps = new ArrayList(sz);
          for (int j = 0; j < sz; ++j) {
            final Component xcomp = lookupClone(decor.getComponentAtIndexByOwner(owner, indexes[j]), comp);
            if (xcomp != null)
              comps.add(xcomp);
          }
          return (Component[]) comps.toArray(new Component[comps.size()]);
        } else   if (xmodel instanceof BindingListModel) {
          final BindingListModel model = (BindingListModel) xmodel;
          int index = model.indexOf(bean);
          if (index >= 0) {
            final Component xcomp = lookupClone(decor.getComponentAtIndexByOwner(owner, index), comp);
            return xcomp != null ? new Component[] {xcomp} : new Component[0];
          }
        }
    } else {
      //though the comp is in collection but the binding does not relate to _var,
      //have to scan through the whole cloned children items  
      final int sz = xmodel.getSize();
        final List comps = new ArrayList(sz);
      if (decor instanceof CollectionItemExt) {
        final List items = ((CollectionItemExt)decor).getItems(owner);
        for (final Iterator it = items.iterator(); it.hasNext(); ) {
          final Component cloneitem = (Component) it.next();
View Full Code Here

    return 20;
  }

  public int getTotalSize() {
    final Rows rows = _grid.getRows();
    final ListModel model = _grid.getModel();
    return model != null ? model.getSize() : rows != null ? rows.getVisibleItemCount() : 0;
  }
View Full Code Here

  }
 
  /** Creates a new and unloaded row. */
  protected Component newUnloadedItem(Object renderer, int index) {
    final RowRenderer renderer0 = (RowRenderer) renderer;
    final ListModel model = ((Grid)getOwner()).getModel();
    Row row = null;
    if (model instanceof GroupsListModel) {
      final GroupsListModel gmodel = (GroupsListModel) model;
      final GroupDataInfo info = gmodel.getDataInfo(index);
      switch(info.type){
View Full Code Here

 
  public void syncModel(int offset, int limit) {
    int min = offset;
    int max = offset + limit - 1;
   
    final ListModel model = _grid.getModel();
    Rows rows = _grid.getRows();
    final int newsz = model.getSize();
    final int oldsz = rows != null ? rows.getChildren().size(): 0;
    final Paginal pgi = _grid.getPaginal();
    final boolean inPaging = inPagingMold();

    int newcnt = newsz - oldsz;
View Full Code Here

  public int getLimit() {
    return _listbox.getRows() > 0 ? _listbox.getRows() + 5 : 20;
  }

  public int getTotalSize() {
    final ListModel model = _listbox.getModel();
    return model != null ? model.getSize() : _listbox.getVisibleItemCount();
  }
View Full Code Here

  }

  private static int INVALIDATE_THRESHOLD = 10;
  public void doListDataChange(ListDataEvent event) {
    //when this is called _model is never null
    final ListModel _model = _listbox.getModel();
    final int newsz = _model.getSize(), oldsz = _listbox.getItemCount();
    int min = event.getIndex0(), max = event.getIndex1(), cnt;

    switch (event.getType()) {
    case ListDataEvent.INTERVAL_ADDED:
      cnt = newsz - oldsz;
View Full Code Here

    }
  }
 
  /** Creates an new and unloaded listitem. */
  protected final Listitem newUnloadedItem(ListitemRenderer renderer, int index) {
    final ListModel model = _listbox.getModel();
    Listitem item = null;
    if (model instanceof GroupsListModel) {
      final GroupsListModel gmodel = (GroupsListModel) model;
      final GroupDataInfo info = gmodel.getDataInfo(index);
      switch(info.type){
View Full Code Here

  }
  private void syncModel0(int offset, int limit) {
    int min = offset;
    int max = offset + limit - 1;
   
    final ListModel _model = _listbox.getModel();
    final int newsz = _model.getSize();
    final int oldsz = _listbox.getItemCount();
    final Paginal _pgi = _listbox.getPaginal();
    final boolean inPaging = inPagingMold();

    int newcnt = newsz - oldsz;
View Full Code Here

TOP

Related Classes of org.zkoss.zul.ListModel

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.