Index: topia2/src/java/org/codelutin/topia/generator/TapestryWebGenerator.java diff -u topia2/src/java/org/codelutin/topia/generator/TapestryWebGenerator.java:1.1 topia2/src/java/org/codelutin/topia/generator/TapestryWebGenerator.java:1.2 --- topia2/src/java/org/codelutin/topia/generator/TapestryWebGenerator.java:1.1 Tue May 29 10:08:33 2007 +++ topia2/src/java/org/codelutin/topia/generator/TapestryWebGenerator.java Mon Aug 6 14:22:33 2007 @@ -45,10 +45,10 @@ * * @see org.codelutin.generator.StateModelGenerator * @author chatellier - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Last update : $Date: 2007/05/29 10:08:33 $ - * By : $Author: chatellier $ + * Last update : $Date: 2007/08/06 14:22:33 $ + * By : $Author: ndupont $ */ public class TapestryWebGenerator extends StateModelGenerator { @@ -228,15 +228,22 @@ @SuppressWarnings("unused") protected void generateInjectionAndEventsFromState(Writer output, StateModelStateChart chart, StateModelState state) throws IOException { + // liste les états de destination (pour éviter les doublons) + List destStates = new ArrayList(); + for(StateModelTransition transition : state.getTransitions()) { StateModelState toState = transition.getDestinationState(); - + if(toState.isComplex()) { StateModelState toInitState = ((StateModelComplexState)toState).getInitialState(); // l'attribute doit etre private // sinon tapestry ne le traite pas + + // si l'état de destination n'a pas encore été traité + if(!destStates.contains(toState)){ + destStates.add(toState); /*{ /* linked state "<%=toState.getName()%>" *) @InjectPage @@ -244,12 +251,12 @@ }*/ // l'attribut etant prive, il faut un getter /*{ - /* getter for state state "<%=toState.getName()%>" *) + /* getter for state "<%=toState.getName()%>" *) protected <%=Util.toUpperCaseFirstLetter(toInitState.getName())%> get<%=Util.toUpperCaseFirstLetter(toInitState.getName())%>() { return <%=Util.toLowerCaseFirstLetter(toInitState.getName())%>; } }*/ - + } /*{ /* transition on <%=transition.getEvent()%> event *) public Object onActionFrom<%=Util.toUpperCaseFirstLetter(transition.getEvent())%>() { @@ -264,6 +271,10 @@ // si l'etat a injecter n'est pas final if(!simpleToState.isFinal()) { + + // si l'état de destination n'a pas encore été traité + if(!destStates.contains(toState)){ + destStates.add(toState); /*{ /* linked state "<%=simpleToState.getName()%>" *) @InjectPage @@ -271,11 +282,12 @@ }*/ // l'attribut etant prive, il faut un getter /*{ - /* getter for state state "<%=simpleToState.getName()%>" *) + /* getter for state "<%=simpleToState.getName()%>" *) protected <%=Util.toUpperCaseFirstLetter(simpleToState.getName())%> get<%=Util.toUpperCaseFirstLetter(simpleToState.getName())%>() { return <%=Util.toLowerCaseFirstLetter(simpleToState.getName())%>; } }*/ + } } // isFinal /*{ /* transition on "<%=transition.getEvent()%>" event *) @@ -291,7 +303,7 @@ /*{ } }*/ } - } + } } /**