diff --git a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/layouts/DAGLayout.java b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/layouts/DAGLayout.java index 5e73b21..1417c37 100644 --- a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/layouts/DAGLayout.java +++ b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/layouts/DAGLayout.java @@ -28,7 +28,7 @@ try { List> map = new ArrayList>(); - List moved = new ArrayList(); + List moved = new ArrayList<>(); for (int i = 0; i < model.getChildCount(parent); i++) { @@ -39,42 +39,72 @@ mxCellState state = view.getState(cell); double x = state.getX(); double y = state.getY(); - double w = state.getWidth(); - double h = state.getHeight(); if(!"ellipse".equals(state.getStyle().get("shape")) && (cell.getEdgeCount() == 1)) { - map.get(map.size()).add(cell); - mxCell next = (mxCell) cell.getTarget(); - lines(map, next); + List newline = new ArrayList(); + map.add(newline); + lines(map, cell); + System.out.println("clear"); } } } + //�`�F�b�N�p + for(int a = 0; a < map.size(); a++) { + System.out.println("-"); + for(int b = 0; b < map.get(a).size(); b++) { + System.out.println(map.get(a).get(b).getId()); + } + } + //���בւ� + for(int i = 0; i < map.size(); i++) { + for(int j = 0; j < map.get(i).size(); j++) { + if(checkmoved(moved, map.get(i).get(j))) { + map.get(i).get(j).getGeometry().setX(100+j*150); + map.get(i).get(j).getGeometry().setY(100+i*100); + moved.add(map.get(i).get(j).getId()); + } + } + } + } finally { model.endUpdate(); } } - public boolean firstmove(List moved, String id) { - for (int i = 0; i < moved.size(); i++) { - if(moved.get(i) == id) return false; - } - return true; - } public void lines(List> mapping, mxCell next) { mapping.get(mapping.size()-1).add(next); + int tagcount = 0; + mxCell edge; + System.out.println("start"); for(int i = 0; i < next.getEdgeCount(); i++) { - if(next != (mxCell) next.getTarget()) { - if(i > 0) { + edge = (mxCell) next.getEdgeAt(i); + if(next != (mxCell) edge.getTarget() && ((mxCell) edge.getTarget() != null)) { + tagcount++; + if(tagcount > 1) { + System.out.println("some"); List newline = new ArrayList(mapping.get(mapping.size()-1)); + while(newline.get(newline.size()-1).getId() != next.getId()) { + newline.remove(newline.size()-1); + } mapping.add(newline); - lines(mapping, (mxCell) next.getTarget()); + lines(mapping, (mxCell) edge.getTarget()); + } else { - lines(mapping, (mxCell) next.getTarget()); + System.out.println("first"); + lines(mapping, (mxCell) edge.getTarget()); } } } } + public boolean checkmoved(List list, mxCell cell) { + for(int i = 0; i < list.size(); i++) { + if(list.get(i).equals(cell.getId()))return false; + } + return true; + } + + } \ No newline at end of file