private void doWriteComponentsToBeanVer(TVerifikasi tVerifikasi) { if (listbox_NamaPelaksana.getSelectedItem() != null) { Listitem itempelaksana = listbox_NamaPelaksana.getSelectedItem(); ListModelList lml = (ListModelList) listbox_NamaPelaksana.getListModel(); VHrEmployeePelaksana vHrEmployeePelaksana = (VHrEmployeePelaksana) lml.get(itempelaksana.getIndex()); if (!vHrEmployeePelaksana.getEmployee_name().equalsIgnoreCase("Silakan pilih")) { tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no()); } if (!vHrEmployeePelaksana.getEmployee_no().equalsIgnoreCase("555")) { tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no()); } } }
@Override public void render(Listitem item, Object data) throws Exception { PType pType = (PType) data; Listcell lc = new Listcell(pType.getType_desc()); lc.setParent(item); item.setAttribute("data", data); }
@Override public void render(Listitem item, Node data, int index) throws Exception { item.setValue(data); new Listcell(data.getLabel()).setParent(item); }
/** * Groups and sorts the items ({@link Listitem}) based on {@link #getSortAscending}. If the * corresponding comparator is not set, it returns false and does nothing. * * @param ascending whether to use {@link #getSortAscending}. If the corresponding comparator is * not set, it returns false and does nothing. * @return whether the rows are grouped. * @since 6.5.0 */ public boolean group(boolean ascending) { final String dir = getSortDirection(); if (ascending) { if ("ascending".equals(dir)) return false; } else { if ("descending".equals(dir)) return false; } final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc; if (cmpr == null) return false; final Listbox listbox = getListbox(); if (listbox == null) return false; // comparator might be zscript Scopes.beforeInterpret(this); try { final ListModel model = listbox.getModel(); int index = listbox.getListhead().getChildren().indexOf(this); if (model != null) { // live data if (!(model instanceof GroupsSortableModel)) throw new UiException( GroupsSortableModel.class + " must be implemented in " + model.getClass().getName()); groupGroupsModel((GroupsSortableModel) model, cmpr, ascending, index); } else { // not live data final List<Listitem> items = listbox.getItems(); if (items.isEmpty()) return false; // Avoid listbox with null group if (listbox.hasGroup()) { for (Listgroup group : new ArrayList<Listgroup>(listbox.getGroups())) group.detach(); // Groupfoot is removed automatically, if any. } Comparator<?> cmprx; if (cmpr instanceof GroupComparator) { cmprx = new GroupToComparator((GroupComparator) cmpr); } else { cmprx = cmpr; } final List<Listitem> children = new LinkedList<Listitem>(items); items.clear(); sortCollection(children, cmprx); Listitem previous = null; for (Listitem item : children) { if (previous == null || compare(cmprx, previous, item) != 0) { // new group final List<Listcell> cells = item.getChildren(); if (cells.size() < index) throw new IndexOutOfBoundsException("Index: " + index + " but size: " + cells.size()); Listgroup group; Listcell cell = cells.get(index); if (cell.getLabel() != null) { group = new Listgroup(cell.getLabel()); } else { Component cc = cell.getFirstChild(); if (cc instanceof Label) { String val = ((Label) cc).getValue(); group = new Listgroup(val); } else { group = new Listgroup(Messages.get(MZul.GRID_OTHER)); } } listbox.appendChild(group); } listbox.appendChild(item); previous = item; } if (cmprx != cmpr) sort0(listbox, cmpr); // need to sort each group } } finally { Scopes.afterInterpret(); } fixDirection(listbox, ascending); // sometimes the items at client side are out of date listbox.invalidate(); return true; }