public void constructTableData() { Vector vtTemp = new Vector(); nodeData.removeAllElements(); for (Enumeration e = view.getPositions(); e.hasMoreElements(); ) { NodePosition nodePos = (NodePosition) e.nextElement(); vtTemp.addElement(nodePos); nodeData.addElement(nodePos); } for (Enumeration e = vtTemp.elements(); e.hasMoreElements(); ) { NodePosition nodePos = (NodePosition) e.nextElement(); NodeSummary node = nodePos.getNode(); int index = nodePos.getYPos() / 10; index--; if (index < nodeData.size()) { nodeData.removeElementAt(index); nodeData.insertElementAt(nodePos, index); } } }
/** Reorders the views nodes and sets their yPositions. */ public void sortNodePos() { Vector vtTemp = new Vector(); for (Enumeration e = view.getPositions(); e.hasMoreElements(); ) { vtTemp.addElement((NodePosition) e.nextElement()); } for (int i = 0; i < vtTemp.size(); i++) { int yPos1 = ((NodePosition) vtTemp.elementAt(i)).getYPos(); for (int j = i + 1; j < vtTemp.size(); j++) { int yPos2 = ((NodePosition) vtTemp.elementAt(j)).getYPos(); if (yPos1 > yPos2) { Object o = vtTemp.elementAt(i); vtTemp.setElementAt(vtTemp.elementAt(j), i); vtTemp.setElementAt(o, j); yPos1 = ((NodePosition) vtTemp.elementAt(i)).getYPos(); } } } for (int i = 0; i < vtTemp.size(); i++) { ((NodePosition) vtTemp.elementAt(i)).setYPos((i + 1) * 10); } }