@Override public Listitem render(IPublisherInfo participant) { Listitem item = new Listitem(participant.getUserName()); item.setData(participant); if (exclusions != null && exclusions.contains(participant)) { item.setDisabled(true); item.addClass("chat-participant-active"); item.setVisible(!hideExclusions); } if (participant.equals(self)) { item.addClass("chat-participant-self"); } return item; }
private List<IPublisherInfo> getInvitees() { List<IPublisherInfo> invitees = new ArrayList<>(); for (Listitem item : lstSessions.getSelected()) { invitees.add(item.getData(IPublisherInfo.class)); } return invitees; }
/** * Compares two list items by comparing the label and value properties, respectively. * * @param o Item to compare. * @return Result of the comparison. */ @Override public int compareTo(Listitem o) { int cmp = ObjectUtils.compare(getLabel(), o.getLabel()); return cmp != 0 ? cmp : ObjectUtils.compare(value, o.value); }
@Override public Listitem render(String channel) { Listitem item = new Listitem(channel); //item.setSelectable(true); item.setSelected(true); return item; }
/** * Creates and returns a draggable list item. * * @param associateEvents If true, associate events with this item. * @return New list item. */ private Listitem newListitem(boolean associateEvents) { Listitem item = new Listitem(); if (associateEvents) { associateEvents(item); } String label = "Drop item #" + ++itemCount + (associateEvents ? " *" : ""); item.setLabel(label); // Set to info panel drop id. item.setDragid(IInfoPanel.DROP_ID); // Create and attach the object to be rendered. DroppedItem dropped = new DroppedItem(label, "This is the detail for drop item #" + itemCount); item.setData(dropped); // Associate the drop renderer with the item. DropUtil.setDropRenderer(item, dropRenderer); return item; }
@Override public Listitem render(String data) { Listitem item = new Listitem(data); item.setData(new LayoutIdentifier(data, shared)); if (pnlSelect.isVisible()) { item.addEventForward(DblclickEvent.TYPE, btnOK, ClickEvent.TYPE); } return item; }
private void processListResponses() { List<?> responses = control.getResponses(); listbox.setVisible(true); for (Object rsp : responses) { DialogResponse<?> response = (DialogResponse<?>) rsp; Listitem item = new Listitem(StrUtil.formatMessage(response.getLabel())); item.addEventListener(DblclickEvent.TYPE, clickListener); item.setData(response); listbox.addChild(item); if (response.isDefault()) { item.setSelected(true); } } if (listbox.getSelectedCount() == 0) { listbox.setSelectedItem(listbox.getChild(Listitem.class)); } addButton(LABEL_ID_CANCEL, "danger", (event) -> { close(null); }); addButton(LABEL_ID_OK, "success", (event) -> { close(listbox.getSelectedItem()); }); }
/** * Renders the list box contents. * * @param qr The search hit to render. */ @Override public Listitem render(HelpSearchHit qr) { Listitem item = new Listitem(); double score = qr.getConfidence(); item.setData(qr.getTopic()); Cell lc = new Cell(); lc.addChild(toImage(score)); String tt = StrUtil.formatMessage("@cwf.help.tab.search.score", score); lc.setHint(tt); item.addChild(lc); lc = new Cell(qr.getTopic().getLabel()); item.addChild(lc); lc = new Cell(qr.getTopic().getSource()); item.addChild(lc); return item; }
@Override public void onUnload() { super.onUnload(); for (Listitem item : lboxSubscriptions.getChildren(Listitem.class)) { if (item.isSelected()) { subscribe(item.getLabel(), false); } } }
@Override public Listitem render(String term) { return new Listitem(term); }
@EventHandler(value = "change", target = "lboxProviders") private void onChange$lboxProviders(ChangeEvent event) { Listitem item = (Listitem) event.getValue(); IMessageProducer producer = (IMessageProducer) item.getData(); if (item.isSelected()) { producerService.registerProducer(producer); } else { producerService.unregisterProducer(producer); } }
/** * Set the topic view when a topic selection is made. */ @EventHandler(value = "change", target = "@lstTopics") private void onSelect$lstTopics() { Listitem item = lstTopics.getSelectedItem(); Listitem keywordItem = lstKeywords.getSelectedItem(); if (item == null) { int i = keywordItem.hasAttribute("last") ? (Integer) keywordItem.getAttribute("last") : 0; item = (Listitem) lstTopics.getChildAt(i); lstTopics.setSelectedItem(item); } if (item != null) { keywordItem.setAttribute("last", lstTopics.getSelectedIndex()); setTopic((HelpTopic) item.getData()); } else { setTopic(null); } }
/** * Initialize the topic list when a keyword is selected. The last topic selected for the keyword * is automatically selected. */ @EventHandler(value = "change", target = "@lstKeywords") private void onSelect$lstKeywords() { Listitem item = lstKeywords.getSelectedItem(); if (item == null) { lstTopics.destroyChildren(); setTopic(null); return; } List<HelpTopic> topics = getTopics(item.getLabel()); if (!item.hasAttribute("sorted")) { item.setAttribute("sorted", true); Collections.sort(topics); } modelAndView.setModel(new ListModel<>(topics)); onSelect$lstTopics(); }
/** * Updates the selection status of a list item. * * @param item A list item. */ protected void _updateSelected(Listitem item) { if (item.isSelected() != selected.contains(item)) { if (!multiple) { unselect(null); } if (item.isSelected()) { selected.add(item); } else { selected.remove(item); } } }