/** * Returns all views, including descendants that have a parent in * <code>views</code> without the PortViews. Note: Iterative * Implementation using view.getChildViews. This returns the array in * inverse order, ie with the top most cell view at index 0. * * @param views * the cell views whose descendants are to be returned * @return the specified views and all their descendant views */ public static CellView[] getDescendantViews(CellView[] views) { Stack stack = new Stack(); for (int i = 0; i < views.length; i++) stack.add(views[i]); ArrayList result = new ArrayList(); while (!stack.isEmpty()) { CellView tmp = (CellView) stack.pop(); Object[] children = tmp.getChildViews(); for (int i = 0; i < children.length; i++) stack.add(children[i]); result.add(tmp); } CellView[] ret = new CellView[result.size()]; result.toArray(ret); return ret; }
public void refresh(CellView view, boolean create) { if (view != null) { view.refresh(this, this, create); CellView[] children = view.getChildViews(); for (int i = 0; i < children.length; i++) refresh(children[i], create); } }
public void update(CellView view) { if (view != null) { view.update(this); CellView[] children = view.getChildViews(); for (int i = 0; i < children.length; i++) update(children[i]); } }
while (!stack.isEmpty()) { CellView tmp = (CellView) stack.pop(); Object[] children = tmp.getChildViews(); for (int i = 0; i < children.length; i++) stack.add(children[i]);
public void updateAutoSize(CellView view) { if (!view.isLeaf()) { CellView[] children = view.getChildViews(); Rectangle2D rect = GraphConstants.getBounds(children[0] .getAllAttributes()); double x = rect.getMaxX() + 10; double y = rect.getY(); for (int index = 1; index < children.length; index++) { Rectangle2D childRect = GraphConstants .getBounds(children[index].getAllAttributes()); childRect.setFrame(x, y, childRect.getWidth(), childRect .getHeight()); x += childRect.getWidth() + 10; children[index].update(); } } else { super.updateAutoSize(view); } }
CellView[] children = preview.getChildViews(); for (int i=0; i<children.length; i++) { children[i] = createMapping(children[i].getCell());
CellView[] children = view.getChildViews(); for (int i = 0; i < children.length; i++) paintCell(g, children[i], children[i].getBounds(), preview);
public void translate(int dx, int dy) { // System.err.println(view.getCell() + ": Translate by " + dx + ", " + dy); if (view.isLeaf()) { model.getAttributes(node).translate(dx, dy); } else { CellView[] cells = view.getChildViews(); for (int index = 0; index < cells.length; index++) { CellView child = cells[index]; model.getAttributes(child.getCell()).translate(dx, dy); child.refresh(model, mapper, false); } } view.refresh(model, mapper, false); } };