Author: tchemit Date: 2010-03-18 22:42:47 +0100 (Thu, 18 Mar 2010) New Revision: 1795 Log: reformat code + improve generics Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java trunk/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -78,7 +78,7 @@ * <p/> * Note : Replace previous class jaxx.runtime.swing.Utils in previous versions. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.2 */ public class SwingUtil extends JAXXUtil { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -49,7 +49,7 @@ * <li>override the method {@link #acceptEvent(MouseEvent, JXLayer)}</li> * </ul> * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.2 */ public class BlockingLayerUI extends AbstractLayerUI<JComponent> { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -51,7 +51,7 @@ * <li>override the method {@link #acceptEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer)}</li> * </ul> * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public class BlockingLayerUI2 extends org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent> { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -35,7 +35,7 @@ * le contenu sera changé automatiquement, ce qui permet une utilisation direct * dans jaxx sans à avoir à écrire d'écouteur. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 * @see CardLayout2 */ Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -49,7 +49,7 @@ /** * La classe pour encapsuler l'aide de l'application. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.4 */ public class JAXXHelpBroker { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -28,7 +28,7 @@ * * @param <B> type of broker. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 * @see JAXXHelpBroker */ Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -39,7 +39,7 @@ * from a node we can not just listen selection model changed, we must control * it. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.7.2 */ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel implements TreeSelectionListener{ Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -22,67 +22,68 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Un modèle de wizard. + * <p/> + * <p/> + * <b>Note:</b> le type des étapes doit être uné énumération qui implante {@link + * WizardStep}. * - * - * <b>Note:</b> le type des étapes doit être uné énumération qui implante - * {@link WizardStep}. - * + * @author tchemit <chemit@codelutin.com> * @param <E> le type des étapes. - * - * @author tony + * @see WizardStep * @since 1.3 - * @see WizardStep */ public class WizardModel<E extends WizardStep> { public static final String STEPS_PROPERTY_NAME = "steps"; + public static final String STEP_PROPERTY_NAME = "step"; + public static final String PREVIOUS_STEP_PROPERTY_NAME = "previousStep"; + public static final String NEXT_STEP_PROPERTY_NAME = "nextStep"; + public static final String VALID_STEP_PROPERTY_NAME = "validStep"; - /** - * le type d'une etape du model (doit etre une enumeration) - */ + + /** le type d'une etape du model (doit etre une enumeration) */ protected final Class<E> stepClass; - /** - * Toutes les étapes à passer - */ + + /** Toutes les étapes à passer */ protected List<E> steps; + /** les etapes a exclure */ protected List<E> excludeSteps; - /** - * L'étape courante - */ + + /** L'étape courante */ protected E step; - /** - * drapeau pour valider l'état de l'étape courante - */ + + /** drapeau pour valider l'état de l'étape courante */ protected boolean validStep; + /** - * drapeau lorsque le modele effectue des operations - * de transformation de modele mais que les écouteurs - * ne devraient pas tenir compte des modifications + * drapeau lorsque le modele effectue des operations de transformation de + * modele mais que les écouteurs ne devraient pas tenir compte des + * modifications */ protected boolean valueAdjusting; - /** - * pour propager les changements dans le modèle vers l'ui - */ + + /** pour propager les changements dans le modèle vers l'ui */ protected PropertyChangeSupport pcs; public WizardModel(Class<E> stepClass, E... steps) { if (!Enum.class.isAssignableFrom(stepClass)) { throw new IllegalArgumentException("stepClass must be an" + - " Enumeration but was " + stepClass.getName()); + " Enumeration but was " + stepClass.getName()); } this.stepClass = stepClass; - this.pcs = new PropertyChangeSupport(this); - this.steps = new java.util.ArrayList<E>(); + pcs = new PropertyChangeSupport(this); + this.steps = new ArrayList<E>(); if (steps.length > 0) { setSteps(steps); } @@ -119,7 +120,7 @@ } if (!steps.contains(e)) { throw new IllegalStateException("step " + e.toString() + - " is not in universe of steps (" + steps + ')'); + " is not in universe of steps (" + steps + ')'); } setStep(e); } @@ -169,7 +170,7 @@ return steps.get(index + 1); } - public java.util.List<E> getSteps() { + public List<E> getSteps() { return steps; } @@ -179,13 +180,13 @@ /** * Change l'univers des etapes. - * + * <p/> * Note: on presume ici que l'étape courante est toujours la meme. * * @param steps le nouvel univers des etapes */ public void setSteps(E... steps) { - java.util.List<E> oldValue = this.steps; + List<E> oldValue = this.steps; this.steps = Collections.unmodifiableList(Arrays.asList(steps)); firePropertyChange(STEPS_PROPERTY_NAME, oldValue, this.steps); // la propriete nextStep peut avoir changee @@ -199,6 +200,7 @@ public void setExcludeSteps(List<E> excludeSteps) { this.excludeSteps = excludeSteps; } + public boolean validate(E s) { return step != null; } @@ -233,11 +235,11 @@ return; } boolean validate = validate(step); - this.validStep = validate; + validStep = validate; // toujours forcer la propagation firePropertyChange(VALID_STEP_PROPERTY_NAME, null, validStep); } - + protected Class<E> getStepClass() { return stepClass; } @@ -250,7 +252,7 @@ firePropertyChange(NEXT_STEP_PROPERTY_NAME, null, getNextStep()); // la propriete previousStep peut avoir changee firePropertyChange(PREVIOUS_STEP_PROPERTY_NAME, null, - getPreviousStep()); + getPreviousStep()); validate(); } Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,16 +20,17 @@ */ package jaxx.runtime.swing.wizard; -import javax.swing.SwingWorker; import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.swing.*; + /** - * La classe de base a implanter pour definir l'action d'une operation - * dans un wizard. + * La classe de base a implanter pour definir l'action d'une operation dans un + * wizard. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @param <E> le type d'étapes * @param <M> le type de modèle * @since 1.3 @@ -37,15 +38,19 @@ public abstract class WizardOperationAction<E extends WizardOperationStep, M extends WizardOperationModel<E>> extends SwingWorker<WizardOperationState, String> { /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(WizardOperationAction.class); + private static final Log log = + LogFactory.getLog(WizardOperationAction.class); + E operation; + WizardOperationState operationState; + Exception error; public WizardOperationAction(E operation) { - super(); if (!operation.isOperation()) { - throw new IllegalArgumentException("the step " + operation + " has no operation defined"); + throw new IllegalArgumentException( + "the step " + operation + " has no operation defined"); } this.operation = operation; } @@ -68,7 +73,8 @@ public abstract void start(JAXXContext context); - public abstract void beforeAction(JAXXContext context, M model) throws Exception; + public abstract void beforeAction(JAXXContext context, + M model) throws Exception; public abstract WizardOperationState doAction(M model) throws Exception; @@ -86,7 +92,8 @@ @Override public String toString() { - return super.toString() + " < operation: " + operation + ", state: " + getState() + " >"; + return super.toString() + " < operation: " + operation + ", state: " + + getState() + " >"; } @Override @@ -122,7 +129,7 @@ log.error(e.getMessage(), e); } finally { // on enregistre le resultat de l'opération - this.operationState = result; + operationState = result; } } } Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,42 +20,45 @@ */ package jaxx.runtime.swing.wizard; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Date; -import javax.swing.SwingWorker.StateValue; import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.swing.SwingWorker.StateValue; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Date; + /** * Thread qui réalise les opérations. + * <p/> + * Pour exécuter une nouvelle opération, on utilise la méthode {@link + * #launchOperation(WizardOperationStep)}. + * <p/> + * Note: Pour bloquer (ou débloquer) le thread, on utilise la méthode {@link + * #setWaiting(boolean)} * - * Pour exécuter une nouvelle opération, on utilise la méthode - * {@link #launchOperation(WizardOperationStep)}. - * - * Note: Pour bloquer (ou débloquer) le thread, on utilise la méthode {@link #setWaiting(boolean)} - * + * @author tchemit <chemit@codelutin.com> * @param <E> le type des etapes * @param <M> le type de modele * @param <A> le type d'action d'operation - * - * @author tony * @since 1.3 */ public abstract class WizardOperationActionThread<E extends WizardOperationStep, M extends WizardOperationModel<E>, A extends WizardOperationAction<E, M>> extends Thread implements PropertyChangeListener { /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(WizardOperationActionThread.class); - /** - * l'état du thread si annulé - */ + + /** l'état du thread si annulé */ private boolean canceled; + protected Class<M> modelClass; + protected A currentAction; + /** - * un lock pour permettre la suspension et la reprise du thread - * lors du mode interactif. + * un lock pour permettre la suspension et la reprise du thread lors du mode + * interactif. */ private final Object LOCK = new Object(); @@ -70,11 +73,11 @@ public void cancel() { log.info("cancel " + this); - this.canceled = true; - + canceled = true; + // on annule le modele getModel().cancel(); - + // on rend la main au thread setWaiting(false); } @@ -179,10 +182,7 @@ } } - /** - * La méthode pour nettoyer le thread, a la fermeture. - * - */ + /** La méthode pour nettoyer le thread, a la fermeture. */ protected void close() { // par defaut, on ne fait rien log.trace(this); Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,53 +20,47 @@ */ package jaxx.runtime.swing.wizard; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; -import java.util.Set; import javax.swing.SwingWorker.StateValue; +import java.util.*; /** * Un modèle de wizard avec des opérations. * + * @author tchemit <chemit@codelutin.com> * @param <E> le type des étapes. - * @author tony * @since 1.3 */ public class WizardOperationModel<E extends WizardOperationStep> extends WizardModel<E> { public static final String OPERATIONS_PROPERTY_NAME = "operations"; + public static final String OPERATION_STATE_PROPERTY_NAME = "operationState"; + public static final String MODEL_STATE_PROPERTY_NAME = "modelState"; + public static final String WAS_STARTED_PROPERTY_NAME = "wasStarted"; - /** - * La liste des opérations à effectuer - */ + /** La liste des opérations à effectuer */ protected Set<E> operations; - /** - * Pour conserver les états des opérations - */ + + /** Pour conserver les états des opérations */ protected Map<E, WizardOperationState> operationStates; - protected Map<E, WizardOperationAction> operationActions; - /** - * L'état générale du modèle - */ + + protected Map<E, WizardOperationAction<E, ? extends WizardOperationModel<E>>> operationActions; + + /** L'état générale du modèle */ protected WizardOperationState modelState; - /** - * un drapeau pour savoir siune opération a été lancée - */ + + /** un drapeau pour savoir siune opération a été lancée */ protected boolean wasStarted; @SuppressWarnings("unchecked") public <T extends Enum<T>> WizardOperationModel(Class<E> stepClass, E... steps) { super(stepClass, steps); - Class<T> k = (Class) stepClass; - this.operationStates = (Map) new EnumMap(k); - this.operations = (Set<E>) EnumSet.noneOf(k); - this.operationActions = (Map) new EnumMap(k); + Class<T> k = (Class<T>) stepClass; + operationStates = new EnumMap(k); + operations = (Set<E>) EnumSet.noneOf(k); + operationActions = new EnumMap(k); } public Set<E> getOperations() { @@ -95,11 +89,11 @@ return operationStates.get(operation); } - public WizardOperationAction getOperationAction(E operation) { - WizardOperationAction action = operationActions.get(operation); + public WizardOperationAction<E, ? extends WizardOperationModel<E>> getOperationAction(E operation) { + WizardOperationAction<E, ? extends WizardOperationModel<E>> action = operationActions.get(operation); if (action == null) { try { - action = operation.getActionClass().newInstance(); + action = (WizardOperationAction<E, ? extends WizardOperationModel<E>>) operation.getActionClass().newInstance(); operationActions.put(operation, action); } catch (Exception ex) { throw new RuntimeException(ex); @@ -115,7 +109,7 @@ public void setOperationState(E operation, WizardOperationState operationState) { WizardOperationState oldValue = getOperationState(operation); - this.operationStates.put(operation, operationState); + operationStates.put(operation, operationState); fireIndexedPropertyChange(OPERATION_STATE_PROPERTY_NAME, getSteps().indexOf(operation), oldValue, operationState); updateModelState(operation, operationState); validate(); @@ -136,9 +130,9 @@ // uniquement si l'onglet precedent est accessible, valide et son etat est a SUCCESSED E previousStep = steps.get(i - 1); result[i] = modelState == WizardOperationState.SUCCESSED || - (result[i - 1] && - validate(previousStep) && - (!previousStep.isOperation() || getOperationState(previousStep) == WizardOperationState.SUCCESSED)); + result[i - 1] && + validate(previousStep) && + (!previousStep.isOperation() || getOperationState(previousStep) == WizardOperationState.SUCCESSED); } } //System.out.println("accessibles steps -------- " + java.util.Arrays.toString(result)); @@ -165,10 +159,9 @@ } setModelState(WizardOperationState.CANCELED); if (getStep() != null && getStep().isOperation()) { - WizardOperationAction action = getOperationAction(getStep()); + WizardOperationAction<E, ? extends WizardOperationModel<E>> action = getOperationAction(getStep()); if (action != null) { if (!action.isCancelled() && !action.isDone() && action.getState() == StateValue.STARTED) { - System.out.println("cancel action " + action); // on annule l'action action.cancel(true); } @@ -210,9 +203,9 @@ firePropertyChange(MODEL_STATE_PROPERTY_NAME, null, modelState); } - public WizardOperationAction reloadOperation(E operation) { + public WizardOperationAction<E, ? extends WizardOperationModel<E>> reloadOperation(E operation) { operationActions.remove(operation); - WizardOperationAction newOp = getOperationAction(operation); + WizardOperationAction<E, ? extends WizardOperationModel<E>> newOp = getOperationAction(operation); return newOp; } @@ -222,7 +215,7 @@ firePropertyChange(MODEL_STATE_PROPERTY_NAME, oldValue, modelState); if (!wasStarted) { if ((oldValue == null || oldValue == WizardOperationState.PENDING) && modelState == WizardOperationState.RUNNING) { - this.wasStarted = true; + wasStarted = true; firePropertyChange(WAS_STARTED_PROPERTY_NAME, false, true); } } @@ -279,7 +272,7 @@ protected int getOperationIndex(E operation) { int index = 0; for (E o : operations) { - if (operation == o) { + if (o.equals(operation)) { return index; } index++; Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -22,31 +22,26 @@ /** * Pour caractériser l'état d'une opération. + * + * @author tchemit <chemit@codelutin.com> */ public enum WizardOperationState { - /** - * quand l'opération n'a pas encore été réalisée - */ + /** quand l'opération n'a pas encore été réalisée */ PENDING, - /** - * quand l'opération est en cours - */ + + /** quand l'opération est en cours */ RUNNING, - /** - * quand l'opération est annulé en cours d'exécution - */ + + /** quand l'opération est annulé en cours d'exécution */ CANCELED, - /** - * quand une erreur s'est produite pendant l'exécution - */ + + /** quand une erreur s'est produite pendant l'exécution */ FAILED, - /** - * quand l'exécution s'est terminée mais requière des corrections - */ + + /** quand l'exécution s'est terminée mais requière des corrections */ NEED_FIX, - /** - * quand l'exécution s'est terminée et ne requière pas de correction - */ + + /** quand l'exécution s'est terminée et ne requière pas de correction */ SUCCESSED } Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -21,30 +21,25 @@ package jaxx.runtime.swing.wizard; /** - * * Le contrat a implanter pour une etapes dans le modèle de wizard avec * opérations. - * - * @author tony + * + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public interface WizardOperationStep extends WizardStep { - /** - * @return le label de l'opération - */ + /** @return le label de l'opération */ String getOperationLabel(); - /** - * @return la description de l'opération - */ + /** @return la description de l'opération */ String getOperationDescription(); /** * @return le type de l'action associée à l'étape ou <code>null</code> si * l'étape n'a pas d'opération associée. */ - Class<? extends WizardOperationAction> getActionClass(); + Class<? extends WizardOperationAction<?, ?>> getActionClass(); /** * @return <code>true</code> si l'étape a une opération associée, Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -24,8 +24,8 @@ /** * le contrat d'une étape d'un wizard. - * - * @author tony + * + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public interface WizardStep extends Serializable { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -23,9 +23,9 @@ /** * Le contrat d'une ui d'étape. * + * @author tchemit <chemit@codelutin.com> * @param <E> le type d'étape * @param <M> le type de modèle - * @author tony * @since 1.3 */ public interface WizardStepUI<E extends WizardStep, M extends WizardModel<E>> { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,71 +20,56 @@ */ package jaxx.runtime.swing.wizard; -import javax.swing.JTabbedPane; +import javax.swing.*; /** - * * Contrat a respecter pour une ui de wizard. - * + * + * @author tchemit <chemit@codelutin.com> * @param <E> le type d'etape * @param <M> le type de model - * - * @author tony * @since 1.3 */ public interface WizardUI<E extends WizardStep, M extends WizardModel<E>> { - /** - * @return le modèle de wizard - */ + /** @return le modèle de wizard */ M getModel(); - /** - * - * @return l'étape courante - */ + /** @return l'étape courante */ E getSelectedStep(); - /** - * - * @return l'ui de l'étape courante - */ + /** @return l'ui de l'étape courante */ WizardStepUI<E, M> getSelectedStepUI(); /** - * * @param step l'étape donnée * @return l'ui de l'étape donnée */ WizardStepUI<E, M> getStepUI(E step); /** - * * @param stepIndex la position de l'étape * @return l'ui de l'étape donée */ WizardStepUI<E, M> getStepUI(int stepIndex); - /** - * démarre le wizard - */ + /** démarre le wizard */ void start(); /** * //TODO il faudrait supprimer cette méthode + * * @return le conteneur d'ui d'étapes */ JTabbedPane getTabs(); - /** - * Méthode invoqué lorsque la première opération du modèlé a été démarrée. - */ + /** Méthode invoqué lorsque la première opération du modèlé a été démarrée. */ void onWasStarted(); - + /** * Méthode invoquée lorsque l'univers des étapes a été modifié dans le * modèle. - * + * * @param steps les nouvelles étapes */ void onStepsChanged(E[] steps); @@ -106,9 +91,9 @@ /** * Méthode invoqué lorsque l'état d'une opération a changé. * - * @param step l'étape dont l'état a changé + * @param step l'étape dont l'état a changé * @param newState le nouvel état pour l'étape donné */ - void onOperationStateChanged(E step,WizardOperationState newState) ; + void onOperationStateChanged(E step, WizardOperationState newState); } Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,48 +20,82 @@ */ package jaxx.runtime.swing.wizard; -import java.awt.Window; -import javax.swing.ImageIcon; import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; import jaxx.runtime.context.JAXXInitialContext; -import jaxx.runtime.JAXXObject; import org.apache.commons.beanutils.ConstructorUtils; +import javax.swing.*; +import java.awt.*; + /** - * * Une classe pour lancer une ui de wizard. * + * @author tchemit <chemit@codelutin.com> * @param <E> le type des etapes * @param <M> le type de modele * @param <UI> le type d'ui - * @author tony * @since 1.3 */ public abstract class WizardUILancher<E extends WizardStep, M extends WizardModel<E>, UI extends WizardUI<E, M>> { protected UI ui; - public WizardUILancher(JAXXContext context, Class<UI> uiClass, Class<M> modelClass, String title, String tip, ImageIcon icon) { + public WizardUILancher(JAXXContext context, + Class<UI> uiClass, + Class<M> modelClass, + String title, + String tip, + ImageIcon icon) { this(context, uiClass, modelClass, null, title, tip, icon); } - public WizardUILancher(JAXXContext context, Class<UI> uiClass, Class<M> modelClass, M model, String title, String tip, ImageIcon icon) { + public WizardUILancher(JAXXContext context, + Class<UI> uiClass, + Class<M> modelClass, + M model, + String title, + String tip, + ImageIcon icon) { try { - ui = createUI(context, uiClass, modelClass, model, title, tip, icon); + ui = createUI(context, + uiClass, + modelClass, + model, + title, + tip, + icon + ); } catch (Exception ex) { - throw new RuntimeException("could not instanciate launcher for reason " + ex.getMessage(), ex); + throw new RuntimeException( + "could not instanciate launcher for reason " + + ex.getMessage(), ex); } } - public WizardUILancher(JAXXContext context, Window mainUI, Class<UI> uiClass, Class<M> modelClass, M model) { + public WizardUILancher(JAXXContext context, + Window mainUI, + Class<UI> uiClass, + Class<M> modelClass, + M model) { try { - ui = createUI(context, mainUI, uiClass, modelClass, model); + ui = createUI(context, + mainUI, + uiClass, + modelClass, + model + ); } catch (Exception ex) { - throw new RuntimeException("could not instanciate launcher for reason " + ex.getMessage(), ex); + throw new RuntimeException( + "could not instanciate launcher for reason " + + ex.getMessage(), ex); } } - public WizardUILancher(JAXXContext context, Window mainUI, Class<UI> uiClass, Class<M> modelClass) { + public WizardUILancher(JAXXContext context, + Window mainUI, + Class<UI> uiClass, + Class<M> modelClass) { this(context, mainUI, uiClass, modelClass, null); } @@ -102,7 +136,11 @@ } @SuppressWarnings("unchecked") - protected UI createUI(JAXXContext context, Window mainUI, Class<UI> uiClass, Class<M> modelClass, M model) throws Exception { + protected UI createUI(JAXXContext context, + Window mainUI, + Class<UI> uiClass, + Class<M> modelClass, + M model) throws Exception { JAXXInitialContext uiContext = new JAXXInitialContext(); uiContext.add(mainUI == null ? context : mainUI); // parent context model @@ -137,12 +175,22 @@ // instanciate ui - UI newUI = (UI) ConstructorUtils.invokeConstructor(uiClass, new Object[]{mainUI, uiContext}, new Class[]{Window.class, JAXXContext.class}); + UI newUI = (UI) ConstructorUtils.invokeConstructor( + uiClass, + new Object[]{mainUI, uiContext}, + new Class[]{Window.class, JAXXContext.class} + ); return newUI; } @SuppressWarnings("unchecked") - protected UI createUI(JAXXContext context, Class<UI> uiClass, Class<M> modelClass, M model, String title, String tip, ImageIcon icon) throws Exception { + protected UI createUI(JAXXContext context, + Class<UI> uiClass, + Class<M> modelClass, + M model, + String title, + String tip, + ImageIcon icon) throws Exception { JAXXInitialContext uiContext = new JAXXInitialContext(); uiContext.add(context); // parent context model @@ -176,7 +224,16 @@ }); // instanciate ui - UI newUI = (UI) ConstructorUtils.invokeConstructor(uiClass, new Object[]{uiContext, title, tip, icon}, new Class[]{JAXXContext.class, String.class, String.class, ImageIcon.class}); + UI newUI = (UI) ConstructorUtils.invokeConstructor( + uiClass, + new Object[]{uiContext, title, tip, icon}, + new Class[]{ + JAXXContext.class, + String.class, + String.class, + ImageIcon.class + } + ); return newUI; } } Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -20,22 +20,23 @@ */ package jaxx.runtime.swing.wizard; -import java.awt.Component; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.awt.*; import java.beans.IndexedPropertyChangeEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Array; import java.util.List; -import javax.swing.JTabbedPane; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import static org.nuiton.i18n.I18n._; /** * Classe de méthodes utiles sur les wizard. * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public class WizardUtil { @@ -139,14 +140,14 @@ /** * Ajoute un listener sur le modele pour gere la politique d'affichage des * onglets. + * <p/> + * Dans cette implantation, les onglets sont ouverts jusqu'a l'etape + * courante. Lorsque l'on revient en arrière, les onglets d'etapes + * superieurs sont fermes. * - * Dans cette implantation, les onglets sont ouverts jusqu'a l'etape courante. - * Lorsque l'on revient en arrière, les onglets d'etapes superieurs sont - * fermes. - * * @param <E> le type d'un etape de l'assistant * @param <M> le type du modele de l'assistant - * @param ui l'ui de l'assitant + * @param ui l'ui de l'assitant * @since 1.7.1 */ public static <E extends WizardStep, M extends WizardModel<E>> void addTabsDisplayUntilStepListener(final WizardUI<E, M> ui) { Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html 2010-03-18 21:42:47 UTC (rev 1795) @@ -1,9 +1,9 @@ <html> - <body> - <h1>JAXX - Wizard framework</h1> - - This package contains all the classes of the wizard framework. +<body> +<h1>JAXX - Wizard framework</h1> - TODO - </body> -</html> \ No newline at end of file +This package contains all the classes of the wizard framework. + +TODO +</body> +</html> Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -33,7 +33,7 @@ * Extends {@link FieldExpressionValidator} to add some extra parameters available * in the {@link #getExpression()} * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public class FieldExpressionWithParamsValidator extends FieldExpressionValidator { Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java =================================================================== --- trunk/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -31,7 +31,7 @@ /** * - * @author tony + * @author tchemit <chemit@codelutin.com> */ public class DefaultApplicationContextTest { Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java =================================================================== --- trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -30,7 +30,7 @@ /** * - * @author tony + * @author tchemit <chemit@codelutin.com> */ public class BeanValidatorTest { @@ -215,4 +215,4 @@ } } } -} \ No newline at end of file +} Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java =================================================================== --- trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -29,7 +29,7 @@ /** * - * @author tony + * @author tchemit <chemit@codelutin.com> * @since 1.3 */ public class XWorkBeanValidatorTest { @@ -173,4 +173,4 @@ // error was not found Assert.assertFalse(required); } -} \ No newline at end of file +} Modified: trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java =================================================================== --- trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java 2010-03-18 21:15:02 UTC (rev 1794) +++ trunk/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java 2010-03-18 21:42:47 UTC (rev 1795) @@ -25,7 +25,7 @@ /** * - * @author tony + * @author tchemit <chemit@codelutin.com> */ public class FieldExpressionBean {