Author: tchemit Date: 2008-04-27 08:28:26 +0000 (Sun, 27 Apr 2008) New Revision: 629 Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java Log: introduction ui Identity (pour les param?\195?\168tre perso de l'utilisateur (nom prenom email) suppression de l'ui de config debut de l'ui de configuration des VCSRoots introduction ui de test Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java =================================================================== --- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:28:17 UTC (rev 628) +++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:28:26 UTC (rev 629) @@ -16,12 +16,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.ui.DialogUIDef; import org.codelutin.vcs.ui.UIActionHelper; import org.codelutin.vcs.ui.VCSUIFactory; import org.codelutin.vcs.ui.model.SynchUIModel; +import org.codelutin.vcs.ui.model.TestUIModel; import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; import java.io.File; import java.io.IOException; import java.util.List; @@ -33,28 +35,62 @@ public static void main(String[] args) throws Exception { + final RepositoryGenerator generator = new RepositoryGenerator(); - RepositoryGenerator generator = new RepositoryGenerator(); + final VCSConnexion connexion = initMockVCS(generator, 10, 5, 10, 1024); - VCSConnexion connexion = initMockVCS(generator, 10, 5, 10, 1024); + connexion.open(); - VCSEntry[] entries = initModel(generator, connexion); + final TestUIModel firstModel = initModel(connexion); + + firstModel.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equals(TestUIModel.PREPARE_UI_PROPERTY_CHANGED)) { + DialogUIDef uiDef = (DialogUIDef) evt.getNewValue(); + TestUIModel model = (TestUIModel) evt.getOldValue(); + // show ui + if (uiDef == VCSUIFactory.IDENTITY_UI) { + log.info("show first launch ui "+firstModel.getIdentity()); + return; + } + if (uiDef == VCSUIFactory.CONFIG_UI) { + log.info("show config ui"); + return; + } + if (uiDef == VCSUIFactory.SYNCH_UI) { + log.info("show synch ui"); + generator.generateStates(model.getEntries()); + return; + } + return; + } + if (evt.getPropertyName().equals(TestUIModel.SHOW_UI_PROPERTY_CHANGED)) { + + return; + } + + throw new IllegalStateException("unknown property changed " + evt); + } + }); initUI(generator, connexion); - UIActionHelper.showSynchUI(connexion.getConfig(), null, VCSEntryLocation.ALL, entries); - + UIActionHelper.showTestUI(firstModel, null); } - protected static VCSEntry[] initModel(RepositoryGenerator generator, VCSConnexion connexion) throws VCSException { + protected static TestUIModel initModel(VCSConnexion connexion) throws VCSException { - connexion.open(); - SynchUIModel model = new SynchUIModel(); model.populate(connexion); - generator.generateStates(model.getEntriesModel()); List<VCSEntry> entries = model.getEntriesModel().getEntries(); - return entries.toArray(new VCSEntry[entries.size()]); + VCSEntry[] entries1 = entries.toArray(new VCSEntry[entries.size()]); + //generator.generateStates(entries1); + MockIdentity src = new MockIdentity("email@dot.com", "firstname", "lastname"); + TestUIModel _model = new TestUIModel(); + _model.setConnexion(connexion); + _model.setEntries(entries1); + _model.setIdentity(src); + return _model; } public static VCSConnexion initMockVCS(final RepositoryGenerator generator, int i, int i1, int i2, int i3) throws IOException { @@ -85,4 +121,46 @@ }); } + + public static class MockIdentity implements java.io.Serializable { + protected String firstname; + protected String lastname; + protected String email; + + private static final long serialVersionUID = 1L; + + public MockIdentity(String email, String firstname, String lastname) { + this.email = email; + this.firstname = firstname; + this.lastname = lastname; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String toString() { + return super.toString()+", firstname:"+firstname+", lastname:"+lastname+", email:"+email; + } + } } \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org