Author: tchemit Date: 2008-04-11 02:51:22 +0000 (Fri, 11 Apr 2008) New Revision: 444 Added: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionQueueItem.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/DiffUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/SynchUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/VCSEntriesTableRenderer.java trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/META-INF/services/org.codelutin.vcs.ui.VCSUIProvider trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/vcs-jaxx.rules trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css Removed: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractUI.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/UIHelper.java trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSPopup.jaxx trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNEventLoggerHandler.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/VCSRevisionImpl.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java trunk/lutinvcs/lutinvcs-ui-jaxx/pom.xml Log: licences + improve ui design Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-11 02:51:22 UTC (rev 444) @@ -40,7 +40,7 @@ * init working copy, says if it is the first we use it it, we will checkout * the databaseDirectory directory * - * @throws org.codelutin.vcs.VCSException if any exception while init + * @throws VCSException if any exception while init */ void initWorkingCopy() throws VCSException; @@ -87,7 +87,7 @@ * @param file file to test * @return <code>true</code> if file is uptodate,<code>false</code> * otherwise. - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ boolean isUpToDate(File file) throws VCSException; @@ -104,10 +104,9 @@ * @param commitMessage commit message * @param dirNames names of the directories to create on remote repository (could * used multi-level directories) - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ - void makeRemoteDir(String commitMessage, String... dirNames) - throws VCSException; + void makeRemoteDir(String commitMessage, String... dirNames) throws VCSException; /** * delete on remote repository somes directories @@ -115,10 +114,9 @@ * @param commitMessage commit message * @param dirNames names of the directories to delete on remote repository (could * used multi-level directories) - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ - void deleteRemoteDir(String commitMessage, String... dirNames) - throws VCSException; + void deleteRemoteDir(String commitMessage, String... dirNames) throws VCSException; /** * add a list of files into repository @@ -127,7 +125,7 @@ * @param msg message for VCS commit, if <code>null</code> then no commit * is performed * @return revision of the operation - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ long add(List<File> files, String msg) throws VCSException; @@ -139,7 +137,7 @@ * @param files files to delete * @param msg message for VCS commit, if <code>null</code> then no commit * is performed - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ void delete(List<File> files, String msg) throws VCSException; @@ -147,7 +145,7 @@ * revert a list of files from repository * * @param files files to revert - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ void revert(List<File> files) throws VCSException; @@ -157,7 +155,7 @@ * @param files files to commit * @param msg message for VCS commit * @return revision of the operation - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ long commit(List<File> files, String msg) throws VCSException; @@ -166,7 +164,7 @@ * * @param file file to update * @param revision object representing a revision for the current VCS - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ void update(File file, Object revision) throws VCSException; @@ -174,7 +172,7 @@ * update a file to repository * * @param file file to update - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ void update(File file) throws VCSException; @@ -184,7 +182,7 @@ * @param destDir local file where to checkout * @param module module's name to checkout * @param recurse flag to say to recurse checkout or not. - * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws VCSException if any exception while operation */ void checkout(File destDir, String module, boolean recurse) throws VCSException; @@ -197,7 +195,7 @@ * * @param directory directory to treate * @return TODO - * @throws org.codelutin.vcs.VCSException TODO + * @throws VCSException TODO */ List<String> getRemoteStorageNames(File directory) throws VCSException; @@ -210,9 +208,22 @@ List<String> getLocalStorageNames(File directory); /** + * Build the list of all relatives paths from local and remote ones. + * <p/> + * Both lists must be <b>encoded with local path separator</b>. + * <p/> + * Note: <b>Be ware, the method modifies the two paramters lists.</b> + * + * @param localFiles list of location relative paths <b>encoded with local path separator</b> + * @param remoteFiles list of remote relative paths <b>encoded with local path separator</b> + * @return list of all relative paths. <b>encoded with local path separator</b> + */ + List<String> getAllStorageNames(List<String> localFiles, List<String> remoteFiles); + + /** * @param f local file to treate * @return current local revision of a file - * @throws org.codelutin.vcs.VCSException TODO + * @throws VCSException TODO */ Object getRevision(File f) throws VCSException; @@ -223,7 +234,7 @@ * @param endRevision TODO * @param file file to treate * @return list of log entries for this file between two revisions - * @throws org.codelutin.vcs.VCSException if any exception while grabbing infos + * @throws VCSException if any exception while grabbing infos */ List getLog(Object startRevision, Object endRevision, File file) throws VCSException; @@ -235,8 +246,8 @@ * @param revision revision treated * @return the content of the file on repository for the specific revision * passed as arguement. - * @throws org.codelutin.vcs.VCSException if any exception while operation - * @throws java.io.IOException TODO + * @throws VCSException if any exception while operation + * @throws IOException if io problem with streams */ String getFileContent(File file, Object revision) throws VCSException, IOException; @@ -253,9 +264,8 @@ * </ul> * * @param file file to treate - * @return a string representation of change log for the local file to the - * head ? - * @throws org.codelutin.vcs.VCSException if any exception while building changelog + * @return a string representation of change log for the local file to the head ? + * @throws VCSException if any exception while building changelog */ String getChangeLog(File file) throws VCSException; @@ -266,14 +276,14 @@ * * @param file the file to treate * @return the diff - * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : - * <ul> - * <li>unversionned file</li> - * <li>unexistant file locally</li> - * <li>locally modified file ?</li> - * <li>...</li> - * </ul> - * @throws java.io.IOException if io problem with streams + * @throws VCSException if any exception while building diff, such as : + * <ul> + * <li>unversionned file</li> + * <li>unexistant file locally</li> + * <li>locally modified file ?</li> + * <li>...</li> + * </ul> + * @throws IOException if io problem with streams */ String getDiff(File file) throws VCSException, IOException; @@ -287,14 +297,14 @@ * @param file the file to treate * @param againstRevision the against revision to use * @return the diff - * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : - * <ul> - * <li>unversionned file</li> - * <li>unexistant file locally</li> - * <li>locally modified file ?</li> - * <li>...</li> - * </ul> - * @throws java.io.IOException if problem with streams + * @throws VCSException if any exception while building diff, such as : + * <ul> + * <li>unversionned file</li> + * <li>unexistant file locally</li> + * <li>locally modified file ?</li> + * <li>...</li> + * </ul> + * @throws IOException if io problem with streams */ String getDiff(File file, Object againstRevision) throws VCSException, IOException; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; @@ -29,7 +29,8 @@ public interface VCSEntries { /** - * Discover and Populate with all local and remote entries. + * Discover and Populate with all local and remote entries, this is a convinient method that should always + * call {@link #populate(VCSConnexion, long,VCSEntryLocation)} with {@link VCSEntryLocation#ALL} as location. * * @param timestamp gloabal timestamp to apply * @param connexion connexion used to populate @@ -38,17 +39,27 @@ void populate(VCSConnexion connexion, long timestamp) throws VCSException; /** + * Discover and Populate with all local and remote entries for a given location. + * + * @param timestamp gloabal timestamp to apply + * @param location location to be used + * @param connexion connexion used to populate + * @throws VCSException if any pb with vcs io + */ + void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location) throws VCSException; + + /** * Populate with no discovering for a given list of local relative paths for a given location type. * <p/> * Note : <b>We always used the filesystem path separator to encode paths.</b> * + * @param connexion connexion used tro refresh + * @param timestamp gloabal timestamp to apply + * @param location location to be used * @param relativeLocalPaths list of local relative path to populate - * @param location location to be used - * @param timestamp gloabal timestamp to apply - * @param connexion connexion used tro refresh * @throws VCSException if any pb with vcs io */ - void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException; + void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location, List<String> relativeLocalPaths) throws VCSException; /** * Populate from pre-computed entries. No discovering is done, nor vcs io operations. @@ -61,11 +72,11 @@ /** * refresh state of the entry. * + * @param timestamp global timestamp to apply * @param entries entries to refresh - * @param timestamp global timestamp to apply * @throws IllegalStateException if entry was never populated */ - void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException; + void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException; /** * obtain the array of all {@link VCSAction} found in the given entries @@ -107,10 +118,9 @@ * obtain the list of all entries for a given location * * @param location filter location - * @param entries entries to filter * @return list of all entries for a given connexion */ - List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries); + List<VCSEntry> filter(VCSEntryLocation location); /** * obtain the list of all entries for a given state Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; @@ -20,33 +20,68 @@ import java.io.BufferedReader; import java.io.File; +import java.io.IOException; import java.io.Serializable; /** - * Contract of an entry in VCS (a file or a dir) + * Contract of an entry in VCS (a file or a dir). + * <p/> + * Only <code>populate-like,refresh-like and setState</code> methods can modify internal states of the object. * * @author chemit */ public interface VCSEntry extends Serializable { /** - * Populate the state of the entry, this method calls {@link #refresh(long)} method. + * Populate the state of the entry, this method calls {@link #refreshState(long)} method. + * <p/> + * Note: <b>Will modify internal states</b> * * @param timestamp gloabal timestamp to apply - * @throws VCSException if anypb with vcs io + * @throws VCSException if any pb with vcs io */ - void populate(long timestamp) throws VCSException; + void populateState(long timestamp) throws VCSException; /** + * Populate the changelog of the entry. + * <p/> + * Note: <b>Will modify internal states</b> + * + * @throws VCSException if any pb with vcs io + * @throws IllegalStateException if entry was never populated + */ + void populateChangeLog() throws IllegalStateException, VCSException; + + /** + * Populate the diff of the entry. + * <p/> + * Note: <b>Will modify internal states</b> + * + * @throws VCSException if any pb with vcs io + * @throws IllegalStateException if entry was never populated + * @throws java.io.IOException if io pb + */ + void populateDiff() throws IllegalStateException, VCSException, IOException; + + /** * refresh state of the entry. + * <p/> + * Note: <b>Will modify internal states</b> * * @param timestamp global timestamp to apply * @throws IllegalStateException if entry was never populated * @throws VCSException if anypb with vcs io */ - void refresh(long timestamp) throws IllegalStateException, VCSException; + void refreshState(long timestamp) throws IllegalStateException, VCSException; /** + * Note: <b>Will modify internal states</b> + * + * @param state the new state of entry + */ + void setState(VCSState state); + + /** * Obtain the relative path from root repository to the entry. * <p/> * Note: <b>We use the filesystem path separator, could not be the same on remote</b> @@ -125,8 +160,6 @@ */ BufferedReader getRemoteContent() throws IllegalStateException; - void setState(VCSState state); - /** @param l the listener to add */ void addVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l); Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-11 02:51:22 UTC (rev 444) @@ -80,10 +80,9 @@ public static VCSConnexion newConnexion(VCSConnexionMode mode, VCSConnexionConfig config) { VCSFactory factory = getInstance(); - VCSProvider<?, ?> provider; // obtain matching provider - provider = factory.getProvider(config.getType().toUpperCase()); + VCSProvider<?, ?> provider = factory.getProvider(config.getType().toUpperCase()); // delegate instanciation of connexion to provider VCSConnexion connexion = provider.newConnection(mode, config); @@ -93,6 +92,7 @@ // register connexion connexion.addVCSConnexionEventListener(factory); + return connexion; } @@ -121,10 +121,14 @@ public void onConnexionClosed(VCSConnexionEvent event) { // remove connexion from active - connexions.remove(event.getSource()); + VCSConnexion connexion = event.getSource(); + connexions.remove(connexion); + // clean this connexion from action manager + getActionManager().close(connexion); + if (connexions.isEmpty()) { - // close actionManager ? - getActionManager().close(); + // close actionManager for real + getActionManager().close(null); } } Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.event; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,19 +10,23 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.event; /** - * A listener on {@link org.codelutin.vcs.VCSConnexion} life cycle + * A listener on {@link org.codelutin.vcs.VCSConnexion} life cycle. + * <p/> + * A {@link org.codelutin.vcs.VCSConnexion} has two life cycle states : + * <ul><li><code>OPEN</code>, when a connexion was successfull opened,</li> + * <li><code>CLOSE</code>, when a connexion was successfull closed (need to be opened before).</li></ul> * * @author chemit */ public interface VCSConnexionEventListener extends java.util.EventListener { /** - * call when vcs connexion was successfull open + * call when vcs connexion was successfull opened * * @param event current event */ Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEvent.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.event; @@ -28,18 +28,21 @@ private static final long serialVersionUID = 1L; - protected VCSState state; + protected VCSState oldState; + protected VCSState newState; /** * Constructs a prototypical Event. * - * @param source The object on which the Event initially occurred. - * @param type type of event + * @param source The object on which the Event initially occurred. + * @param oldState old state of the entry + * @param newState new state of event * @throws IllegalArgumentException if source is null. */ - public VCSEntryStateChangedEvent(VCSEntry source, VCSState type) { + public VCSEntryStateChangedEvent(VCSEntry source, VCSState oldState, VCSState newState) { super(source); - this.state = type; + this.oldState = oldState; + this.newState = newState; } @Override @@ -47,7 +50,11 @@ return (VCSEntry) super.getSource(); } - public VCSState getState() { - return state; + public VCSState getOldState() { + return oldState; } + + public VCSState getNewState() { + return newState; + } } \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/event/VCSEntryStateChangedEventListener.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.event; @@ -18,42 +18,57 @@ /** * A listener on state of a {@link org.codelutin.vcs.VCSEntry}. + * <p/> + * This listener reacts on every change of state of a {@link org.codelutin.vcs.VCSEntry}, locally and remotely. + * <p/> + * This listener can be used on UIs to update the render of an entry from his state. * * @author chemit */ public interface VCSEntryStateChangedEventListener extends java.util.EventListener { /** - * call when entry was added on local repository (correspond to {@link VCSState#UNVERSIONNED} + * call when entry's state becomes {@link VCSState#UNVERSIONNED} : + * <p/> + * entry was added on local repository, or removed from remote repository. * * @param event current event */ public void onAdded(VCSEntryStateChangedEvent event); /** - * call when entry was modified on local repository (correspond to {@link VCSState#MODIFIED} + * call when entry's state becomes {@link VCSState#MODIFIED} : + * <p/> + * entry was localy modified. * * @param event current event */ public void onModified(VCSEntryStateChangedEvent event); /** - * call when entry is obsolete on local repository (correspond to - * {@link VCSState#OUT_OF_DATE_AND_MODIFIED} or {@link VCSState#OUT_OF_DATE} + * call when entry's state becomes {@link VCSState#OUT_OF_DATE_AND_MODIFIED} or {@link VCSState#OUT_OF_DATE} : + * <p/> + * entry is obsolete on local. + * <p/> + * Note: <b>if entry was locally modified, and just has a new version of remote, this method will also be invoked.</b> * * @param event current event */ - public void onObseleted(VCSEntryStateChangedEvent event); + public void onObsoleted(VCSEntryStateChangedEvent event); /** - * call when entry was deleted on local repository (corresponds to {@link VCSState#MISSING} + * call when entry's state becomes {@link VCSState#MISSING} : + * <p/> + * entry was remotely deleted. * * @param event current event */ public void onDeleted(VCSEntryStateChangedEvent event); /** - * call when entry was updated, commit, revert,...(corresponds to {@link VCSState#UP_TO_DATE} + * call when entry's state becomes {@link VCSState#UP_TO_DATE} : + * <p/> + * entry was just updated, or rollbacked, or checkouted... * * @param event current event */ Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionManager.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,39 +10,44 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.runner; -import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.VCSConnexion; import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; import java.util.concurrent.PriorityBlockingQueue; /** - * Manager used to fired vcs actions + * Manager used to fire actions on entries. * <p/> * use a {@link org.codelutin.vcs.runner.VCSActionThread}. * * @author chemit + * @see org.codelutin.vcs.runner.VCSActionQueueItem + * @see org.codelutin.vcs.type.VCSAction + * @see org.codelutin.vcs.runner.VCSActionThread + * @see org.codelutin.vcs.VCSEntry */ public class VCSActionManager { /** special item to add in queue to stop the thread */ - protected static final QueueItem STOP_ITEM = new QueueItem(null, new VCSEntry[0], null); + protected static final VCSActionQueueItem STOP_VCS_ACTION = new VCSActionQueueItem(null, new VCSEntry[0], null); /** vcs actions runner thread */ protected VCSActionThread thread; - /** queue */ - protected PriorityBlockingQueue<QueueItem> queue; + /** queue of actions to treate on entries */ + protected PriorityBlockingQueue<VCSActionQueueItem> queue; public VCSActionManager() { - queue = new PriorityBlockingQueue<QueueItem>(1024); + queue = new PriorityBlockingQueue<VCSActionQueueItem>(1024); } - public boolean add(VCSAction action, VCSEntry[] states, String message) { - QueueItem queueItem = new QueueItem(action, states, message); + public boolean add(VCSAction action, VCSEntry[] entries, String message) { + VCSActionQueueItem queueItem = new VCSActionQueueItem(action, entries, message); return queue.add(queueItem); } @@ -54,60 +59,18 @@ (thread = new VCSActionThread(queue)).start(); } - public void close() { - if (!queue.isEmpty()) { - queue.clear(); + public void close(VCSConnexion connexion) { + if (connexion == null) { + // means close all + if (!queue.isEmpty()) { + queue.clear(); + } + queue.add(VCSActionManager.STOP_VCS_ACTION); + // remove thread reference: threas was stopped, and can not be any longer restart... + thread = null; + } else { + //TODO should clean only entries with this connexion } - queue.add(VCSActionManager.STOP_ITEM); - // remove thread reference: threas was stopped, and can not be any longer restart... - thread = null; } - /** @author chemit */ - public static class QueueItem implements Comparable<QueueItem> { - - protected long time; - - protected VCSEntry[] entries; - protected VCSAction action; - protected String message; - - public QueueItem(VCSAction action, VCSEntry[] entries, String message) { - this.time = System.nanoTime(); - this.entries = entries; - this.action = action; - this.message = message; - } - - public VCSAction getAction() { - return action; - } - - public VCSEntry[] getEntries() { - return entries; - } - - public String getMessage() { - return message; - } - - @Override - public boolean equals(Object o) { - return this == o || o instanceof QueueItem && time == ((QueueItem) o).time; - } - - @Override - public int hashCode() { - return (int) (time ^ (time >>> 32)); - } - - @Override - public String toString() { - return super.toString() + ", time:" + time + ", action:" + action + ", size:" + (entries == null ? 0 : entries.length); - } - - public int compareTo(QueueItem o) { - return time == o.time ? 0 : time > o.time ? 1 : -1; - } - } } Added: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionQueueItem.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionQueueItem.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionQueueItem.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,147 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.runner; + +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This class is a container for an {@link VCSAction} to be realized on one or more {@link VCSEntry}. + * <p/> + * The class has 4 properties : + * <ul> + * <li>{@link #timestamp} : the {@link Comparable} property to be used (unique id)</li> + * <li>{@link #action} : the action to realized on {@link #entries}</li> + * <li>{@link #entries} : the entries to be treated</li> + * <li>{@link #message} : an optional commit message to be applied if action is an commit-like action + * (see {@link org.codelutin.vcs.type.VCSAction#isCommit()}) </li> + * </ul> + * Note: No logic can be found here. + * + * @author chemit + */ +public class VCSActionQueueItem implements Comparable<VCSActionQueueItem> { + protected long timestamp; + protected VCSEntry[] entries; + protected VCSAction action; + protected String message; + + public VCSActionQueueItem(VCSAction action, VCSEntry[] entries, String message) { + this.timestamp = System.nanoTime(); + this.entries = entries; + this.action = action; + this.message = message; + } + + /** + * Obtain the action to be realized on all entries of the queue item + * + * @return the action to be realized on all entries of the queue item + */ + public VCSAction getAction() { + return action; + } + + /** + * Obtain the array of all entries of the queue item. + * + * @return the array of entries. + */ + public VCSEntry[] getEntries() { + return entries; + } + + /** + * Obtain the array of all {@link VCSConnexion} to be used by entries. + * + * @return the array of all connexions to be used by entries to realized action. + */ + public VCSConnexion[] getConnexions() { + List<VCSConnexion> result = new ArrayList<VCSConnexion>(); + for (VCSEntry entry : entries) { + if (!result.contains(entry.getConnexion())) { + result.add(entry.getConnexion()); + } + } + return result.toArray(new VCSConnexion[result.size()]); + } + + /** + * Obtain the array of entries using a given connexion. + * + * @param connexion the given connexion to filter + * @return the array of entries for a given connexion + */ + public VCSEntry[] getEntries(VCSConnexion connexion) { + List<VCSEntry> result = new ArrayList<VCSEntry>(); + for (VCSEntry entry : entries) { + if (entry.getConnexion().equals(connexion)) { + result.add(entry); + } + } + return result.toArray(new VCSEntry[result.size()]); + } + + /** + * Obtain the dictonnary of entries indexed by their connexion + * + * @return the map of array of entries indexed by their connexion + */ + public Map<VCSConnexion, VCSEntry[]> getEntriesByConnexion() { + Map<VCSConnexion, VCSEntry[]> result = new HashMap<VCSConnexion, VCSEntry[]>(); + + for (VCSConnexion connexion : getConnexions()) { + result.put(connexion, getEntries(connexion)); + } + return result; + } + + + public VCSEntry getEntry(int index) { + if (index < 0 || index > entries.length - 1) { + throw new IllegalArgumentException("index " + index + " out of bound for " + this); + } + return entries[index]; + } + + public String getMessage() { + return message; + } + + @Override + public boolean equals(Object o) { + return this == o || o instanceof VCSActionQueueItem && timestamp == ((VCSActionQueueItem) o).timestamp; + } + + @Override + public int hashCode() { + return (int) (timestamp ^ (timestamp >>> 32)); + } + + @Override + public String toString() { + return super.toString() + ", timestamp:" + timestamp + ", action:" + action + ", size:" + (entries == null ? 0 : entries.length); + } + + public int compareTo(VCSActionQueueItem o) { + return timestamp == o.timestamp ? 0 : timestamp > o.timestamp ? 1 : -1; + } +} Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,28 +10,45 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.runner; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import static org.codelutin.i18n.I18n._; +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSState; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.Map.Entry; import java.util.concurrent.BlockingQueue; /** @author chemit */ public class VCSActionThread extends Thread { + /** to notify when thread is busy or not */ + static public final String BUSY_STATE_PROPERTY_CHANGED = "thread.busy"; + /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(VCSActionThread.class); - /** queue */ - protected BlockingQueue<VCSActionManager.QueueItem> queue; + /** queue of items to be fired */ + protected BlockingQueue<VCSActionQueueItem> queue; - public VCSActionThread(BlockingQueue<VCSActionManager.QueueItem> queue) { + /** support for change properties support */ + protected PropertyChangeSupport changeSupport; + + public VCSActionThread(BlockingQueue<VCSActionQueueItem> queue) { super("VCSActionThread"); this.queue = queue; } @@ -40,17 +57,25 @@ public void run() { log.info("Start " + getName() + " at " + new Date()); boolean run = true; - VCSActionManager.QueueItem item = null; + VCSActionQueueItem item = null; try { while (run) { log.info("waiting for action..."); item = queue.take(); - if (item.getAction() == null) { - // this is a special case to stop thread - run = false; - continue; - } - doAction(item); + // acquire a first item, thread becomes busy TODO should synchronize thread + firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, false, true); + do { + if (item.getAction() == null) { + // this is a special case to stop thread + run = false; + continue; + } + doAction(item); + // take a new entry in queue, with no blocking + item = !queue.isEmpty() ? queue.take() : null; + } while (run && item != null); + // queue is empty, thread is no more busy + firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, true, false); } } catch (Throwable eee) { @@ -59,35 +84,133 @@ //TODO Deal with errors } } finally { + // notify queue is dead + firePropertyChange(BUSY_STATE_PROPERTY_CHANGED, null, false); log.info("Stop " + getName() + " at " + new Date()); } } - protected void doAction(VCSActionManager.QueueItem item) throws VCSException { - log.info(item); - //TODO - switch (item.getAction()) { + protected void doAction(VCSActionQueueItem item) throws VCSException, IOException { + for (Entry<VCSConnexion, VCSEntry[]> entry : item.getEntriesByConnexion().entrySet()) { + VCSConnexion connexion = entry.getKey(); + if (connexion.isOpen()) { + // only works on opened connexion + doAction0(item.getAction(), connexion, entry.getValue(), item.getMessage()); + } + } + } + + protected void doAction0(VCSAction action, VCSConnexion connexion, VCSEntry[] entries, String message) throws VCSException, IOException { + //if (log.isDebugEnabled()) + log.info(action + ", connexion:" + connexion + ", entries: " + entries.length + ", message: " + message); + List<File> files = getFiles(entries); + switch (action) { case ADD: + connexion.add(files, message); + updateState(VCSState.UP_TO_DATE, entries); break; case CHANGELOG: + for (VCSEntry entry : entries) { + entry.populateChangeLog(); + } break; case CHECKOUT: + for (VCSEntry entry : entries) { + connexion.checkoutFile(entry.getFile().getParentFile(), entry.getFile().getName()); + } + //updateState(VCSState.UP_TO_DATE, entries); break; case COMMIT: + //updateState(VCSState.UP_TO_DATE, entries); break; case DELETE: + + //updateState(VCSState.UP_TO_DATE, entries); break; case DIFF: + for (VCSEntry entry : entries) { + entry.populateDiff(); + } break; case OVERWRITE_AND_UPDATE: + + //updateState(VCSState.UP_TO_DATE, entries); break; case REFRESH: break; case REVERT: + //updateState(VCSState.UP_TO_DATE, entries); break; case UPDATE: + + //updateState(VCSState.UP_TO_DATE, entries); break; } } + protected void updateState(VCSState state, VCSEntry[] entries) { + for (VCSEntry entry : entries) { + entry.setState(state); + } + } + + protected List<File> getFiles(VCSEntry[] entries) { + List<File> result = new ArrayList<File>(); + for (VCSEntry entry : entries) { + result.add(entry.getFile()); + } + return result; + } + + public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(propertyName, listener); + } + + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + if (listener == null || changeSupport == null) { + return; + } + changeSupport.removePropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListeners() { + if (changeSupport == null) { + return; + } + for (PropertyChangeListener listener : getPropertyChangeListeners()) { + changeSupport.removePropertyChangeListener(listener); + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners() { + if (changeSupport == null) { + return new PropertyChangeListener[0]; + } + return changeSupport.getPropertyChangeListeners(); + } + + public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (changeSupport == null || (oldValue == null && newValue == null) || + (oldValue != null && oldValue.equals(newValue))) { + return; + } + changeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + } Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.type; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.util; @@ -65,6 +65,9 @@ public File getWorkingCopy() throws IllegalStateException { checkInit(); + if (localRoot == null) { + localRoot = getConfig().getLocalDatabasePath(); + } return localRoot; } @@ -217,6 +220,10 @@ return handler.getLocalStorageNames(directory); } + public List<String> getAllStorageNames(List<String> localFiles, List<String> remoteFiles) { + return handler.getAllStorageNames(localFiles, remoteFiles); + } + public Object getRevision(File f) throws VCSException { return handler.getRevision(f); } @@ -245,14 +252,14 @@ return handler.hasProtocoleChanged(); } - protected void fireOpen() { + protected void fireOpened() { VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.OPEN); for (VCSConnexionEventListener l : listeners) { l.onConnexionOpened(e); } } - protected void fireClose() { + protected void fireClosed() { VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.CLOSE); for (VCSConnexionEventListener l : listeners) { l.onConnexionClosed(e); Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -33,6 +33,7 @@ import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; /** @@ -144,6 +145,33 @@ } } + + public List<String> getAllStorageNames(List<String> localFiles, List<String> remoteFiles) { + + List<String> allFiles = new ArrayList<String>(); + + // detect location all from remote files + for (Iterator<String> it = remoteFiles.iterator(); it.hasNext();) { + String relativePath = it.next(); + if (localFiles.contains(relativePath)) { + allFiles.add(relativePath); + it.remove(); + localFiles.remove(relativePath); + } + } + + // detect location all from local files + for (Iterator<String> it = localFiles.iterator(); it.hasNext();) { + String relativePath = it.next(); + if (remoteFiles.contains(relativePath)) { + allFiles.add(relativePath); + it.remove(); + remoteFiles.remove(relativePath); + } + } + return allFiles; + } + public boolean isFileInWorkingCopy(File parent, String name, boolean underVCS) { if (parent == null || name == null) throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInWorkingCopy can not be invoked with some null parameter but was. [" + parent + "," + name + "," + Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.util; @@ -28,7 +28,7 @@ * * @author chemit */ -public class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> { +public abstract class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> { static protected final Log log = LogFactory.getLog(AbstractVCSProvider.class); Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.util; Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,24 +10,23 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.util; -import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.VCSConnexion; import org.codelutin.vcs.VCSEntries; import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSEntryLocation; import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; import org.codelutin.vcs.type.VCSState; import javax.swing.ListSelectionModel; import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; import java.util.Arrays; +import java.util.Collections; +import java.util.List; /** @author chemit */ public class VCSEntriesImpl implements VCSEntries { @@ -35,46 +34,45 @@ protected List<VCSEntry> entries; public void populate(VCSConnexion connexion, long timestamp) throws VCSException { + populate(connexion, timestamp, VCSEntryLocation.ALL); + } - List<String> localFiles = connexion.getLocalStorageNames(connexion.getWorkingCopy()); + public void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location) throws VCSException { + List<String> localFiles; - List<String> remoteFiles = transformToLocal(connexion.getRemoteStorageNames(connexion.getWorkingCopy())); + List<String> remoteFiles; + List<String> allFiles; + switch (location) { - List<String> allFiles = new ArrayList<String>(); - - // detect location all from remote files - for (Iterator<String> it = remoteFiles.iterator(); it.hasNext();) { - String relativePath = it.next(); - if (localFiles.contains(relativePath)) { - allFiles.add(relativePath); - it.remove(); - localFiles.remove(relativePath); - } + case ALL: + localFiles = connexion.getLocalStorageNames(connexion.getWorkingCopy()); + remoteFiles = transformToLocal(connexion.getRemoteStorageNames(connexion.getWorkingCopy())); + allFiles = connexion.getAllStorageNames(localFiles, remoteFiles); + populate(connexion, timestamp, VCSEntryLocation.LOCAL, localFiles); + populate(connexion, timestamp, VCSEntryLocation.REMOTE, remoteFiles); + populate(connexion, timestamp, VCSEntryLocation.ALL, allFiles); + break; + case LOCAL: + localFiles = connexion.getLocalStorageNames(connexion.getWorkingCopy()); + populate(connexion, timestamp, VCSEntryLocation.LOCAL, localFiles); + break; + case REMOTE: + remoteFiles = transformToLocal(connexion.getRemoteStorageNames(connexion.getWorkingCopy())); + populate(connexion, timestamp, VCSEntryLocation.REMOTE, remoteFiles); + break; + case UNKNOW: + // ??? + break; } - - // detect location all from local files - for (Iterator<String> it = localFiles.iterator(); it.hasNext();) { - String relativePath = it.next(); - if (remoteFiles.contains(relativePath)) { - allFiles.add(relativePath); - it.remove(); - remoteFiles.remove(relativePath); - } - } - - populate(connexion, localFiles, VCSEntryLocation.LOCAL, timestamp); - populate(connexion, remoteFiles, VCSEntryLocation.REMOTE, timestamp); - populate(connexion, allFiles, VCSEntryLocation.ALL, timestamp); - } - public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException { + public void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location, List<String> relativeLocalPaths) throws VCSException { if (entries == null) { entries = new ArrayList<VCSEntry>(); } for (String relativeLocalPath : relativeLocalPaths) { VCSEntry entry = new VCSEntryImpl(connexion, relativeLocalPath); - entry.populate(timestamp); + entry.populateState(timestamp); entries.add(entry); } } @@ -86,7 +84,7 @@ this.entries.addAll(Arrays.asList(entries)); } - public void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException { + public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException { checkPopulated(); } @@ -106,7 +104,7 @@ return result; } - public List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries) { + public List<VCSEntry> filter(VCSEntryLocation location) { if (location == VCSEntryLocation.ALL) { return new ArrayList<VCSEntry>(entries); } Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntryImpl.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.util; @@ -25,6 +25,8 @@ import java.io.BufferedReader; import java.io.File; +import java.io.IOException; +import java.io.StringReader; /** @author chemit */ public class VCSEntryImpl implements VCSEntry { @@ -35,7 +37,7 @@ protected final String relativeRemotePath; - protected final File localFile; + protected File localFile; protected VCSState state; @@ -43,100 +45,66 @@ protected String rev; + protected String changelog; + + protected String diff; + protected transient ListenerSet<VCSEntryStateChangedEventListener> listeners = new ListenerSet<VCSEntryStateChangedEventListener>(); - private static final long serialVersionUID = -6628119456256629555L; + private static final long serialVersionUID = 1L; public VCSEntryImpl(VCSConnexion connexion, String relativeLocalPath) { this.connexion = connexion; this.relativeLocalPath = relativeLocalPath; this.relativeRemotePath = AbstractVCSHandler.convertToRemoteName(relativeLocalPath); - this.localFile = new File(connexion.getWorkingCopy(), relativeLocalPath); } - public void populate(long timestamp) throws VCSException { - this.timestamp = timestamp; - VCSState oldState = this.state; - this.state = connexion.getState(new File(connexion.getWorkingCopy(), relativeLocalPath), null); - if (oldState != state) { - fireStateChanged(oldState); - } + public String getRelativeLocalPath() { + return relativeLocalPath; } - protected void fireStateChanged(VCSState oldState) { - VCSEntryStateChangedEvent event = new VCSEntryStateChangedEvent(this, state); - switch (state) { - case MISSING: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onDeleted(event); - } - break; - case MODIFIED: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onModified(event); - } - break; - case OUT_OF_DATE: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onObseleted(event); - } - break; - case OUT_OF_DATE_AND_MODIFIED: - if (oldState == VCSState.OUT_OF_DATE) { - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onModified(event); - } - } else { - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onObseleted(event); - } - } - break; - case REMOVED: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onDeleted(event); - } - break; - case UNKNOWN: - // ? - break; - case UNVERSIONNED: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onAdded(event); - } - break; - case UNVERSIONNED_OR_MISSING: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onAdded(event); - } - break; - case UP_TO_DATE: - for (VCSEntryStateChangedEventListener listener : listeners) { - listener.onUpdated(event); - } - break; + public String getRelativeRemotePath() { + return relativeRemotePath; + } + + public VCSConnexion getConnexion() { + return connexion; + } + + public File getFile() { + if (localFile == null) { + localFile = new File(connexion.getWorkingCopy(), relativeLocalPath); } + return localFile; } - public void refresh(long timestamp) throws IllegalStateException, VCSException { - checkPopulated(); - populate(timestamp); + public void populateState(long timestamp) throws VCSException { + this.timestamp = timestamp; + VCSState newState = connexion.getState(getFile(), null); + setState(newState); } - public String getRelativeLocalPath() { - return relativeLocalPath; + public void populateChangeLog() throws IllegalStateException, VCSException { + checkPopulated(); + changelog = connexion.getChangeLog(getFile()); } - public String getRelativeRemotePath() { - return relativeRemotePath; + public void populateDiff() throws IllegalStateException, VCSException, IOException { + checkPopulated(); + diff = connexion.getDiff(getFile()); } - public File getFile() { - return localFile; + public void refreshState(long timestamp) throws IllegalStateException, VCSException { + checkPopulated(); + populateState(timestamp); } - public VCSConnexion getConnexion() { - return connexion; + public void setState(VCSState state) { + VCSState oldState = this.state; + this.state = state; + // mark new timestamp + this.timestamp = System.nanoTime(); + fireStateChanged(oldState); } public VCSEntryLocation getLocation() throws IllegalStateException { @@ -161,12 +129,12 @@ public BufferedReader getChangeLog() throws IllegalStateException { checkPopulated(); - return null; + return new BufferedReader(new StringReader(changelog)); } public BufferedReader getDiff() throws IllegalStateException { checkPopulated(); - return null; + return new BufferedReader(new StringReader(diff)); } public BufferedReader getLocalContent() throws IllegalStateException { @@ -179,27 +147,71 @@ return null; } - public void setState(VCSState state) { - //TODO Remove this method, we should not be able to change state - //TODO is used by VCSUITest (should prefer to implements popuplatemethod in MockConnexion) - this.state = state; - - } - public void addVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l) { listeners.add(l); } public void removeVCSEntryStateChangedEventListener(VCSEntryStateChangedEventListener l) { + listeners.remove(l); } + @Override + public String toString() { + return super.toString() + " " + localFile + " : " + state; + } + protected void checkPopulated() throws IllegalStateException { if (timestamp == -1) { throw new IllegalStateException(this + " was not populated"); } } - public String toString() { - return super.toString() + " " + localFile + " : " + state; + protected void fireStateChanged(VCSState oldState) { + if (oldState != null && oldState == state) { + // nothing to do + return; + } + // state has changed, must reset changelog and diff to be safe + diff = changelog = null; + + String methodName = null; + + switch (state) { + case MISSING: + methodName = "onDeleted"; + break; + case MODIFIED: + methodName = "onModified"; + break; + case OUT_OF_DATE: + methodName = "onObsoleted"; + break; + case OUT_OF_DATE_AND_MODIFIED: + methodName = oldState == VCSState.OUT_OF_DATE ? "onModified" : "onObsoleted"; + break; + case REMOVED: + methodName = "onDeleted"; + break; + case UNKNOWN: + return; + case UNVERSIONNED: + case UNVERSIONNED_OR_MISSING: + methodName = "onAdded"; + break; + case UP_TO_DATE: + methodName = "onUpdated"; + break; + } + + if (methodName == null) { + throw new IllegalStateException("could not find a disptacher property for state: " + state); + } + try { + VCSEntryStateChangedEvent event = new VCSEntryStateChangedEvent(this, oldState, state); + listeners.fire(methodName, event); + } catch (Exception e) { + //TODO + } } + } Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.cvs; Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.mock; @@ -38,14 +38,14 @@ @Override public void close() throws IllegalStateException { checkInit(); - fireClose(); + fireClosed(); } @Override public void open() throws IllegalStateException { checkInit(); state = VCSConnectionState.CLOSE; - fireOpen(); + fireOpened(); } } \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.mock; @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import java.util.Iterator; import java.util.List; /** @author chemit */ @@ -34,11 +35,11 @@ } public VCSState getState(File fileState, Collection tmp) throws VCSException { - return null; + return VCSState.UNKNOWN; } public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException { - return null; + return VCSState.UNKNOWN; } public boolean isOnRemote(File file) { @@ -86,7 +87,14 @@ } public List<String> getRemoteStorageNames(File directory) throws VCSException { - return null; + List<String> result = getLocalStorageNames(directory); + for (Iterator<String> it = result.iterator(); it.hasNext();) { + String s = it.next(); + if (s.startsWith("local")) { + it.remove(); + } + } + return result; } public Object getRevision(File f) throws VCSException { Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs; Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.svn; Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNEventLoggerHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNEventLoggerHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNEventLoggerHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.svn; Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/VCSRevisionImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/VCSRevisionImpl.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/VCSRevisionImpl.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.impl.svn; Deleted: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractUI.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,55 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.ui.handler.AbstractUIHandler; -import org.codelutin.vcs.ui.model.AbstractUIModel; - -/** @author chemit */ -public class AbstractUI extends javax.swing.JDialog { - - protected AbstractUIModel model; - - protected AbstractUIHandler handler; - - public AbstractUI() { - // Jaxx always generate the default constructor, so need it, but DO NOT USE IT! - //throw new IllegalStateException("the default constructor can NOT be used!"); - UIHelper.setQuitAction(this); - } - - public AbstractUI(AbstractUIHandler handler, AbstractUIModel model) { - this.handler = handler; - this.model = model; - UIHelper.setQuitAction(this); - } - - public AbstractUIModel getModel() { - return model; - } - - protected AbstractUIHandler getHandler() { - return handler; - } - - public void setModel(AbstractUIModel model) { - this.model = model; - } - - public void setHandler(AbstractUIHandler handler) { - this.handler = handler; - } - -} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,63 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui; + +import javax.swing.AbstractButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.JToolBar; + +/** @author chemit */ +public abstract class ConfirmUI extends org.codelutin.vcs.ui.util.AbstractUI<org.codelutin.vcs.ui.handler.ConfirmUIHandler> { + + public abstract JLabel getActionLabel(); + + public abstract JPanel getToolbar(); + + public abstract JToolBar getTool(); + + public abstract JLabel getActionCommitLabel(); + + public abstract JScrollPane getCommitScroll(); + + public abstract JTextArea getCommitMessage(); + + public abstract JScrollPane getContent(); + + public abstract JTable getContentTable(); + + public abstract AbstractButton getLastMessages(); + + public abstract AbstractButton getAccept(); + + public void doAccept() { + getHandler().doAction(getCommitMessage().getText(), getHandler().getModel().getEntriesModel()); + } + + @Override + public void setVisible(boolean b) { + if (b) { + getAccept().setEnabled(getHandler().getModel().getEntriesModel().getRowCount() > 0); + } + super.setVisible(b); + } + + protected void showLastMessages() { + //TODO + } +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/DiffUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/DiffUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,61 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; + +import javax.swing.AbstractButton; +import java.util.List; + +/** @author chemit */ +public abstract class DiffUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.DiffUIHandler> { + + public abstract AbstractButton getNextDiff(); + + public abstract AbstractButton getPreviousDiff(); + + public void doSelectFile() { + List<VCSEntry> entries = getHandler().getModel().getEntriesModel().getDisplayedEntries(getHandler().getSelectionModel()); + VCSEntry vcsEntry = entries.isEmpty() ? null : entries.get(0); + getHandler().getModel().setFileModel(vcsEntry); + } + + @Override + public void setVisible(boolean b) { + if (b) { + AbstractButton button = getButton(getHandler().getLocation()); + if (button == null) { + button = getAllTab(); + } + button.doClick(); + if (getTable(getHandler().getModel().getEntriesModel().getLocation()).getRowCount() > 0) + getHandler().getSelectionModel().setSelectionInterval(0, 0); + } + super.setVisible(b); + } + + protected void doAction(VCSAction action) { + getHandler().doAction(action, getHandler().getModel().getFileModel()); + } + + protected void gotoNextDiff() { + getHandler().gotoNextDiff(); + } + + protected void gotoPreviousDiff() { + getHandler().gotoPreviousDiff(); + } +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/SynchUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/SynchUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,56 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.type.VCSAction; + +import javax.swing.AbstractButton; +import javax.swing.JPopupMenu; + +/** @author chemit */ +public abstract class SynchUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.SynchUIHandler> { + + public abstract AbstractButton getRefreshAll(); + + public abstract AbstractButton getDiffAll(); + + public abstract AbstractButton getUpdateAll(); + + public abstract AbstractButton getCommitAll(); + + public abstract AbstractButton getRevertAll(); + + public abstract AbstractButton getDeleteAll(); + + public abstract AbstractButton getDiff(); + + public abstract JPopupMenu getPopup(); + + @Override + public void setVisible(boolean b) { + if (b) { + AbstractButton button = getButton(getHandler().getLocation()); + if (button == null) { + button = getAllTab(); + } + button.doClick(); + } + super.setVisible(b); + } + + protected void doAction(VCSAction action, boolean useSelection) { + getHandler().doAction(action, useSelection); + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/UIHelper.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/UIHelper.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/UIHelper.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,45 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JRootPane; -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -/** - * UI Helper methods - * - * @author chemit - */ -public class UIHelper { - - public static void setQuitAction(final JDialog ui) { - JRootPane rootPane = ui.getRootPane(); - - Action quitAction = new AbstractAction("quit") { - private static final long serialVersionUID = -869095664995763057L; - - public void actionPerformed(ActionEvent e) { - ui.dispose(); - } - }; - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); - rootPane.getActionMap().put("quit", quitAction); - } -} Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -9,33 +9,24 @@ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% */ package org.codelutin.vcs.ui; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.TagManager; -import jaxx.tags.swing.JPopupMenuHandler; -import jaxx.tags.swing.JWindowHandler; +import static jaxx.reflect.ClassDescriptorLoader.getClassDescriptor; +import static jaxx.tags.TagManager.registerBean; +import static jaxx.tags.TagManager.registerDefaultNamespace; public class VCSInitializer implements jaxx.spi.Initializer { public void initialize() { - - //TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractUI.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractVCSPopup.class), JPopupMenuHandler.class); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractConfirmUI.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractDiffUI.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractSynchUI.class), JWindowHandler.class); - - TagManager.registerDefaultNamespace("AbstractConfirmUI", "org.codelutin.vcs.ui.*"); - TagManager.registerDefaultNamespace("AbstractSynchUI", "org.codelutin.vcs.ui.*"); - TagManager.registerDefaultNamespace("AbstractDiffUI", "org.codelutin.vcs.ui.*"); - TagManager.registerDefaultNamespace("DiffPanelUI", "org.codelutin.vcs.ui.*"); - TagManager.registerDefaultNamespace("AbstractVCSPopup", "org.codelutin.vcs.ui.*"); - TagManager.registerDefaultNamespace("JVCSPopup", "org.codelutin.vcs.ui.*"); - + registerBean(getClassDescriptor(javax.swing.JMenuItem.class), jaxx.tags.swing.JRadioButtonHandler.class); + for (VCSUI vcsui : VCSUI.values()) { + Class<?> uiClass = vcsui.getUiClass(); + registerBean(getClassDescriptor(uiClass), jaxx.tags.swing.JWindowHandler.class); + registerDefaultNamespace(uiClass.getSimpleName(), "org.codelutin.vcs.ui.*"); + } } + } \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,49 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.ui.util.AbstractUI; +import org.codelutin.vcs.ui.util.AbstractUIHandler; +import org.codelutin.vcs.ui.util.AbstractUIModel; + +/** + * @author chemit + * @see AbstractUI + * @see AbstractUIModel + * @see org.codelutin.vcs.ui.util.AbstractUIHandler + */ +public enum VCSUI { + + synch(SynchUI.class, org.codelutin.vcs.ui.handler.SynchUIHandler.class), + diff(DiffUI.class, org.codelutin.vcs.ui.handler.DiffUIHandler.class), + confirm(ConfirmUI.class, org.codelutin.vcs.ui.handler.ConfirmUIHandler.class); + + private final Class<? extends AbstractUI> uiClass; + private final Class<? extends AbstractUIHandler> handlerClass; + + private VCSUI(Class<? extends AbstractUI> uiClass, Class<? extends AbstractUIHandler> handlerClass) { + this.uiClass = uiClass; + this.handlerClass = handlerClass; + } + + public Class<? extends AbstractUIHandler> getHandlerClass() { + return handlerClass; + } + + public Class<? extends AbstractUI> getUiClass() { + return uiClass; + } + +} Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -10,7 +10,7 @@ * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * ##% */ package org.codelutin.vcs.ui; @@ -18,12 +18,12 @@ import org.apache.commons.logging.LogFactory; import org.codelutin.util.StringUtil; import org.codelutin.vcs.VCSFactory; -import org.codelutin.vcs.ui.handler.AbstractUIHandler; -import org.codelutin.vcs.ui.handler.ConfirmUIHandler; -import org.codelutin.vcs.ui.handler.DiffUIHandler; -import org.codelutin.vcs.ui.handler.SynchUIHandler; -import org.codelutin.vcs.ui.model.AbstractUIModel; +import org.codelutin.vcs.ui.ConfirmUI; +import org.codelutin.vcs.ui.DiffUI; +import org.codelutin.vcs.ui.SynchUI; +import org.codelutin.vcs.ui.util.AbstractUI; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import java.util.ServiceLoader; @@ -39,23 +39,20 @@ protected static VCSUIFactory instance; - protected Map<Class<? extends AbstractUIHandler>, AbstractUIHandler> cache; - protected ServiceLoader<AbstractUI> loader; + protected Map<VCSUI, AbstractUI> cache; + protected ServiceLoader<VCSUIProvider> loader; - public static AbstractSynchUI newSynchUI() { - SynchUIHandler result = getInstance().newHandler(SynchUIHandler.class); - return result.getUi(); + public static SynchUI newSynchUI() { + return (SynchUI) getInstance().newUI(VCSUI.synch); } - public static AbstractConfirmUI newConfirmUI() { - ConfirmUIHandler result = getInstance().newHandler(ConfirmUIHandler.class); - return result.getUi(); + public static ConfirmUI newConfirmUI() { + return (ConfirmUI) getInstance().newUI(VCSUI.confirm); } - public static AbstractDiffUI newDiffUI() { - DiffUIHandler result = getInstance().newHandler(DiffUIHandler.class); - return result.getUi(); + public static DiffUI newDiffUI() { + return (DiffUI) getInstance().newUI(VCSUI.diff); } public void close() { @@ -82,78 +79,60 @@ close(); } - protected synchronized Map<Class<? extends AbstractUIHandler>, AbstractUIHandler> getCache() { + protected synchronized Map<VCSUI, AbstractUI> getCache() { if (cache == null) { - cache = new HashMap<Class<? extends AbstractUIHandler>, AbstractUIHandler>(); + cache = new HashMap<VCSUI, AbstractUI>(); } return cache; } - protected synchronized ServiceLoader<AbstractUI> getLoader() { + protected synchronized ServiceLoader<VCSUIProvider> getProviders() { if (loader == null) { long t0 = System.nanoTime(); - loader = ServiceLoader.load(AbstractUI.class); + loader = ServiceLoader.load(VCSUIProvider.class); int nb = 0; - for (AbstractUI provider : loader) { + for (VCSUIProvider provider : loader) { log.info(provider.getName() + " [" + provider + ']'); nb++; } - log.info("found " + nb + " ui(s) in " + StringUtil.convertTime(t0, System.nanoTime())); + log.info("found " + nb + " ui provider(s) in " + StringUtil.convertTime(t0, System.nanoTime())); } return loader; } - @SuppressWarnings({"unchecked"}) - protected <H extends AbstractUIHandler> H newHandler(Class<H> klass) { - H result; - result = (H) getInstance().getCache().get(klass); + protected AbstractUI newUI(VCSUI uiType) { + AbstractUI result = getInstance().getCache().get(uiType); if (result == null) { - try { // instance of handler - result = klass.getConstructor().newInstance(); + result = newUI0(uiType); - // instance of model - AbstractUIModel model = (AbstractUIModel) result.getModelClass().newInstance(); - - // obtain intance of ui - AbstractUI ui = getUI(result.getUiClass()); - - // attach model to ui - ui.setModel(model); - - // attach handler to ui - ui.setHandler(result); - - // attach ui to handler - result.setUi(ui); - - // init handler - result.init(); - - getCache().put(klass, result); + getCache().put(uiType, result); } catch (Exception e) { - throw new IllegalStateException("could not instanciate ui handler " + klass + " for reason : " + e.getMessage()); + throw new IllegalStateException("could not instanciate ui handler " + uiType + " for reason : " + e.getMessage()); } } return result; } - @SuppressWarnings({"unchecked"}) - protected <U extends AbstractUI> U getUI(Class<U> klass) { + protected AbstractUI newUI0(VCSUI uiType) throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { + for (VCSUIProvider provider : getProviders()) { + AbstractUI ui = provider.newUI(uiType); + if (ui != null) { - for (AbstractUI ui : getLoader()) { - if (klass.isAssignableFrom(ui.getClass())) { - return (U) ui; + uiType.getHandlerClass().getConstructor(ui.getClass().getSuperclass()).newInstance(ui); + + ui.getHandler().init(); + return ui; } } - throw new IllegalStateException("could not find ui " + klass); + throw new IllegalStateException("could not find ui " + uiType); } protected VCSUIFactory() { } -} +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,41 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.ui.util.AbstractUI; + +/** @author chemit */ +public abstract class VCSUIProvider { + + private Class<?>[] klasses; + + protected String name; + + protected VCSUIProvider(String name, Class<?>... klasses) { + this.name = name; + this.klasses = klasses; + } + + /** @return the identifier of the vcs ui provider (eg jaxx, swing, ...) */ + public String getName() { + return name; + } + + public AbstractUI newUI(VCSUI uiType) throws InstantiationException, IllegalAccessException { + Class<?> uiImpl = klasses[uiType.ordinal()]; + return (AbstractUI) (uiImpl != null ? uiImpl.newInstance() : null); + } + +} Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -9,32 +9,31 @@ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% */ package org.codelutin.vcs.ui.handler; import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.ui.AbstractConfirmUI; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.util.AbstractUIHandler; +import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.util.UIHelper; import org.codelutin.vcs.ui.model.ConfirmUIModel; +import org.codelutin.vcs.ui.ConfirmUI; import javax.swing.ListSelectionModel; import java.beans.PropertyChangeEvent; import java.util.List; /** @author chemit */ -public class ConfirmUIHandler extends org.codelutin.vcs.ui.handler.AbstractUIHandler<ConfirmUIModel, AbstractConfirmUI> { +public class ConfirmUIHandler extends AbstractUIHandler<ConfirmUIModel, ConfirmUI> { - public Class<AbstractConfirmUI> getUiClass() { - return AbstractConfirmUI.class; + public ConfirmUIHandler(ConfirmUI ui) { + super(ui, new ConfirmUIModel()); + ui.setHandler(this); } - public Class<? super ConfirmUIModel> getModelClass() { - return ConfirmUIModel.class; - } - public ListSelectionModel getSelectionModel() { return getUi().getContentTable().getSelectionModel(); } @@ -58,6 +57,14 @@ throw new IllegalStateException("unimplemented property changed : " + evt); } + @Override + public void init() { + super.init(); + getUi().getContentTable().setModel(getModel().getEntriesModel()); + // init table renderer + UIHelper.installVCSTableUI(getUi().getContentTable()); + } + protected void updateUI() { VCSAction action = getModel().getAction(); getUi().getAccept().setText(action.getLibelle()); @@ -72,12 +79,12 @@ public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { - VCSAction action = getModel().getAction(); + VCSAction action = this.getModel().getAction(); List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); if (action.isCommit()) { - getModel().addCommitMessage(commitMessage); + this.getModel().addCommitMessage(commitMessage); } else { commitMessage = null; Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -1,5 +1,5 @@ /** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you * can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version 2 @@ -9,19 +9,21 @@ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You * should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% */ package org.codelutin.vcs.ui.handler; import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractDiffUI; import org.codelutin.vcs.ui.VCSUIFactory; -import org.codelutin.vcs.ui.AbstractConfirmUI; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.DiffUI; import org.codelutin.vcs.ui.model.DiffUIModel; +import org.codelutin.vcs.ui.ConfirmUI; +import org.codelutin.vcs.ui.util.AbstractTabUIHandler; +import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.util.UIHelper; import javax.swing.JTable; import javax.swing.ListSelectionModel; @@ -32,17 +34,13 @@ import java.util.List; /** @author chemit */ -public class DiffUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<DiffUIModel, AbstractDiffUI> { +public class DiffUIHandler extends AbstractTabUIHandler<DiffUIModel, DiffUI> { - - public Class<AbstractDiffUI> getUiClass() { - return AbstractDiffUI.class; + public DiffUIHandler(DiffUI ui) { + super(ui, new DiffUIModel()); + ui.setHandler(this); } - public Class<? super DiffUIModel> getModelClass() { - return DiffUIModel.class; - } - @Override public void propertyChange(PropertyChangeEvent evt) { //if (log.isDebugEnabled()) { @@ -77,10 +75,12 @@ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { - getUi().selectFile(); + getUi().doSelectFile(); } } }); + // init table renderer + UIHelper.installVCSTableUI(table); } public void doSelectFile(VCSEntry model) { @@ -112,14 +112,14 @@ selectionModel.clearSelection(); // do refresh of all states log.info("refresh :" + model.getRowCount()); - model.refresh(entries, System.nanoTime()); + model.refresh(System.nanoTime(), entries); } else { log.info("files to treate :" + entries.size()); - AbstractConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); + ConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); - confirmUI.getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); + confirmUI.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); confirmUI.setVisible(true); //TODO SynchModel should listener for modification on ActionManagerQueue thread Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -3,34 +3,30 @@ import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.AbstractConfirmUI; -import org.codelutin.vcs.ui.AbstractDiffUI; -import org.codelutin.vcs.ui.AbstractSynchUI; -import org.codelutin.vcs.ui.AbstractVCSPopup; import org.codelutin.vcs.ui.VCSUIFactory; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.ConfirmUI; +import org.codelutin.vcs.ui.SynchUI; import org.codelutin.vcs.ui.model.SynchUIModel; +import org.codelutin.vcs.ui.DiffUI; +import org.codelutin.vcs.ui.util.AbstractTabUIHandler; +import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.util.UIHelper; -import javax.swing.AbstractAction; import javax.swing.JTable; import javax.swing.ListSelectionModel; -import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; /** @author chemit */ -public class SynchUIHandler extends org.codelutin.vcs.ui.handler.AbstractTabUIHandler<SynchUIModel, AbstractSynchUI> { +public class SynchUIHandler extends AbstractTabUIHandler<SynchUIModel, SynchUI> { - public Class<AbstractSynchUI> getUiClass() { - return AbstractSynchUI.class; + public SynchUIHandler(SynchUI ui) { + super(ui, new SynchUIModel()); + ui.setHandler(this); } - public Class<? super SynchUIModel> getModelClass() { - return SynchUIModel.class; - } - @Override public void doSelectLocation(VCSEntryLocation location) { @@ -58,7 +54,7 @@ selectionModel.clearSelection(); // do refresh of all states log.info("refresh :" + model.getRowCount()); - model.refresh(model.getEntries(), System.nanoTime()); + model.refresh(System.nanoTime(), model.getEntries()); } else { List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? selectionModel : null)); if (entries.isEmpty()) { @@ -67,7 +63,7 @@ } if (action == VCSAction.DIFF) { // show diff ui - AbstractDiffUI diffUI = VCSUIFactory.newDiffUI(); + DiffUI diffUI = VCSUIFactory.newDiffUI(); List<VCSEntry> vcsEntryList; if (useSelection) { vcsEntryList = entries; @@ -75,15 +71,15 @@ // take all entries vcsEntryList = model.filter(action, model.getEntries()); } - diffUI.getModel().init(model.getLocation(), vcsEntryList.toArray(new VCSEntry[vcsEntryList.size()])); + diffUI.getHandler().getModel().init(model.getLocation(), vcsEntryList.toArray(new VCSEntry[vcsEntryList.size()])); diffUI.setVisible(true); return; } log.info("files to treate :" + entries.size()); - AbstractConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); + ConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); - confirmUI.getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); + confirmUI.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); confirmUI.setVisible(true); //TODO SynchModel should listener for modification on ActionManagerQueue thread @@ -96,29 +92,21 @@ AbstractVCSEntriesTableModel fileStatesModel = getModel().getEntriesModel(); table.setModel(fileStatesModel); table.addMouseListener(new ListMouseListener(getUi(), fileStatesModel, location)); - - getUi().getPopup(location).setDispatchAction(new AbstractAction() { - - private static final long serialVersionUID = 8622118724992019898L; - - public void actionPerformed(ActionEvent e) { - doAction(VCSAction.valueOf(e.getActionCommand()), true); - } - }); + // init table renderer + UIHelper.installVCSTableUI(table); } - protected static class ListMouseListener extends MouseAdapter { + protected class ListMouseListener extends MouseAdapter { private final AbstractVCSEntriesTableModel model; private final ListSelectionModel selectionModel; private final JTable jTable; - private final AbstractVCSPopup jPopupMenu; - public ListMouseListener(AbstractSynchUI ui, AbstractVCSEntriesTableModel model, VCSEntryLocation modelName) { + + public ListMouseListener(SynchUI ui, AbstractVCSEntriesTableModel model, VCSEntryLocation modelName) { this.model = model; - jPopupMenu = ui.getPopup(modelName); jTable = ui.getTable(modelName); selectionModel = jTable.getSelectionModel(); } @@ -151,15 +139,17 @@ acts.add(action.name().toLowerCase()); } boolean hasActions = !acts.isEmpty(); - jPopupMenu.getDiff().setEnabled(hasActions && acts.contains("diff")); - jPopupMenu.getUpdate().setEnabled(hasActions && acts.contains("update")); - jPopupMenu.getCommit().setEnabled(hasActions && acts.contains("commit")); - jPopupMenu.getRevert().setEnabled(hasActions && acts.contains("revert")); - jPopupMenu.getDelete().setEnabled(hasActions && acts.contains("delete")); - jPopupMenu.getRefresh().setEnabled(hasActions); - jPopupMenu.pack(); + + getUi().getPopup().setInvoker(jTable); + getUi().getDiff().setEnabled(hasActions && acts.contains("diff")); + getUi().getUpdate().setEnabled(hasActions && acts.contains("update")); + getUi().getCommit().setEnabled(hasActions && acts.contains("commit")); + getUi().getRevert().setEnabled(hasActions && acts.contains("revert")); + getUi().getDelete().setEnabled(hasActions && acts.contains("delete")); + getUi().getRefresh().setEnabled(hasActions); + getUi().getPopup().pack(); // display popup - jPopupMenu.show(jTable, x, y); + getUi().getPopup().show(jTable, x, y); } } } Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,71 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.util.AbstractUIModel; + +import java.util.ArrayList; +import java.util.List; + +/** + * Model of a a confirmation of action on entries (single type of action possible) + * + * @author chemit + */ +public class ConfirmUIModel extends AbstractUIModel { + + /** history of commit messages */ + protected List<String> commitMessages; + + /** current action to be fired */ + protected VCSAction action; + public static final String ACCEPT_PROPERTY_CHANGED = "action"; + public static final String MESSAGE_HISTORY_PROPERTY_CHANGED = "historyMessage"; + + public List<String> getCommitMessages() { + if (commitMessages == null) { + commitMessages = new ArrayList<String>(); + } + return commitMessages; + } + + public VCSAction getAction() { + return action; + } + + public void addCommitMessage(String commitMessage) { + if (commitMessage != null && !commitMessage.isEmpty() && !getCommitMessages().contains(commitMessage)) { + // add message in history + getCommitMessages().add(commitMessage); + firePropertyChange(MESSAGE_HISTORY_PROPERTY_CHANGED, null, commitMessage); + } + } + + public void init(VCSAction action, VCSEntryLocation location, VCSEntry[] states) { + getEntriesModel().clear(); + getEntriesModel().populate(location, states); + setAction(action); + } + + public void setAction(VCSAction action) { + this.action = action; + // null oldValue to ensure propagation of changed + firePropertyChange(ACCEPT_PROPERTY_CHANGED, null, action); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,49 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.util.AbstractTabUIModel; + +/** + * Model of a repository + * + * @author chemit + */ +public class DiffUIModel extends AbstractTabUIModel { + + public static final String FILE_PROPERTY_CHANGED = "file"; + + /** current file displayed */ + protected VCSEntry fileModel; + + public void setFileModel(VCSEntry fileModel) { + VCSEntry oldFileModel = this.fileModel; + this.fileModel = fileModel; + firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileModel); + } + + public VCSEntry getFileModel() { + return fileModel; + } + + public void init(VCSEntryLocation location, VCSEntry[] states) { + getEntriesModel().clear(); + getEntriesModel().populate(VCSEntryLocation.ALL, states); + setFileModel(null); + setLocation(location); + } +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,61 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSState; +import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; + +/** @author chemit */ +public class SimpleVCSEntriesTableModelImpl extends AbstractVCSEntriesTableModel { + + private static final long serialVersionUID = -6397327068709720165L; + + /** columns names for a simple table model with module, file and status */ + public static final String[] SIMPLE_COLUMNS_NAMES = new String[]{ + org.codelutin.i18n.I18n.n_("lutinvcs.module"), + org.codelutin.i18n.I18n.n_("lutinvcs.file"), + org.codelutin.i18n.I18n.n_("lutinvcs.status") + }; + + public SimpleVCSEntriesTableModelImpl(String name) { + super(name, SIMPLE_COLUMNS_NAMES); + } + + public Object getValueAt(int rowIndex, int columnIndex) { + if (getRowCount() == 0) { + return null; + } + VCSEntry item = displayedEntries.get(rowIndex); + Object result = null; + + if (columnIndex == 0) { + // get module + int filename = item.getFile().getName().length(); + String path = item.getRelativeLocalPath(); + result = path.length() > filename ? path.substring(0, path.length() - filename - 1) : path; + } else if (columnIndex == 1) { + // get file + result = item.getFile().getName(); + } else if (columnIndex == 2) { + // get status + VCSState state = item.getState(); + result = state == null ? null : state.libelle(); + } + return result; + } + + +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,27 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.ui.util.AbstractTabUIModel; + +/** + * Model of a repository + * + * @author chemit + */ +public class SynchUIModel extends AbstractTabUIModel { + + +} Copied: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java (from rev 440, trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,95 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import org.codelutin.vcs.type.VCSEntryLocation; + +import javax.swing.AbstractButton; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JToggleButton; +import javax.swing.ButtonGroup; +import java.awt.CardLayout; + +/** @author chemit */ +public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractUI<H> { + + public abstract ButtonGroup getTabs(); + + public abstract JToggleButton getAllTab(); + + public abstract JToggleButton getLocalTab(); + + public abstract JToggleButton getRemoteTab(); + + public abstract JScrollPane getAllContent(); + + public abstract JScrollPane getLocalContent(); + + public abstract JScrollPane getRemoteContent(); + + public abstract JTable getAllTable(); + + public abstract JTable getLocalTable(); + + public abstract JTable getRemoteTable(); + + public abstract JPanel getPreview(); + + public abstract AbstractButton getRefresh(); + + public abstract AbstractButton getUpdate(); + + public abstract AbstractButton getCommit(); + + public abstract AbstractButton getRevert(); + + public abstract AbstractButton getDelete(); + + public abstract CardLayout getCardLayout(); + + public JTable getTable(VCSEntryLocation modelName) { + switch (modelName) { + case ALL: + return getAllTable(); + case LOCAL: + return getLocalTable(); + case REMOTE: + return getRemoteTable(); + case UNKNOW: + break; + } + throw new IllegalStateException("no table found for " + modelName); + } + + public AbstractButton getButton(VCSEntryLocation modelName) { + switch (modelName) { + case ALL: + return getAllTab(); + case LOCAL: + return getLocalTab(); + case REMOTE: + return getRemoteTab(); + case UNKNOW: + return null; + } + throw new IllegalStateException("no popup found for " + modelName); + } + + protected void setLocation(VCSEntryLocation location) { + getHandler().getModel().setLocation(location); + } +} Copied: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java (from rev 440, trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,59 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import org.codelutin.vcs.type.VCSEntryLocation; + +import javax.swing.ListSelectionModel; +import java.beans.PropertyChangeEvent; + +/** @author chemit */ +public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI<? extends AbstractTabUIHandler>> extends AbstractUIHandler<M, U> { + + protected AbstractTabUIHandler(U ui, M model) { + super(ui, model); + } + + protected abstract void initTab(VCSEntryLocation location); + + @Override + public void init() { + super.init(); + initTab(VCSEntryLocation.ALL); + initTab(VCSEntryLocation.LOCAL); + initTab(VCSEntryLocation.REMOTE); + } + + public ListSelectionModel getSelectionModel() { + return getUi().getTable(getLocation()).getSelectionModel(); + } + + public void propertyChange(PropertyChangeEvent evt) { + //if (log.isDebugEnabled()) { + log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + //} + String action = evt.getPropertyName(); + + if (AbstractTabUIModel.LOCATION_PROPERTY_CHANGED.equals(action)) { + doSelectLocation((VCSEntryLocation) evt.getNewValue()); + } + } + + public void doSelectLocation(VCSEntryLocation location) { + log.info(location); + getUi().getCardLayout().show(getUi().getPreview(), "tab" + location.name().toLowerCase()); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,34 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import org.codelutin.vcs.type.VCSEntryLocation; + +/** + * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...) + * + * @author chemit + */ +public class AbstractTabUIModel extends AbstractUIModel { + + public static final String LOCATION_PROPERTY_CHANGED = "location"; + + public void setLocation(VCSEntryLocation location) { + VCSEntryLocation oldLocation = getEntriesModel().getLocation(); + getEntriesModel().setLocation(location); + firePropertyChange(LOCATION_PROPERTY_CHANGED, oldLocation, location); + } + +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java (from rev 440, trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/AbstractUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,34 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +/** @author chemit */ +public class AbstractUI<H extends AbstractUIHandler> extends javax.swing.JDialog { + + private H handler; + + protected AbstractUI() { + UIHelper.setQuitAction(this); + } + + public H getHandler() { + return handler; + } + + public void setHandler(H handler) { + this.handler = handler; + } + +} Copied: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java (from rev 440, trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,65 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.VCSFactory; +import org.codelutin.vcs.runner.VCSActionManager; +import org.codelutin.vcs.type.VCSEntryLocation; + +import javax.swing.ListSelectionModel; +import java.beans.PropertyChangeListener; + +/** @author chemit */ +public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener { + + protected static Log log = LogFactory.getLog(AbstractUIHandler.class); + + private U ui; + private M model; + + protected AbstractUIHandler(U ui, M model) { + this.ui = ui; + this.model = model; + } + + public abstract ListSelectionModel getSelectionModel(); + + public final U getUi() { + return ui; + } + + public final M getModel() { + return model; + } + + public void init() { + if (model == null) { + throw new IllegalStateException("no model was defined for " + this); + } + model.addPropertyChangeListener(this); + } + + public VCSEntryLocation getLocation() { + return model.getEntriesModel().getLocation(); + } + + protected VCSActionManager getActionManager() { + return VCSFactory.getActionManager(); + } + + +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,115 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.model.SimpleVCSEntriesTableModelImpl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.List; + +/** @author chemit */ +public abstract class AbstractUIModel { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static protected final Log log = LogFactory.getLog(AbstractUIModel.class); + + + /** support for change properties support */ + protected PropertyChangeSupport changeSupport; + + protected final AbstractVCSEntriesTableModel entriesModel; + + protected AbstractUIModel() { + entriesModel = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName()); + } + + public AbstractVCSEntriesTableModel getEntriesModel() { + return entriesModel; + } + + public void populate(VCSConnexion connexion) throws VCSException { + getEntriesModel().populate(connexion, System.nanoTime()); + } + + public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException { + getEntriesModel().populate(connexion, System.nanoTime(), location, relativeLocalPaths); + } + + public void populate(VCSEntryLocation location, VCSEntry[] datas) { + getEntriesModel().populate(location, datas); + } + + public void refresh(List<VCSEntry> entries) { + getEntriesModel().refresh(System.nanoTime(), entries); + } + + public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(propertyName, listener); + } + + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + if (listener == null || changeSupport == null) { + return; + } + changeSupport.removePropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListeners() { + if (changeSupport == null) { + return; + } + for (PropertyChangeListener listener : getPropertyChangeListeners()) { + changeSupport.removePropertyChangeListener(listener); + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners() { + if (changeSupport == null) { + return new PropertyChangeListener[0]; + } + return changeSupport.getPropertyChangeListeners(); + } + + public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (changeSupport == null || (oldValue == null && newValue == null) || + (oldValue != null && oldValue.equals(newValue))) { + return; + } + changeSupport.firePropertyChange(propertyName, oldValue, newValue); + } +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,199 @@ +/* +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package org.codelutin.vcs.ui.util; + +import static org.codelutin.i18n.I18n._; +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntries; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.type.VCSState; +import org.codelutin.vcs.util.VCSEntriesImpl; + +import javax.swing.ListSelectionModel; +import java.util.ArrayList; +import java.util.List; + +/** + * Simple Table model to display list of VCSFileState + * + * @author chemit + */ +public abstract class AbstractVCSEntriesTableModel extends javax.swing.table.AbstractTableModel implements VCSEntries { + + protected final String name; + + /** column names */ + protected final String[] columnNames; + + protected VCSEntryLocation location = VCSEntryLocation.UNKNOW; + + /** delegate model */ + protected final transient VCSEntries delegate; + + /** displayed entries */ + protected final transient List<VCSEntry> displayedEntries; + + private static final long serialVersionUID = 4697917831388337369L; + + protected AbstractVCSEntriesTableModel(String name, String[] columnNames) { + super(); + this.name = name; + this.columnNames = columnNames; + this.displayedEntries = new ArrayList<VCSEntry>(); + this.delegate = new VCSEntriesImpl(); + } + + public String getName() { + return name; + } + + public VCSEntryLocation getLocation() { + return location; + } + + public List<VCSEntry> getDisplayedEntries(ListSelectionModel selectionModel) { + return selectionModel == null ? new ArrayList<VCSEntry>(displayedEntries) : filter(selectionModel, displayedEntries); + } + + public int getColumnCount() { + return columnNames.length; + } + + public int getRowCount() { + return displayedEntries.size(); + } + + @Override + public String getColumnName(int columnIndex) { + return _(columnNames[columnIndex]); + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + // read only data + return false; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + // read only data + } + + public void setLocation(VCSEntryLocation location) { + this.location = location; + displayedEntries.clear(); + displayedEntries.addAll(filter(location)); + fireTableDataChanged(); + } + + public VCSAction[] getActions(ListSelectionModel selectionModel) { + return getActions(getDisplayedEntries(selectionModel)); + } + + @Override + public String toString() { + return super.toString() + "<name:" + name + ", size:" + (getRowCount()) + '>'; + } + + //===================================================================================================// + // === delegate methods =============================================================================// + //===================================================================================================// + + public List<VCSEntry> getEntries() { + return delegate.getEntries(); + } + + public List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries) { + return delegate.filter(action, entries); + } + + public List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries) { + return delegate.filter(connexion, entries); + } + + public List<VCSEntry> filter(VCSEntryLocation location) { + return delegate.filter(location); + } + + public List<VCSEntry> filter(VCSState state, List<VCSEntry> entries) { + return delegate.filter(state, entries); + } + + public List<VCSEntry> filter(ListSelectionModel selectionModel, List<VCSEntry> entries) { + return delegate.filter(selectionModel, entries); + } + + public void populate(VCSConnexion connexion, long timestamp) throws VCSException { + delegate.populate(connexion, timestamp); + updateEntries(); + } + + public void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location) throws VCSException { + delegate.populate(connexion, timestamp, location); + updateEntries(); + } + + public void populate(VCSConnexion connexion, long timestamp, VCSEntryLocation location, List<String> relativeLocalPaths) throws VCSException { + delegate.populate(connexion, timestamp, location, relativeLocalPaths); + updateEntries(); + } + + public void populate(VCSEntryLocation location, VCSEntry[] states) { + clear(); + this.location = location; + delegate.populate(location, states); + updateEntries(); + } + + public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException { + delegate.refresh(timestamp, entries); + updateEntries(); + } + + public VCSAction[] getActions(List<VCSEntry> entries) { + return delegate.getActions(entries); + } + + public VCSState[] getStates(List<VCSEntry> entries) { + return delegate.getStates(entries); + } + + public void clear() { + delegate.clear(); + displayedEntries.clear(); + fireTableDataChanged(); + } + + protected void updateEntries() { + displayedEntries.clear(); + displayedEntries.addAll(filter(location)); + fireTableDataChanged(); + } + + public VCSEntry getDisplayedEntry(int row) { + if (row < -1 || row > displayedEntries.size() - 1) { + throw new IllegalArgumentException("index " + row + " is out of bound [0," + (displayedEntries.size() - 1) + "]"); + } + return displayedEntries.get(row); + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java (from rev 440, trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/UIHelper.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,62 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui.util; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JRootPane; +import javax.swing.JTable; +import javax.swing.KeyStroke; +import java.awt.Color; +import java.awt.event.ActionEvent; + +/** + * UI Helper methods + * + * @author chemit + */ +public class UIHelper { + + public static void setQuitAction(final JDialog ui) { + JRootPane rootPane = ui.getRootPane(); + + Action quitAction = new AbstractAction("quit") { + private static final long serialVersionUID = -869095664995763057L; + + public void actionPerformed(ActionEvent e) { + ui.dispose(); + } + }; + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); + rootPane.getActionMap().put("quit", quitAction); + } + + public static void installVCSTableUI(JTable table) { + table.putClientProperty("vcs.color.MODIFIED", new Color(0, 50, 160)); + table.putClientProperty("vcs.color.OUT_OF_DATE_AND_MODIFIED", Color.RED); + table.putClientProperty("vcs.color.OUT_OF_DATE", new Color(10, 119, 0)); + table.putClientProperty("vcs.color.UNVERSIONNED", new Color(153, 51, 0)); + table.putClientProperty("vcs.color.UNKNOWN", new Color(153, 51, 0)); + table.putClientProperty("vcs.color.MERGED", new Color(117, 3, 220)); + table.putClientProperty("vcs.color.IGNORED", new Color(114, 114, 56)); + table.putClientProperty("vcs.color.REMOVED", new Color(97, 97, 97)); + table.putClientProperty("vcs.color.MISSING", new Color(119, 56, 149)); + + table.setDefaultRenderer(Object.class, VCSEntriesTableRenderer.get()); + } + +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/VCSEntriesTableRenderer.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/VCSEntriesTableRenderer.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/VCSEntriesTableRenderer.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,72 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.util; + +import org.codelutin.vcs.VCSEntry; + +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.Color; +import java.awt.Component; + +/** @author chemit */ +public class VCSEntriesTableRenderer extends DefaultTableCellRenderer { + static VCSEntriesTableRenderer renderer; + + public static DefaultTableCellRenderer get() { + if (renderer == null) { + renderer = new VCSEntriesTableRenderer(); + } + return renderer; + } + + Color defaultColor; + + public Color getDefaultColor(Component rendererComponent) { + if (defaultColor == null) { + defaultColor = rendererComponent.getForeground(); + } + return defaultColor; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + JComponent rendererComponent = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + Color color = getDefaultColor(rendererComponent); + String tooltip = null; + if (table.getModel() instanceof AbstractVCSEntriesTableModel) { + VCSEntry entry = getEntry(table, row); + tooltip = entry.getRelativeLocalPath(); + if (table.getColumnName(column).equals("Status")) { + color = getColor(color, entry, table); + } + } + rendererComponent.setForeground(color); + rendererComponent.setToolTipText(tooltip); + return rendererComponent; + } + + protected Color getColor(Color color, VCSEntry entry, JTable table) { + Color col = (Color) table.getClientProperty("vcs.color." + entry.getState().name()); + return col != null ? col : color; + } + + protected VCSEntry getEntry(JTable table, int row) { + AbstractVCSEntriesTableModel model = (AbstractVCSEntriesTableModel) table.getModel(); + return model.getDisplayedEntry(row); + } + +} Deleted: trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer 2008-04-11 02:51:22 UTC (rev 444) @@ -1 +0,0 @@ -org.codelutin.vcs.ui.VCSInitializer \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/META-INF/services/jaxx.spi.Initializer 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1 @@ +org.codelutin.vcs.ui.VCSInitializer \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/pom.xml =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/pom.xml 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/pom.xml 2008-04-11 02:51:22 UTC (rev 444) @@ -36,6 +36,22 @@ <goal>run</goal> </goals> </execution> + <execution> + <id>CopyGenJavaVersSrcBuild</id> + <phase>validate</phase> + <configuration> + <tasks> + <copy todir="${maven.src.dir}/main/java" verbose="${maven.verbose}" overwrite="true"> + <fileset dir="${maven.src.dir}/main/uimodel"> + <include name="**/*.java"/> + </fileset> + </copy> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> </executions> </plugin> <plugin> @@ -60,7 +76,7 @@ </dependency--> <dependency> <groupId>lutinlib.vcs</groupId> - <artifactId>lutinvcs-ui-pre-jaxx</artifactId> + <artifactId>lutinvcs-ui-common</artifactId> <scope>compile</scope> <version>${current.version}</version> </dependency> @@ -69,11 +85,14 @@ <plugin> <groupId>lutinplugin</groupId> <artifactId>maven-i18n-plugin</artifactId> + <configuration> + <defaultBasedir>${maven.src.dir}/main/uimodel</defaultBasedir> + </configuration> <executions> <execution> - <phase>process-classes</phase> + <phase>compile</phase> <goals> - <goal>parserJava</goal> + <goal>parserJaxx</goal> <goal>gen</goal> </goals> </execution> Added: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/META-INF/services/org.codelutin.vcs.ui.VCSUIProvider =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/META-INF/services/org.codelutin.vcs.ui.VCSUIProvider (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/META-INF/services/org.codelutin.vcs.ui.VCSUIProvider 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1 @@ +org.codelutin.vcs.ui.JaxxVCSUIProvider \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/vcs-jaxx.rules =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/vcs-jaxx.rules (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/vcs-jaxx.rules 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,3 @@ +//SynchUI/@title +//DiffUI/@title +//ConfirmUI/@title \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -1,54 +0,0 @@ -<AbstractConfirmUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true' - resizable='false' height='300' width='400'> - <style source="common.css"/> - <Table> - <row fill='both'> - <cell fill='both'> - <JLabel id="actionLabel" text="lutinvcs.confirm.message"/> - </cell> - </row> - <row fill='both'> - <cell fill='both' weightx='1'> - <Table id="toolbar" fill='both'> - <row> - <cell> - <JToolBar id='tool'> - <JLabel id="actionCommitLabel" text="lutinvcs.commit.message"/> - <Table fill='both' insets='0,0,0,0'> - <row> - <cell fill='both'/> - </row> - </Table> - <JButton id='lastMessages' toolTipText="lutinvcs.action.tooltip.lastMessages" - icon='{createImageIcon("recent_msgs.png")}' - onActionPerformed='showLastMessages()'/> - </JToolBar> - </cell> - </row> - <row fill='both'> - <cell fill='both' columns='3' weightx='1'> - <JScrollPane id="commitScroll" height='90' verticalScrollBarPolicy="20" - columnHeaderView="{tool}"> - <JTextArea id="commitMessage" constructorParams="4,50"/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1' weighty='1'> - <JScrollPane id='content' styleClass='confirmScroll'> - <JTable id="contentTable" styleClass='confirmTable'/> - <!--JTable id="contentTable" styleClass='confirmTable' model="{getModel().getEntriesModel()}"/--> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='both'> - <JButton id='accept' text='lutinvcs.accept' onActionPerformed='doAccept()'/> - </cell> - </row> - </Table> -</AbstractConfirmUI> - \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -1,69 +0,0 @@ -<AbstractSynchUI title='lutinvcs.synch.title' defaultCloseOperation='DISPOSE_ON_CLOSE'> - <style source="common.css"/> - - <java.awt.CardLayout id='cardLayout'/> - - <JVCSPopup id="allPopup"/> - <JVCSPopup id="localPopup"/> - <JVCSPopup id="remotePopup"/> - - <Table id='table'> - <row fill='both'> - <cell fill='both' weightx='1'> - <JToolBar> - - <JToggleButton id='allTab' buttonGroup='tabs' text='lutinvcs.tabs.all' mnemonic="A" - toolTipText="lutinvcs.tabs.tooltip.all" - onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.ALL)'/> - - <JToggleButton id='localTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.local' - mnemonic="L" toolTipText="lutinvcs.tabs.tooltip.local" - onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.LOCAL)'/> - - <JToggleButton id='remoteTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.remote' - mnemonic="R" toolTipText="lutinvcs.tabs.tooltip.remote" - onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.REMOTE)'/> - - <JButton id='refreshAll' toolTipText="lutinvcs.action.tooltip.refreshAll" - icon='{createImageIcon("autoRefresh.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REFRESH,false)'/> - - <JButton id='diffAll' toolTipText="lutinvcs.action.tooltip.diffAll" - icon='{createImageIcon("diff.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DIFF,false)'/> - - <JButton id='updateAll' toolTipText="lutinvcs.action.tooltip.updateAll" - icon='{createImageIcon("update.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.UPDATE,false)'/> - - <JButton id='commitAll' toolTipText="lutinvcs.action.tooltip.commitAll" - icon='{createImageIcon("commit.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.COMMIT,false)'/> - - <JButton id='revertAll' toolTipText="lutinvcs.action.tooltip.revertAll" - icon='{createImageIcon("rollback.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REVERT,false)'/> - - <JButton id='deleteAll' toolTipText="lutinvcs.action.tooltip.deleteAll" - icon='{createImageIcon("remove.png")}' - onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DELETE,false)'/> - </JToolBar> - </cell> - </row> - <row fill='both'> - <cell fill='both' weighty='1' weightx='2'> - <JPanel id='preview' layout='{cardLayout}'> - <JScrollPane id='allContent' styleClass='updateScroll' constraints='"taball"'> - <JTable id="allTable" styleClass='updateTable'/> - </JScrollPane> - <JScrollPane id='localContent' styleClass='updateScroll' constraints='"tablocal"'> - <JTable id="localTable" styleClass='updateTable'/> - </JScrollPane> - <JScrollPane id='remoteContent' styleClass='updateScroll' constraints='"tabremote"'> - <JTable id="remoteTable" styleClass='updateTable'/> - </JScrollPane> - </JPanel> - </cell> - </row> - </Table> -</AbstractSynchUI> \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSPopup.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSPopup.jaxx 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSPopup.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -1,24 +0,0 @@ -<AbstractVCSPopup> - <script> - import org.codelutin.vcs.type.VCSAction; - - add(refresh); - add(diff); - add(update); - add(commit); - add(revert); - add(delete); - </script> - <JMenuItem id='refresh' text='{_("lutinvcs.action.refresh")}' toolTipText='{_("lutinvcs.action.tooltip.refresh")}' - icon='{createImageIcon("autoRefresh.png")}' onActionPerformed='doAction(VCSAction.REFRESH,refresh)'/> - <JMenuItem id='diff' text='{_("lutinvcs.action.diff")}' toolTipText='{_("lutinvcs.action.tooltip.diff")}' - icon='{createImageIcon("diff.png")}' onActionPerformed='doAction(VCSAction.DIFF,diff)'/> - <JMenuItem id='update' text='{_("lutinvcs.action.update")}' toolTipText='{_("lutinvcs.action.tooltip.update")}' - icon='{createImageIcon("update.png")}' onActionPerformed='doAction(VCSAction.UPDATE,update)'/> - <JMenuItem id='commit' text='{_("lutinvcs.action.commit")}' toolTipText='{_("lutinvcs.action.tooltip.commit")}' - icon='{createImageIcon("commit.png")}' onActionPerformed='doAction(VCSAction.COMMIT,commit)'/> - <JMenuItem id='revert' text='{_("lutinvcs.action.revert")}' toolTipText='{_("lutinvcs.action.tooltip.revert")}' - icon='{createImageIcon("rollback.png")}' onActionPerformed='doAction(VCSAction.REVERT,revert)'/> - <JMenuItem id='delete' text='{_("lutinvcs.action.delete")}' toolTipText='{_("lutinvcs.action.tooltip.delete")}' - icon='{createImageIcon("remove.png")}' onActionPerformed='doAction(VCSAction.DELETE,delete)'/> -</AbstractVCSPopup> \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,53 @@ +<ConfirmUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true' + resizable='false' height='300' width='400'> + <style source="common.css"/> + <Table> + <row fill='both'> + <cell fill='both'> + <JLabel id="actionLabel" text="lutinvcs.confirm.message"/> + </cell> + </row> + <row fill='both'> + <cell fill='both' weightx='1'> + <Table id="toolbar" fill='both'> + <row> + <cell> + <JToolBar id='tool'> + <JLabel id="actionCommitLabel" text="lutinvcs.commit.message"/> + <Table fill='both' insets='0,0,0,0'> + <row> + <cell fill='both'/> + </row> + </Table> + <JButton id='lastMessages' toolTipText="lutinvcs.action.tooltip.lastMessages" + icon='{createImageIcon("recent_msgs.png")}' + onActionPerformed='showLastMessages()'/> + </JToolBar> + </cell> + </row> + <row fill='both'> + <cell fill='both' columns='3' weightx='1'> + <JScrollPane id="commitScroll" height='90' verticalScrollBarPolicy="20" + columnHeaderView="{tool}"> + <JTextArea id="commitMessage" constructorParams="4,50"/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JScrollPane id='content' styleClass='confirmScroll'> + <JTable id="contentTable" styleClass='confirmTable'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='both'> + <JButton id='accept' text='lutinvcs.accept' onActionPerformed='doAccept()'/> + </cell> + </row> + </Table> +</ConfirmUI> + \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JDiffUI.jaxx) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,80 @@ +<DiffUI title='lutinvcs.diff.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='600' width='500'> + <style source="common.css"/> + <java.awt.CardLayout id='cardLayout'/> + + <Table> + <row fill='both'> + <cell fill='both' weightx='1'> + <JToolBar> + <JToggleButton id='allTab' selected='false' buttonGroup='tabs' mnemonic="A" + toolTipText="lutinvcs.tabs.diff.tooltip.all" + icon='{createImageIcon("remote_vs_local.png")}' + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.ALL)'/> + + <JToggleButton id='localTab' selected='false' buttonGroup='tabs' mnemonic="L" + toolTipText="lutinvcs.tabs.diff.tooltip.local" + icon='{createImageIcon("local_vs_local.png")}' + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.LOCAL)'/> + + <JToggleButton id='remoteTab' selected='false' buttonGroup='tabs' mnemonic="R" + icon='{createImageIcon("remote_vs_remote.png")}' + toolTipText="lutinvcs.tabs.diff.tooltip.remote" + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.REMOTE)'/> + + <JButton id='nextDiff' toolTipText="lutinvcs.action.tooltip.nextDiff" + icon='{createImageIcon("diff-next.png")}' onActionPerformed='gotoNextDiff()'/> + + <JButton id='previousDiff' toolTipText="lutinvcs.action.tooltip.previousDiff" + icon='{createImageIcon("diff-prev.png")}' onActionPerformed='gotoPreviousDiff()'/> + + <JButton id='refresh' toolTipText="lutinvcs.action.tooltip.refresh" + icon='{createImageIcon("autoRefresh.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REFRESH)'/> + + <JButton id='update' toolTipText="lutinvcs.action.tooltip.update" + icon='{createImageIcon("update.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.UPDATE)'/> + + <JButton id='commit' toolTipText="lutinvcs.action.tooltip.commit" + icon='{createImageIcon("commit.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.COMMIT)'/> + + <JButton id='revert' toolTipText="lutinvcs.action.tooltip.revert" + icon='{createImageIcon("rollback.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REVERT)'/> + + <JButton id='delete' toolTipText="lutinvcs.action.tooltip.delete" + icon='{createImageIcon("remove.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DELETE)'/> + </JToolBar> + </cell> + </row> + <row fill='both'> + <cell fill='both'> + <JPanel id='preview' layout='{cardLayout}'> + <JScrollPane id='allContent' styleClass='diffScroll' constraints='"taball"' height='100'> + <JTable id="allTable" styleClass='diffTable' onMouseClicked="doSelectFile()"/> + </JScrollPane> + <JScrollPane id='localContent' styleClass='diffScroll' constraints='"tablocal"' height='100'> + <JTable id="localTable" styleClass='diffTable' onMouseClicked="doSelectFile()"/> + </JScrollPane> + <JScrollPane id='remoteContent' styleClass='diffScroll' constraints='"tabremote"' height='100'> + <JTable id="remoteTable" styleClass='diffTable' onMouseClicked="doSelectFile()"/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row fill='both'> + <cell fill='both' weighty='1' weightx='1'> + <JSplitPane id='splitPane2' orientation='horizontal' resizeWeight="0.5" dividerLocation="{0.5}"> + <JScrollPane id='remoteEditorScroll' styleClass='diffScroll'> + <JTextArea id="remoteEditorContent" editable='false'/> + </JScrollPane> + <JScrollPane id='localEditorScroll' styleClass='diffScroll'> + <JTextArea id="localEditorContent"/> + </JScrollPane> + </JSplitPane> + </cell> + </row> + </Table> +</DiffUI> Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JSynchUI.jaxx) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,98 @@ +<SynchUI title='lutinvcs.synch.title' defaultCloseOperation='DISPOSE_ON_CLOSE'> + <style source="common.css"/> + + <java.awt.CardLayout id='cardLayout'/> + <!--JPopupMenu/--> + <!--org.codelutin.vcs.ui.impl.JPopup id="allPopup"/> + <org.codelutin.vcs.ui.impl.JPopup id="localPopup"/> + <org.codelutin.vcs.ui.impl.JPopup id="remotePopup"/--> + + + <Table id='table'> + <row fill='both'> + <cell fill='both' weightx='1'> + <JToolBar> + <JToggleButton id='allTab' buttonGroup='tabs' text='lutinvcs.tabs.all' mnemonic="A" + toolTipText="lutinvcs.tabs.tooltip.all" + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.ALL)'/> + + <JToggleButton id='localTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.local' + mnemonic="L" toolTipText="lutinvcs.tabs.tooltip.local" + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.LOCAL)'/> + + <JToggleButton id='remoteTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.remote' + mnemonic="R" toolTipText="lutinvcs.tabs.tooltip.remote" + onActionPerformed='setLocation(org.codelutin.vcs.type.VCSEntryLocation.REMOTE)'/> + + <JButton id='refreshAll' toolTipText="lutinvcs.action.tooltip.refreshAll" + icon='{createImageIcon("autoRefresh.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REFRESH,false)'/> + + <JButton id='diffAll' toolTipText="lutinvcs.action.tooltip.diffAll" + icon='{createImageIcon("diff.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DIFF,false)'/> + + <JButton id='updateAll' toolTipText="lutinvcs.action.tooltip.updateAll" + icon='{createImageIcon("update.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.UPDATE,false)'/> + + <JButton id='commitAll' toolTipText="lutinvcs.action.tooltip.commitAll" + icon='{createImageIcon("commit.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.COMMIT,false)'/> + + <JButton id='revertAll' toolTipText="lutinvcs.action.tooltip.revertAll" + icon='{createImageIcon("rollback.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REVERT,false)'/> + + <JButton id='deleteAll' toolTipText="lutinvcs.action.tooltip.deleteAll" + icon='{createImageIcon("remove.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DELETE,false)'/> + </JToolBar> + </cell> + </row> + <row fill='both'> + <cell fill='both' weighty='1' weightx='2'> + <JPanel id='preview' layout='{cardLayout}'> + <JScrollPane id='allContent' styleClass='updateScroll' constraints='"taball"'> + <JTable id="allTable" styleClass='updateTable'/> + </JScrollPane> + <JScrollPane id='localContent' styleClass='updateScroll' constraints='"tablocal"'> + <JTable id="localTable" styleClass='updateTable'/> + </JScrollPane> + <JScrollPane id='remoteContent' styleClass='updateScroll' constraints='"tabremote"'> + <JTable id="remoteTable" styleClass='updateTable'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell> + <JPopupMenu id="popup"> + <JMenuItem id='refresh' text='lutinvcs.action.refresh' toolTipText='lutinvcs.action.tooltip.refresh' + icon='{createImageIcon("autoRefresh.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REFRESH,true)'/> + + <JMenuItem id='diff' text='lutinvcs.action.diff' toolTipText='lutinvcs.action.tooltip.diff' + icon='{createImageIcon("diff.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DIFF,true)'/> + + <JMenuItem id='update' text='lutinvcs.action.update' toolTipText='lutinvcs.action.tooltip.update' + icon='{createImageIcon("update.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.UPDATE,true)'/> + + <JMenuItem id='commit' text='lutinvcs.action.commit' toolTipText='lutinvcs.action.tooltip.commit' + icon='{createImageIcon("commit.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.COMMIT,true)'/> + + <JMenuItem id='revert' text='lutinvcs.action.revert' toolTipText='lutinvcs.action.tooltip.revert' + icon='{createImageIcon("rollback.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.REVERT,true)'/> + + <JMenuItem id='delete' text='lutinvcs.action.delete' toolTipText='lutinvcs.action.tooltip.delete' + icon='{createImageIcon("remove.png")}' + onActionPerformed='doAction(org.codelutin.vcs.type.VCSAction.DELETE,true)'/> + </JPopupMenu> + </cell> + </row> + </Table> +</SynchUI> \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,23 @@ +/** + * ##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##% + */ +package org.codelutin.vcs.ui; + +/** @author chemit */ +public class JaxxVCSUIProvider extends VCSUIProvider { + + public JaxxVCSUIProvider() { + super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxConfirmUI.class); + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-11 02:16:33 UTC (rev 443) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-11 02:51:22 UTC (rev 444) @@ -1,56 +0,0 @@ -JToolBar { - floatable: false; - focusable: false; - opaque: false; - margin: 0; - borderPainted: false; -} - -JButton { - opaque: false; - borderPainted: false; - enabled: false; - margin: 0; -} - -JToggleButton { - opaque: false; - borderPainted: false; - margin: 0; -} - -JMenuItem { - enabled: true; -} - -JMenu { - enabled: true; -} - -.smallSize { - font-size: 9; -} - -.updateTable { - rowSelectionAllowed: true; - /*autoResizeMode: auto_resize_all_columns; - autoResizeMode: auto_resize_last_column;*/ - showVerticalLines: false; - cellSelectionEnabled: false; - rowMargin: 0; - selectionMode: { ListSelectionModel . MULTIPLE_INTERVAL_SELECTION -} - -; -} - -.updateScroll { - verticalScrollBarPolicy: 20; - horizontalScrollBarPolicy: 31; - visible: false; -} - -.diffScroll { - verticalScrollBarPolicy: 20; - horizontalScrollBarPolicy: 31; -} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-11 02:51:22 UTC (rev 444) @@ -0,0 +1,66 @@ +JToolBar { + floatable: false; + focusable: false; + opaque: false; + margin: 0; + borderPainted: false; +} + +JButton { + opaque: false; + borderPainted: false; + enabled: false; + margin: 0; +} + +JToggleButton { + opaque: false; + borderPainted: false; + margin: 0; +} + +JMenuItem { + enabled: true; +} + +JMenu { + enabled: true; +} + +.smallSize { + font-size: 9; +} + +.updateTable { + rowSelectionAllowed: true; + /*autoResizeMode: auto_resize_all_columns; + autoResizeMode: auto_resize_last_column;*/ + showVerticalLines: false; + cellSelectionEnabled: false; + rowMargin: 0; + selectionMode: { ListSelectionModel . MULTIPLE_INTERVAL_SELECTION +} + +; +} + +.updateScroll { + verticalScrollBarPolicy: 20; + horizontalScrollBarPolicy: 31; + visible: false; +} + +.diffScroll { + verticalScrollBarPolicy: 20; + horizontalScrollBarPolicy: 31; +} + +.diffTable { + rowSelectionAllowed: true; + /*autoResizeMode: auto_resize_all_columns; + autoResizeMode: auto_resize_last_column;*/ + showVerticalLines: false; + cellSelectionEnabled: false; + rowMargin: 0; + selectionMode: 0; +} \ No newline at end of file