public Component getComponentCollectionOwner(Component comp) { if (comp instanceof Listitem) { final Listitem item = (Listitem) comp; return item.getListbox(); } else { throw new UiException("Unsupported type for ListitemCollectionItem: " + comp); } }
/** Returns the maximal length of each item's label. * It is a shortcut of getParent().getMaxlength(); * Thus, it works only if the listbox's mold is "select". */ public int getMaxlength() { final Listbox listbox = getListbox(); return listbox != null ? listbox.getMaxlength() : 0; }
@Override protected Listbox getEventTarget() { return target.as(Listitem.class).getListbox(); }
@Override protected Component getEventTarget() { return target.as(Listitem.class).getListbox(); }
@Override protected void contributeExtraInfo(Map<String, Object> data) { data.put("clearFirst", target.as(Listitem.class).getListbox().isMultiple()); } };
/** * Returns the listgroup that this item belongs to, or null. * @since 3.5.0 */ public Listgroup getListgroup() { final Listbox lb = getListbox(); if (lb != null) return lb.getListgroupAt(getIndex()); return null; }
/** Sets whether the content of this item is loaded; used if * the listbox owning this item is using a list model. */ /*package*/ void setLoaded(boolean loaded) { if (loaded != _loaded) { _loaded = loaded; final Listbox listbox = getListbox(); if (listbox != null && listbox.getModel() != null) smartUpdate("_loaded", _loaded); } }
public void setupBindingRenderer(Component comp, DataBinder binder) { if (comp instanceof Listitem) { final Listitem li = (Listitem) comp; final Listbox lbx = li.getListbox(); if (lbx.getItemRenderer() == null) { lbx.setItemRenderer(new BindingListitemRenderer(li, binder)); } } }
protected void smartUpdate(String name, Object value) { //make it accessible in this package Listbox box = getListbox(); if (isVisible() || box == null || !box.inSelectMold()) super.smartUpdate(name, value); }
protected void smartUpdate(String name, boolean value) { //make it accessible in this package Listbox box = getListbox(); if (isVisible() || box == null || !box.inSelectMold()) super.smartUpdate(name, value); }
protected void smartUpdate(String name, int value) { Listbox box = getListbox(); if (isVisible() || box == null || !box.inSelectMold()) super.smartUpdate(name, value); }
@Override public void renderItem(Listitem item, Object data) { Practitioner provider = data instanceof Practitioner ? (Practitioner) data : ProviderUtil.fetchProvider(StrUtil .piece((String) data, StrUtil.U)); item.setValue(provider); createCell(item, provider.getName()); Practitioner primaryProvider = encounterProvider.getPrimaryProvider(); item.setSclass(primaryProvider == null || !provider.equals(primaryProvider) ? null : Constants.SCLASS_PRIMARY); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), null); }
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); render(renderer, "selected", isSelected()); render(renderer, "disabled", isDisabled()); render(renderer, "_loaded", _loaded ? _loaded : getListbox().getModel() == null); renderer.render("_index", _index); if (_value instanceof String && getListbox().getName() != null) render(renderer, "value", _value); if (!isCheckable()) renderer.render("checkable", false); }
/** Sets the value. * @param value the value. * <p>Note: the value is application dependent, you can place * whatever value you want. * <p>If you are using listitem with HTML Form (and with * the name attribute), it is better to specify a String-typed * value. */ public <T> void setValue(T value) { if (!Objects.equals(_value, value)) { _value = value; final Listbox listbox = getListbox(); if (listbox != null) if (listbox.inSelectMold()) smartUpdate("value", _value); else if (listbox.getName() != null) smartUpdate("value", _value); } }
@Override public void onEvent(Event event) throws Exception { DropEvent dropEvent = (DropEvent) ZKUtil.getEventOrigin(event); Listitem dragged = (Listitem) dropEvent.getDragged(); Listitem target = (Listitem) dropEvent.getTarget(); filterManager.moveFilter((AbstractPatientListFilter) dragged.getValue(), target.getIndex()); dragged.getListbox().insertBefore(dragged, target); } };
/** * Render the list item for the specified document. * * @param item List item to render. * @param doc The document associated with the list item. */ @Override public void renderItem(Listitem item, Document doc) { log.trace("item render"); item.setCheckable(true); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK); addCell(item, ""); addCell(item, doc.getDateTime()); addCell(item, doc.getTitle()); addCell(item, doc.getLocationName()); addCell(item, doc.getAuthorName()); }
@Override public void renderItem(Listitem item, Object data) { Encounter encounter = data instanceof Encounter ? (Encounter) data : parse((String) data); item.setValue(encounter); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), null); item.setImage(EncounterUtil.isLocked(encounter) ? Constants.ICON_LOCKED : null); createCell(item, encounter.getLocation()); createCell(item, encounter.getPeriod()); createCell(item, encounter.getType()); }
@Override public void renderItem(Listitem item, Object data) { Participant participant; if (data instanceof Participant) { participant = (Participant) data; } else if (data instanceof IResource) { participant = new Participant(); participant.setIndividual(new ResourceReferenceDt((IResource) data)); } else { return; } item.setValue(participant); createCell(item, FhirUtil.formatName(EncounterUtil.getName(participant))); item.setSclass(isPrimary(participant) ? Constants.SCLASS_PRIMARY : null); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), null); }
@Override public void renderItem(Listitem item, Object data) { Encounter encounter = data instanceof Encounter ? (Encounter) data : parse((String) data); item.setValue(encounter); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), null); Span span = new Span(); span.setSclass(EncounterUtil.isLocked(encounter) ? Constants.SCLASS_LOCKED : null); createCell(item, span); Location location = ClientUtil.getResource(encounter.getLocationFirstRep().getLocation(), Location.class); createCell(item, location == null ? null : location.getName()); createCell(item, encounter.getPeriod().getStart()); createCell(item, encounter.getTypeFirstRep().getCodingFirstRep().getDisplay()); }
@Override protected void renderItem(Listitem item, Notification notification) { createCell(item, null); createCell(item, null).setImage(PriorityRenderer.getImage(notification.getPriority())); createCell(item, null).setImage(notification.isActionable() ? ICON_ACTIONABLE : ICON_INFO); createCell(item, notification.getPatientName()); createCell(item, notification.getSubject()); createCell(item, notification.getDeliveryDate()); item.setDisabled(isProcessing); service.getNotificationMessage(notification); item.setTooltiptext(notification.getDisplayText()); item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), "onProcessItem"); } };