/** @deprecated As of release 5.0.8, use custom attributes (org.zkoss.zul.listbox.preloadSize) instead. * Returns the number of rows to preload when receiving * the rendering request from the client. * * <p>Default: 50. (since 6.0.1) * * <p>It is used only if live data ({@link #setModel(ListModel)} and * not paging ({@link #getPagingChild}. * * <p>Note: if the "pre-load-size" attribute of component is specified, it's prior to the original value.(@since 3.0.4) * @since 2.4.1 */ public int getPreloadSize() { final String size = (String) getAttribute("pre-load-size"); return size != null ? Integer.parseInt(size) : _preloadsz; }
/** Returns whether to sort all of item when model or sort direction be changed. * @since 5.0.7 */ /*package*/ boolean isAutosort() { String attr = "org.zkoss.zul.grid.autoSort"; Object val = getAttribute(attr, true); if (val == null) val = Library.getProperty(attr); return val instanceof Boolean ? ((Boolean) val).booleanValue() : val != null ? "true".equals(val) || "ignore.change".equals(val) : false; }
/** Returns whether to sort all of item when model or sort direction be changed. * @since 5.0.7 */ private boolean isIgnoreSortWhenChanged() { String attr = "org.zkoss.zul.grid.autoSort"; Object val = getAttribute(attr, true); if (val == null) val = Library.getProperty(attr); return val == null ? true : "ignore.change".equals(val); }
private void postOnPagingInitRender() { if (getAttribute(ATTR_ON_PAGING_INIT_RENDERER_POSTED) == null && getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) { // B50-ZK-345 setAttribute(ATTR_ON_PAGING_INIT_RENDERER_POSTED, Boolean.TRUE); Events.postEvent("onPagingInitRender", this, null); } }
/** * Returns the number of rows to preload when receiving the rendering * request from the client. * <p> * Default: 50. (since 6.0.1) * <p> * It is used only if live data ({@link #setModel(ListModel)} and not paging * ({@link #getPagingChild}. */ private int preloadSize() { final String size = (String) getAttribute("pre-load-size"); int sz = size != null ? Integer.parseInt(size) : _preloadsz; if ((sz = Utils.getIntAttribute(this, "org.zkoss.zul.grid.preloadSize", sz, true)) < 0) throw new UiException("nonnegative is required: " + sz); return sz; }
private void postOnInitRender() { //20080724, Henri Chen: optimize to avoid postOnInitRender twice if (getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) { setAttribute(ATTR_ON_INIT_RENDER_POSTED, Boolean.TRUE); Events.postEvent("onInitRender", this, null); } }
public Row newRow(Grid grid) { //clone from template final Row clone = (Row) _template.clone(); //avoid duplicate id error, will set to new id when render() //Bug #1962153: Data binding generates duplicate id in some case (add "_") if (clone.getId().length() > 0) { clone.setId(null); } //link cloned component with template //each Row and its descendants share the same templatemap Map<Object, Object> templatemap = new HashMap<Object, Object>(8); BindingRendererUtil.linkTemplates(clone, _template, templatemap, _binder); //link this template map to parent templatemap (Grid in Grid) Map parenttemplatemap = (Map) grid.getAttribute(DataBinder.TEMPLATEMAP); if (parenttemplatemap != null) { templatemap.put(DataBinder.TEMPLATEMAP, parenttemplatemap); } //kept clone kids somewhere to avoid create too many components in browser final List<Component> kids = new ArrayList<Component>(clone.getChildren()); clone.setAttribute(KIDS, kids); clone.getChildren().clear(); return clone; }
} else if (getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) { getDataLoader().syncModel(-1, -1); //we have to recreate all } else {
if (getAttribute(Attributes.BEFORE_MODEL_ITEMS_RENDERED) != null && (type == ListDataEvent.INTERVAL_ADDED || type == ListDataEvent.INTERVAL_REMOVED)) return;
Object oldVar = grid.getAttribute(varnm); Object oldIter = grid.getAttribute(itervarnm); grid.setAttribute(varnm, data); grid.setAttribute(itervarnm, iterStatus);