private void sortTests() { if (colSort != null) { boolean asc = "ascending".equals(colSort.getSortDirection()); colSort.sort(asc, true); } }
Listheader newheader = new Listheader(); newheader.setLabel(listBox_Columns.getSelectedItem().getLabel()); newheader.setWidth("250px"); org.zkoss.zk.ui.sys.ComponentsCtrl.applyForward(newheader, "onRemoveFromHeader"); listModel.getListhead().appendChild(newheader); for (int i = 0; i < listValues.size(); i++) { List tmpCurrentRow = (List) listValues.get(i); List tmpRows = new ArrayList(); Listcell newCell = new Listcell(tmpCurrentRow.get(findIndexHeaderByName(listBox_Columns.getSelectedItem().getLabel(), allHeaders)).toString()); ((Listitem) listModel.getItems().get(i)).appendChild(newCell); }
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); if (!"none".equals(_sortDscNm)) render(renderer, "sortDescending", _sortDscNm); if (!"none".equals(_sortAscNm)) render(renderer, "sortAscending", _sortAscNm); if (!"natural".equals(_sortDir)) render(renderer, "sortDirection", _sortDir); if (_maxlength > 0) renderer.render("maxlength", _maxlength); org.zkoss.zul.impl.Utils.renderCrawlableText(getLabel()); }
/** Sorts the list items based on {@link #getSortAscending} * and {@link #getSortDescending}. * * @param ascending whether to use {@link #getSortAscending}. * If the corresponding comparator is not set, it returns false * and does nothing. * @param force whether to enforce the sorting no matter what the sort * direction ({@link #getSortDirection}) is. * If false, this method is the same as {@link #sort(boolean)}. * @return whether the rows are sorted. */ public boolean sort(boolean ascending, boolean force) { if (force) setSortDirection("natural"); return sort(ascending); }
private void initHeaders() { Listhead lh = lbResults.getListhead(); if (lh == null) { lh = new Listhead(); lbResults.appendChild(lh); } Listheader lhr = null; for (ColumnControl ctrl : lookupParams.getColControl()) { lhr = new Listheader(ctrl.getLabel()); lhr.setParent(lh); lhr.setVisible(ctrl.isVisible()); lhr.setWidth(ctrl.getWidth() + "px"); lhr.setSort("auto"); } if (lhr != null) { lhr.setHflex("1"); } }
final String dir = getSortDirection(); if (ascending) { if ("ascending".equals(dir)) return false; final Listbox listbox = getListbox(); if (listbox == null) return false; 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(); sortCollection(children, cmprx); if (previous == null || compare(cmprx, previous, item) != 0) { sort0(listbox, cmpr); //need to sort each group fixDirection(listbox, ascending);
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Listheader self = (Listheader)comp; wh.write("<th id=\"").write(self.getUuid()).write("\" z.type=\"Lhr\"") .write(self.getOuterAttrs()).write(self.getInnerAttrs()) .write("><div id=\"").write(self.getUuid()) .write("!cave\" class=\"").write(self.getZclass()).write("-cnt\">") .write(self.getColumnHtmlPrefix()) .write(self.getImgTag()); new Out(self.getLabel()).render(out); wh.writeChildren(self).writeln("</div></th>"); }
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); } }
FMDate date = new FMDate(pcs[1]); Listheader hdr = (Listheader) hdrVitals.getChildren().get(c); hdr.setLabel(date.toString()); hdr.setValue(date); hdr.setParent(hdrVitals); headers.put(pcs[0], hdr); int col = headers.get(pcs[0]).getColumnIndex(); int row = StrUtil.toInt(pcs[1]) - 1; setValue(col, row, StrUtil.strAppend(getValue(col, row), pcs[2], "; "), null);
final String dir = getSortDirection(); if (ascending) { if ("ascending".equals(dir)) return false; return doSort(ascending);
/** * Invokes a sorting action based on a {@link SortEvent} and maintains * {@link #getSortDirection}. * @since 6.5.0 */ public void onSort(SortEvent event) { sort(event.isAscending()); }
@Override public String getSortDirection() { return target.as(Listheader.class).getSortDirection(); }
public Listheader(String label, String src, String width) { super(label, src); setWidth(width); }
public void onPaging$pgVitals() { int maxCols = sldVitals.getCurpos() + 1; int cols = hdrVitals.getChildren().size() - 1; int col1 = pgVitals.getActivePage() * maxCols; int col2 = col1 + maxCols; for (int col = 1; col < cols; col++) { ((Listheader) hdrVitals.getChildren().get(col)).setVisible(col > col1 && col <= col2); } }
public int compare(Object o1, Object o2) { final int index = _index < 0 && _header != null ? _header.getColumnIndex() : _index;
private static boolean doSort(Listbox listbox) { Listhead hds = listbox.getListhead(); if (!listbox.isAutosort() || hds == null) return false; for (Iterator<Component> it = hds.getChildren().iterator(); it.hasNext();) { final Listheader hd = (Listheader) it.next(); String dir = hd.getSortDirection(); if (!"natural".equals(dir)) { return hd.doSort("ascending".equals(dir)); } } return false; }
((Listheader) lbResults.getListhead().getChildren().get(sortCol)).sort(true, true);
private void sortProblems() { if (colSort != null) { boolean asc = "ascending".equals(colSort.getSortDirection()); colSort.sort(asc, true); } }
/** It invokes {@link #sort(boolean)} to sort list items and maintain * {@link #getSortDirection}. * @deprecated As of release 6.5.0, use or override {@link #onSort(SortEvent)} * instead. */ public void onSort() { final String dir = getSortDirection(); if ("ascending".equals(dir)) sort(false); else if ("descending".equals(dir)) sort(true); else if (!sort(true)) sort(false); }