Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java,v diff -u -r1.41.2.10 -r1.41.2.11 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java 21 Mar 2007 02:44:24 -0000 1.41.2.10 +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java 30 Mar 2007 06:15:14 -0000 1.41.2.11 @@ -518,6 +518,17 @@ gate.setTransitionFrom(newTransition); toActivity.setTransitionTo(newTransition); + + // set x/y position for Gate + Integer x1 = (activity.getXcoord() != null) ? activity.getXcoord() : 0; + Integer x2 = (toActivity.getXcoord() != null) ? toActivity.getXcoord() : 0; + + gate.setXcoord(new Integer(((x1.intValue() + 123 + x2.intValue()) / 2) - 13)); + + Integer y1 = (activity.getYcoord() != null) ? activity.getYcoord() : 0; + Integer y2 = (toActivity.getYcoord() != null) ? toActivity.getYcoord() : 0; + + gate.setYcoord(new Integer((y1.intValue() + 50 + y2.intValue()) / 2)); } else { fromTransition = newTransition; @@ -531,12 +542,16 @@ activity.setTransitionFrom(fromTransition); gate.setTransitionTo(fromTransition); + + // set x/y position for Gate + Integer x1 = (activity.getTransitionTo() != null) ? activity.getTransitionTo().getFromActivity().getXcoord() : null; + Integer x2 = (activity.getXcoord() != null) ? activity.getXcoord() : 0; + + if(x2 != null) gate.setXcoord(x2>=x1 ? new Integer(x2.intValue()+123+13+20) : new Integer(x2.intValue()-13-20)); + else gate.setXcoord(new Integer(x2.intValue()+123+13+20)); + + gate.setYcoord(activity.getYcoord() + 25); } - - // set x/y position for Gate - int x = activity.getXcoord() != null ? activity.getXcoord() : 0; - gate.setXcoord(x>=20 ? x-20 : 5); - gate.setYcoord(activity.getYcoord()); } else { // no read-only activities insert gate at start of sequence @@ -559,11 +574,14 @@ // set gate as first activity in sequence design.setFirstActivity(gate); - // set x/y position for Gate - int x = toActivity.getXcoord() != null ? toActivity.getXcoord() : 0; - gate.setXcoord(x>=20 ? x-20 : 5); - gate.setYcoord(toActivity.getYcoord()); + // set x/y position for Gate + Integer x1 = (activity.getXcoord() != null) ? activity.getXcoord() : 0; + Integer x2 = (activity.getTransitionFrom() != null) ? activity.getTransitionFrom().getToActivity().getXcoord() : null; + if(x2 != null) gate.setXcoord(x2>=x1 ? new Integer(x1.intValue()-13-20) : new Integer(x1.intValue()+123+13+20)); + else gate.setXcoord(new Integer(x1.intValue()-13-20)); + + gate.setYcoord(toActivity.getYcoord() + 25); } design.getTransitions().add(newTransition); @@ -583,7 +601,6 @@ } - /** * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getFirstUnattemptedActivity(org.lamsfoundation.lams.learningdesign.LearningDesign) */