/** * Returns a all descendants of the given cell and the cell itself * as a collection. */ public static Collection<Object> getDescendants(mxIGraphModel model, Object parent) { return filterDescendants(model, null, parent); }
/** * Returns a all descendants of the given cell and the cell itself * as a collection. */ public static Collection<Object> getDescendants(mxIGraphModel model, Object parent) { return filterDescendants(model, null, parent); }
/** * Creates a collection of cells using the visitor pattern. */ public static Collection<Object> filterDescendants(mxIGraphModel model, Filter filter) { return filterDescendants(model, filter, model.getRoot()); }
/** * Creates a collection of cells using the visitor pattern. */ public static Collection<Object> filterDescendants(mxIGraphModel model, Filter filter) { return filterDescendants(model, filter, model.getRoot()); }
/** * Creates a collection of cells using the visitor pattern. */ public static Collection<Object> filterDescendants(mxIGraphModel model, Filter filter, Object parent) { List<Object> result = new ArrayList<Object>(); if (filter == null || filter.filter(parent)) { result.add(parent); } int childCount = model.getChildCount(parent); for (int i = 0; i < childCount; i++) { Object child = model.getChildAt(parent, i); result.addAll(filterDescendants(model, filter, child)); } return result; }
/** * Creates a collection of cells using the visitor pattern. */ public static Collection<Object> filterDescendants(mxIGraphModel model, Filter filter, Object parent) { List<Object> result = new ArrayList<Object>(); if (filter == null || filter.filter(parent)) { result.add(parent); } int childCount = model.getChildCount(parent); for (int i = 0; i < childCount; i++) { Object child = model.getChildAt(parent, i); result.addAll(filterDescendants(model, filter, child)); } return result; }
Collection<Object> cells = mxGraphModel.filterDescendants(getModel(), new mxGraphModel.Filter()
Collection<Object> cells = mxGraphModel.filterDescendants(getModel(), new mxGraphModel.Filter()