public void draw(Canvas canvas, int line, int column, int width) { canvas.set(line, getNamePos(column, width), name); if (alias) canvas.set(line + 1, column + ((width - 1) / 2), "*"); else if (!children.isEmpty()) { int[] childWidth = new int[children.size()]; int childrenWidth = 0; for (int i = 0; i < children.size(); i++) childrenWidth += childWidth[i] = children.get(i).getMinWidth(); while (childrenWidth < width) for (int i = children.size() - 1; i >= 0; i--) { childWidth[i]++; childrenWidth++; } int childCol = column; for (int i = 0; i < children.size(); i++) { Node child = children.get(i); drawEdge(canvas, line, getNamePos(column, width), name.length(), getNamePos(childCol, childWidth[i]), child.name.length()); child.draw(canvas, line + 2, childCol, childWidth[i]); childCol += childWidth[i]; } } }
public void draw(Canvas canvas, int line, int column, int width) { canvas.set(line, getNamePos(column, width), name); if (alias) canvas.set(line + 1, column + ((width - 1) / 2), "*"); else if (!children.isEmpty()) { int[] childWidth = new int[children.size()]; int childrenWidth = 0; for (int i = 0; i < children.size(); i++) childrenWidth += childWidth[i] = children.get(i).getMinWidth(); while (childrenWidth < width) for (int i = children.size() - 1; i >= 0; i--) { childWidth[i]++; childrenWidth++; } int childCol = column; for (int i = 0; i < children.size(); i++) { Node child = children.get(i); drawEdge(canvas, line, getNamePos(column, width), name.length(), getNamePos(childCol, childWidth[i]), child.name.length()); child.draw(canvas, line + 2, childCol, childWidth[i]); childCol += childWidth[i]; } } }