org.zkoss.zul.Listbox.getItems()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.zkoss.zul.Listbox.getItems()方法的一些代码示例,展示了Listbox.getItems()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Listbox.getItems()方法的具体详情如下:
包路径:org.zkoss.zul.Listbox
类名称:Listbox
方法名:getItems

Listbox.getItems介绍

[英]Returns a live list of all Listitem. By live we mean you can add or remove them directly with the List interface. In other words, you could add or remove an item by manipulating the returned list directly.
[中]返回所有Listitem的实时列表。通过live,您可以直接使用列表界面添加或删除它们。换句话说,您可以通过直接操作返回的列表来添加或删除项目。

代码示例

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting

/**
 * Returns a list of listbox items.
 *
 * @param selectedOnly If true, only selected items are returned.
 * @return List of list items.
 */
protected List<Listitem> getItems(boolean selectedOnly) {
  return selectedOnly ? ListUtil.getSelectedItems(listBox) : listBox.getItems();
}

代码示例来源:origin: org.zkoss.zk/zkplus

public List getItems(Component comp) {
  if (comp instanceof Listbox) {
    final Listbox listbox = (Listbox) comp;
    return listbox.getItems();
  } else {
    throw new UiException("Unsupported type for ListitemCollectionItem: " + comp);
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting

/**
 * Re-renders a model object.
 * 
 * @param object Model object
 */
protected void rerender(M object) {
  int index = ListUtil.findListboxData(listBox, object);
  
  if (index >= 0) {
    rerender(listBox.getItems().get(index));
  }
}

代码示例来源:origin: org.zkoss.zk/zul

/** Sorts the items. If with group, each group is sorted independently.
 */
@SuppressWarnings("unchecked")
private static void sort0(Listbox box, Comparator cmpr) {
  if (box.hasGroup())
    for (Listgroup g : box.getGroups()) {
      int index = g.getIndex() + 1;
      Components.sort(box.getItems(), index, index + g.getItemCount(), cmpr);
    }
  else
    Components.sort(box.getItems(), cmpr);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.problem

private void restoreGridState() {
  lbProblems.clearSelection();
  
  for (Object object : lbProblems.getItems()) {
    Listitem item = (Listitem) object;
    lbProblems.renderItem(item);
    
    if (selectedProblems.contains(item.getValue())) {
      item.setSelected(true);
    }
  }
  
  selectedProblems.clear();
  updateControls();
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1

/**
 * Adds drag/drop support to the items belonging to the specified list box.
 * 
 * @param lb The list box.
 * @param dropId The drop id to be used.
 * @param eventListener The event listener to handle the drag/drop operations.
 */
private void addDragDropSupport(Listbox lb, String dropId, EventListener<?> eventListener) {
  for (Object object : lb.getItems()) {
    Listitem item = (Listitem) object;
    item.setDraggable(dropId);
    item.setDroppable(dropId);
    item.addEventListener(Events.ON_DROP, eventListener);
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1

private void displaySearchMessage(String message) {
  lstSearch.clearSelection();
  lstSearch.setModel((ListModelList<?>) null);
  lstSearch.getItems().clear();
  
  if (message != null) {
    lstSearch.appendItem(message, null).setTooltiptext(message);
  }
  
  Clients.scrollIntoView(lstSearch.getFirstChild());
}

代码示例来源:origin: org.zkoss.zk/zul

/**
 * Renders all {@link Listitem} if not loaded yet, with
 * {@link #getItemRenderer}.
 *
 * @see #renderItem
 * @see #renderItems
 */
public void renderAll() {
  if (_model == null)
    return;
  _renderAll = true;
  getDataLoader().setLoadAll(_renderAll);
  final Renderer renderer = new Renderer();
  if (!getItems().isEmpty())
    try {
      Listitem item = getItems().get(0);
      int index = item.getIndex();
      for (Listitem nxt; item != null; item = nxt) {
        nxt = nextListitem(item); //retrieve first since it might be changed
        renderer.render(item, index++);
      }
    } catch (Throwable ex) {
      renderer.doCatch(ex);
    } finally {
      renderer.doFinally();
    }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1

private void refreshFilterList() {
  boolean hasFilter = activeList != null && activeList.isFiltered();
  lstFilter.setVisible(hasFilter);
  
  if (hasFilter) {
    activeFilter = activeList.getActiveFilter();
    Collection<AbstractPatientListFilter> filters = activeList.getFilters();
    
    if (filters == null || filters.isEmpty()) {
      lstFilter.setModel((ListModelList<?>) null);
      lstFilter.getItems().clear();
      lstFilter.appendItem(txtNoFilters, null);
    } else {
      lstFilter.setModel(new ListModelList<AbstractPatientListFilter>(filters));
      
      if (activeFilter == null) {
        activeFilter = filters.iterator().next();
        activeList.setActiveFilter(activeFilter);
      }
    }
    
    selectFilter(lstFilter, activeFilter);
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.core

private void loadResults(List<String> v) {
  lbResults.getItems().clear();

代码示例来源:origin: org.zkoss.zk/zul

/**
 * Checks whether to invalidate, when a child has been added or or will be
 * removed.
 *
 * @param bRemove
 *            if child will be removed
 */
private void checkInvalidateForMoved(Listitem child, boolean bRemove) {
  // No need to invalidate if
  // 1) act == last and child in act
  // 2) act != last and child after act
  // Except removing last elem which in act and act has only one elem
  if (inPagingMold() && !isInvalidated()) {
    final int j = child.getIndex(), pgsz = getPageSize(), n = (getActivePage() + 1) * pgsz;
    if (j >= n)
      return; // case 2
    final int cnt = getItems().size(), n2 = n - pgsz;
    if (j >= n2 && cnt <= n && (!bRemove || cnt > n2 + 1))
      return; // case 1
    invalidate();
  }
}

代码示例来源:origin: org.zkoss.zk/zul

/**
 * updates the status of the changed group.
 * @param event
 * @since 8.0.4
 */
public void doGroupsDataChange(GroupsDataEvent event) {
  if (event.getType() == GroupsDataEvent.GROUPS_OPENED) {
    Listbox listbox = (Listbox) getOwner();
    GroupsListModel groupsListModel = ((GroupsListModel) listbox.getModel());
    int offset = groupsListModel.getGroupOffset(event.getGroupIndex());
    ((Listgroup) listbox.getItems().get(offset)).setOpen(groupsListModel.getDataInfo(offset).isOpen());
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1

/**
 * Selects the list box item corresponding to the specified filter.
 * 
 * @param lb List box to search.
 * @param filter The filter whose associated list item is to be selected.
 * @return True if the item was successfully selected.
 */
private boolean selectFilter(Listbox lb, AbstractPatientListFilter filter) {
  if (filter != null) {
    for (Object object : lb.getItems()) {
      Listitem item = (Listitem) object;
      lb.renderItem(item);
      AbstractPatientListFilter flt = (AbstractPatientListFilter) item.getValue();
      
      if (flt != null && filter.equals(flt)) {
        lb.setSelectedItem(item);
        Clients.scrollIntoView(item);
        return true;
      }
    }
  }
  
  return false;
}

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.documents

/**
 * Scroll to document with same header.
 */
public void onSelect$cboHeader() {
  Document doc = cboHeader.getSelectedItem().getValue();
  
  for (Listitem item : listBox.getItems()) {
    Document doc2 = (Document) item.getValue();
    
    if (doc2 == null) {
      listBox.renderItem(item);
      doc2 = (Document) item.getValue();
    }
    
    if (doc == doc2) {
      Clients.scrollIntoView(item);
      break;
    }
  }
}

代码示例来源:origin: stackoverflow.com

for (Listitem item : lbox.getItems()) {
  item.insertBefore(item.getChildren().get(from), item.getChildren().get(to));

代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.problem

private void loadNotes() {
  if (VistAUtil.parseIEN(problem) == 0) {
    lstNotes.setVisible(false);
    txtNotes.setVisible(true);
    capNotes.setLabel("Note (3-60 characters)");
    return;
  }
  
  lstNotes.getItems().clear();
  List<String> notes = getBroker().callRPCList("BGOPRBN GET", null, problem.getId().getIdPart());
  
  if (PCC.errorCheck(notes)) {
    return;
  }
  
  /*
   * Location IEN [1] ^ Note IEN [2] ^ Note # [3] ^ Narrative [4] ^
   * Status [5] ^ Date Added [6] ^ Author Name [7]
   * e.g.,
   * 3987^1^1^STECWFD DEPENDENCY (LOW DOSE)^A^2960901^
   */
  for (String note : notes) {
    renderNote(new ProblemNote(note));
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.skintest

private void loadSkinTests(boolean noAsync) {
  lbTests.getItems().clear();
  getAsyncDispatcher().abort();
  Patient patient = PatientContext.getActivePatient();
  
  if (patient == null) {
    return;
  }
  
  EventUtil.status("Loading Skin Test Data");
  
  if (allowAsync && !noAsync) {
    getAsyncDispatcher().callRPCAsync("BGOVSK GET", patient.getId().getIdPart());
  } else {
    loadSkinTests(getBroker().callRPCList("BGOVSK GET", null, patient.getId().getIdPart()));
  }
  
  EventUtil.status();
}

代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.problem

private void loadProblems(boolean noAsync) {
  lbProblems.getItems().clear();
  getAsyncDispatcher().abort();
  Patient patient = PatientContext.getActivePatient();
  
  if (patient == null) {
    return;
  }
  
  EventUtil.status("Loading Problem List Data");
  
  if (allowAsync && !noAsync) {
    getAsyncDispatcher().callRPCAsync("BGOPROB GET", patient.getId().getIdPart());
  } else {
    loadProblems(getBroker().callRPCList("BGOPROB GET", null, patient.getId().getIdPart()));
  }
  
  EventUtil.status();
}

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.vitals

private void initGrid(int colcount, int rowcount) {
  lstVitals.getItems().clear();
  hdrVitals.getChildren().clear();
  
  if (colcount > 2 && rowcount > 0) {
    tbarPaging.setVisible(true);
    sldVitals.setMaxpos(colcount - 2);
    sldVitals.setCurpos(maxCols);
    pgVitals.setActivePage(0);
    pgVitals.setTotalSize(colcount - 2);
    pgVitals.setPageSize(maxCols + 1);
    getCell(colcount - 1, rowcount - 1);
    
    for (int i = 1; i <= colcount; i++) {
      Listheader lh = new Listheader();
      lh.setVisible(i <= maxCols || i == colcount);
      lh.setAlign(i == 1 ? "right" : i == colcount ? "left" : "center");
      lh.setHflex("1");
      hdrVitals.appendChild(lh);
    }
  } else {
    hdrVitals.appendChild(new Listheader());
    tbarPaging.setVisible(false);
  }
}

代码示例来源:origin: org.zkoss.zk/zkmax

public void render(Component comp, Writer out) throws IOException {
  final SmartWriter wh = new SmartWriter(out);
  final Listbox self = (Listbox)comp;
  final String uuid = self.getUuid();
  wh.write("<select id=\"").write(uuid).write("\" z.type=\"zul.sel.Lisel\"")
    .write(self.getOuterAttrs()).write(self.getInnerAttrs()).writeln(">");
  for (Iterator it = self.getItems().iterator(); it.hasNext();) {
    final Listitem item = (Listitem)it.next();
    if (item.isVisible()) {
      wh.write("<option id=\"").write(item.getUuid()).write("\"")
          .write(item.getOuterAttrs())
          .write(item.getInnerAttrs()).write(">");
      new Out(item.getLabel()).setMaxlength(self.getMaxlength())
          .render(out);
      wh.writeln("</option>");
    }
  }
  wh.write("</select>");
}

相关文章