private void afterUnmarshal() { for (Iterator it = getChildren().iterator(); it.hasNext();) { final Object child = it.next(); if (child instanceof Detail) { _detail = (Detail) child; break; //done } } }
public boolean insertBefore(Component newChild, Component refChild) { if (newChild instanceof Detail) { //move to the first child refChild = getChildren().isEmpty() ? null : getChildren().get(0); if (super.insertBefore(newChild, refChild)) { _detail = (Detail) newChild; return true; } return false; } else if (refChild != null && refChild == _detail) { if (getChildren().size() <= 1) refChild = null; else refChild = getChildren().get(1); } return super.insertBefore(newChild, refChild); }
/** Returns the specified cell, or null if not available. * @param row which row to fetch (starting at 0). * @param col which column to fetch (starting at 0). */ public Component getCell(int row, int col) { final Rows rows = getRows(); if (rows == null) return null; List children = rows.getChildren(); if (children.size() <= row) return null; children = ((Row) children.get(row)).getChildren(); return children.size() <= col ? null : (Component) children.get(col); }
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; }
v2 = handleCase(r2.getValue()); } else { List rcs1 = r1.getChildren(); if (_index >= rcs1.size()) v1 = null; v1 = handleCase(rcs1.get(_index)); List rcs2 = r2.getChildren(); if (_index >= rcs2.size()) v2 = null;
public void render(Row row, java.lang.Object bean, int index) { final List<Component> kids = cast((List) row.getAttribute(KIDS)); row.getChildren().addAll(kids); // row.removeAttribute(KIDS); //remove template mark of cloned component and its descendant _binder.setupTemplateComponent(row, null); //setup clone id BindingRendererUtil.setupCloneIds(row); //bind bean to the associated row and its descendant final String varname = (String) _template.getAttribute(DataBinder.VARNAME); final Map<Object, Object> templatemap = cast((Map) row.getAttribute(DataBinder.TEMPLATEMAP)); templatemap.put(varname, bean); //apply the data binding _binder.loadComponent(row); //feature# 3026221: Databinder shall fire onCreate when cloning each items DataBinder.postOnCreateEvents(row); //since 5.0.4 } }
} finally { _rows.setReplacingRow(oldFlag); if (row.getChildren().isEmpty()) cell.setParent(row);
if (previous == null || compare(cmprx, previous, row) != 0) { final List<Component> cells = row.getChildren(); if (cells.size() < index) throw new IndexOutOfBoundsException("Index: " + index + " but size: " + cells.size());
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Row self = (Row) comp; final String uuid = self.getUuid(); wh.write("<tr z.type=\"Grw\" id=\"").write(uuid).write('"') .write(self.getOuterAttrs()).write(self.getInnerAttrs()).write('>'); int i = 0; for (Iterator it = self.getChildren().iterator(); it.hasNext();i++) { final Component child = (Component) it.next(); wh.write("<td z.type=\"Gcl\" id=\"").write(child.getUuid()).write("!chdextr\"") .write(self.getChildAttrs(i)).write("><div id=\"").write(child.getUuid()) .write("!cell\" class=\"").write(self.getZclass()).write("-cnt"); if (self.getGrid().isFixedLayout()) wh.write(" z-overflow-hidden"); wh.write("\">"); child.redraw(out); wh.writeln("</div></td>"); } wh.writeln("</tr>"); }