r457 - in trunk/lutinvcs: . lutinvcs-all lutinvcs-core lutinvcs-core/src/main/java/org/codelutin/vcs lutinvcs-core/src/main/java/org/codelutin/vcs/type lutinvcs-core/src/main/java/org/codelutin/vcs/util lutinvcs-core/src/main/resources/i18n lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model lutinvcs-ui-common/
Author: tchemit Date: 2008-04-13 07:55:46 +0000 (Sun, 13 Apr 2008) New Revision: 457 Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-add.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-commit.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-delete.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-next.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-prev.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-help.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-refresh.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-revert.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-showmessages.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-update.png Removed: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/add.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/commit.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/delete.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-next.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-prev.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/help.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/recent_msgs.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/refresh.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/revert.png trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/update.png Modified: trunk/lutinvcs/lutinvcs-all/pom.xml trunk/lutinvcs/lutinvcs-core/pom.xml trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-en_GB.properties trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-fr_FR.properties 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/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-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/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/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/AbstractVCSEntriesTableModel.java trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-en_GB.properties trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-fr_FR.properties trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-en_GB.properties trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-fr_FR.properties 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/common.css trunk/lutinvcs/pom.xml Log: ui continues... Modified: trunk/lutinvcs/lutinvcs-all/pom.xml =================================================================== --- trunk/lutinvcs/lutinvcs-all/pom.xml 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-all/pom.xml 2008-04-13 07:55:46 UTC (rev 457) @@ -17,24 +17,6 @@ <version>${current.version}</version> <description>Lutinvcs all modules</description> - <build> - <!--plugins> - <plugin> - <groupId>lutinplugin</groupId> - <artifactId>maven-i18n-plugin</artifactId> - <executions> - <execution> - <phase>process-classes</phase> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins--> - </build> - <dependencies> <dependency> <groupId>lutinlib.vcs</groupId> @@ -43,6 +25,11 @@ </dependency> <dependency> <groupId>lutinlib.vcs</groupId> + <artifactId>lutinvcs-all-providers</artifactId> + <scope>compile</scope> + </dependency> + <!--dependency> + <groupId>lutinlib.vcs</groupId> <artifactId>lutinvcs-provider-mock</artifactId> <scope>compile</scope> </dependency> @@ -55,7 +42,7 @@ <groupId>lutinlib.vcs</groupId> <artifactId>lutinvcs-provider-cvs</artifactId> <scope>compile</scope> - </dependency> + </dependency--> <dependency> <groupId>lutinlib.vcs</groupId> <artifactId>lutinvcs-ui-jaxx</artifactId> Modified: trunk/lutinvcs/lutinvcs-core/pom.xml =================================================================== --- trunk/lutinvcs/lutinvcs-core/pom.xml 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/pom.xml 2008-04-13 07:55:46 UTC (rev 457) @@ -34,12 +34,4 @@ </plugin> </plugins> </build> - - <dependencies> - <dependency> - <groupId>lutinlib.vcs</groupId> - <artifactId>lutinvcs-api</artifactId> - <scope>compile</scope> - </dependency> - </dependencies> </project> 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-13 07:55:46 UTC (rev 457) @@ -19,6 +19,7 @@ import org.codelutin.vcs.type.VCSState; import java.util.List; +import java.util.EnumMap; /** * Contract of list of VCSEntry. @@ -78,20 +79,22 @@ void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException; /** + * //TODO update javadoc, use efficient algo * obtain the array of all {@link VCSAction} found in the given entries * * @param entries entries to scan * @return array of {@link VCSAction} found in entires */ - VCSAction[] getActions(List<VCSEntry> entries); + EnumMap<VCSAction, Integer> countActions(List<VCSEntry> entries); /** + * //TODO update javadoc,... * obtain the array of all {@link VCSState} found in the given entries * * @param entries entries to scan * @return array of {@link VCSState found in entires */ - VCSState[] getStates(List<VCSEntry> entries); + EnumMap<VCSState, Integer> countStates(List<VCSEntry> entries); /** clear the internal list of entries. */ void clear(); Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java 2008-04-13 07:55:46 UTC (rev 457) @@ -31,35 +31,32 @@ * <li>{@link #REMOTE} : if entryis only on remote</li> * <p/> * </ul> - * VCSAction represents an action that can be realized on a file in working - * copy or on remote repository. - * <p/> - * Each <code>VCSAction</code> has 4 properties : - * <ul> - * <li>libelle : i18n to be used for this action</li> - * <li>visible : flag to say if action should be visible in ui</li> - * <li>backup : flag to say if this action need backup</li> - * <li>write : flag to say if this action need write access to repository</li> - * </ul> * * @author chemit */ @org.codelutin.i18n.I18nable public enum VCSEntryLocation { - ALL(n_("lutinvcs.location.all")), - LOCAL(n_("lutinvcs.location.local")), - REMOTE(n_("lutinvcs.location.remote")), - UNKNOW(n_("lutinvcs.location.unknown")); + ALL(n_("lutinvcs.location.all.libelle"), n_("lutinvcs.location.all.tip")), + LOCAL(n_("lutinvcs.location.local.libelle"), n_("lutinvcs.location.local.tip")), + REMOTE(n_("lutinvcs.location.remote.libelle"), n_("lutinvcs.location.remote.tip")), + UNKNOW(n_("lutinvcs.location.unknown.libelle"), n_("lutinvcs.location.unknow.tip")); /** libelle of location */ private final String libelle; + private final String tip; + public String getLibelle() { return _(libelle); } - VCSEntryLocation(String libelle) { + public String getTip() { + return _(tip); + } + + VCSEntryLocation(String libelle, String tip) { this.libelle = libelle; + this.tip = tip; } } \ No newline at end of file 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/util/VCSEntriesImpl.java 2008-04-13 07:55:46 UTC (rev 457) @@ -22,10 +22,12 @@ import org.codelutin.vcs.type.VCSEntryLocation; import org.codelutin.vcs.type.VCSState; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.EnumMap; +import java.util.EnumSet; import java.util.List; -import java.io.File; /** @author chemit */ public class VCSEntriesImpl implements VCSEntries { @@ -145,8 +147,23 @@ } - public VCSAction[] getActions(List<VCSEntry> entries) { - List<VCSAction> result = new ArrayList<VCSAction>(); + public EnumMap<VCSAction, Integer> countActions(List<VCSEntry> entries) { + EnumSet<VCSAction> set = EnumSet.allOf(VCSAction.class); + EnumMap<VCSAction, Integer> map = new EnumMap<VCSAction, Integer>(VCSAction.class); + int[] tmp = new int[set.size()]; + for (VCSEntry entry : entries) { + if (entry.getState() != null) { + for (VCSAction action : entry.getState().getActions()) { + tmp[action.ordinal()]++; + } + } + } + for (VCSAction vcsAction : set) { + int index = vcsAction.ordinal(); + map.put(vcsAction, tmp[index]); + } + return map; + /*List<VCSAction> result = new ArrayList<VCSAction>(); for (VCSState vcsFileState : getStates(entries)) { List<VCSAction> action = vcsFileState.getActions(); for (VCSAction vcsAction : action) { @@ -155,10 +172,25 @@ } } } - return result.toArray(new VCSAction[result.size()]); + return result.toArray(new VCSAction[result.size()]);*/ } - public VCSState[] getStates(List<VCSEntry> entries) { + public EnumMap<VCSState, Integer> countStates(List<VCSEntry> entries) { + EnumSet<VCSState> set = EnumSet.allOf(VCSState.class); + EnumMap<VCSState, Integer> map = new EnumMap<VCSState, Integer>(VCSState.class); + int[] tmp = new int[set.size()]; + for (VCSEntry entry : entries) { + VCSState state = entry.getState(); + if (state != null) { + tmp[state.ordinal()]++; + } + } + for (VCSState state : set) { + int index = state.ordinal(); + map.put(state, tmp[index]); + } + return map; + /* List<VCSState> result = new ArrayList<VCSState>(); for (VCSEntry entry : entries) { VCSState state = entry.getState(); @@ -167,6 +199,7 @@ } } return result.toArray(new VCSState[result.size()]); + */ } protected List<String> transformToLocal(List<String> relativeRemotePath) { Modified: trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-en_GB.properties =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-en_GB.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-en_GB.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -14,10 +14,14 @@ lutinvcs.error.provider.init.connexion=could not instanciate connexion {0}, for provider {1}, reason\: {2} lutinvcs.error.provider.init.handler=could not instanciate handler {0}, for provider {1}, reason\: {2} lutinvcs.error.thread.action= -lutinvcs.location.all=All -lutinvcs.location.local=Local -lutinvcs.location.remote=Remote -lutinvcs.location.unknown=Unknow +lutinvcs.location.all.libelle=all +lutinvcs.location.all.tip=Show both local and remote files +lutinvcs.location.local.libelle=local +lutinvcs.location.local.tip=Show local files +lutinvcs.location.remote.libelle=remote +lutinvcs.location.remote.tip=Show remote files +lutinvcs.location.unknow.tip=Show unknown files... +lutinvcs.location.unknown.libelle=Unknow lutinvcs.state.missing=missing lutinvcs.state.modified=modified lutinvcs.state.outofdate=out of date Modified: trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-fr_FR.properties =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-fr_FR.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-core/src/main/resources/i18n/lutinvcs-core-fr_FR.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -1,9 +1,9 @@ lutinvcs.action.add=Ajouter -lutinvcs.action.changeLog=journal des changements +lutinvcs.action.changeLog=Journal des changements lutinvcs.action.checkout=R\u00E9cup\u00E9rer -lutinvcs.action.commit=Commiter +lutinvcs.action.commit=Publier lutinvcs.action.delete=Supprimer -lutinvcs.action.diff=voir les diff\u00E9rences +lutinvcs.action.diff=Voir les diff\u00E9rences lutinvcs.action.overwriteAndUpdate=Update lutinvcs.action.refresh=Rafra\u00EEchir lutinvcs.action.revert=Annuler les modifications @@ -14,16 +14,20 @@ lutinvcs.error.provider.init.connexion=Erreur lors de l''instanciation de la connexion {0}, provider {1}, cause\: {2} lutinvcs.error.provider.init.handler=Erreur lors de l''instanciation du handler {0}, provider {1}, cause\: {2} lutinvcs.error.thread.action= -lutinvcs.location.all=All -lutinvcs.location.local=Local -lutinvcs.location.remote=Remote -lutinvcs.location.unknown=Unknow +lutinvcs.location.all.libelle=Tout +lutinvcs.location.all.tip=Voir tous les fichiers locaux et distants +lutinvcs.location.local.libelle=Local +lutinvcs.location.local.tip=Voir uniquement les fichiers locaux +lutinvcs.location.remote.libelle=Distant +lutinvcs.location.remote.tip=Voir uniquement les fichiers distants +lutinvcs.location.unknow.tip=Voir uniquement les fichiers de type inconnu... +lutinvcs.location.unknown.libelle=Unknow lutinvcs.state.missing=non pr\u00E9sent lutinvcs.state.modified=modifi\u00E9 lutinvcs.state.outofdate=obsol\u00E8te lutinvcs.state.outofdateAndModified=modifi\u00E9 et obsol\u00E8te lutinvcs.state.removed=supprim\u00E9 lutinvcs.state.unknown=\u00E9tat inconnu -lutinvcs.state.unversionned=non versionn\u00E9 -lutinvcs.state.unversionnedOrMissing=non versionn\u00E9 ou non pr\u00E9sent localement +lutinvcs.state.unversionned=non publi\u00E9 +lutinvcs.state.unversionnedOrMissing=non publi\u00E9 ou non pr\u00E9sent localement lutinvcs.state.uptodate=fichier \u00E0 jour Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,9 +14,16 @@ */ package org.codelutin.vcs.ui; +import org.codelutin.vcs.ui.action.ShowMessagesAction; + +import javax.swing.AbstractAction; import javax.swing.AbstractButton; +import javax.swing.DefaultListModel; +import javax.swing.DefaultListSelectionModel; import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JToolBar; @@ -40,8 +47,16 @@ public abstract AbstractButton getAccept(); + public abstract JPopupMenu getPopup(); + + public abstract JList getMessages(); + + public abstract DefaultListSelectionModel getMessageSelectionModel(); + + public abstract DefaultListModel getMessageModel(); + public void doAccept() { - getHandler().doAction(getCommitMessage().getText(), getHandler().getModel().getEntriesModel()); + getHandler().doAction(getHandler().getCurrentMessage(), getHandler().getModel().getEntriesModel()); } @Override @@ -52,7 +67,7 @@ super.setVisible(b); } - protected void showLastMessages() { - getHandler().showLastMessages(); + protected AbstractAction createShowMessagesAction() { + return ShowMessagesAction.createAction(this); } } Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,9 +14,9 @@ */ package org.codelutin.vcs.ui; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.action.DiffAction; +import javax.swing.AbstractAction; import javax.swing.AbstractButton; /** @author chemit */ @@ -40,20 +40,7 @@ super.setVisible(b); } - protected void doSelectFile() { - VCSEntry entry = getHandler().getSelectedEntry(); - getHandler().getModel().setFileModel(entry); + protected AbstractAction createDiffAction(boolean goUp) { + return DiffAction.createAction(goUp, this); } - - protected void doAction(VCSAction action) { - getHandler().doAction(action, getHandler().getModel().getFileModel()); - } - - protected void gotoNextDiff() { - getHandler().gotoNextDiff(); - } - - protected void gotoPreviousDiff() { - getHandler().gotoPreviousDiff(); - } } Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,8 +14,6 @@ */ package org.codelutin.vcs.ui; -import org.codelutin.vcs.type.VCSAction; - import javax.swing.AbstractButton; import javax.swing.JPopupMenu; @@ -56,7 +54,4 @@ super.setVisible(b); } - protected void doAction(VCSAction action, boolean useSelection) { - getHandler().doAction(action, useSelection); - } } \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -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.action; + +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.util.AbstractTabUI; +import org.codelutin.vcs.ui.util.AbstractTabUIHandler; +import org.codelutin.vcs.ui.util.UIHelper; + +import javax.swing.AbstractAction; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class ChangeLocationAction extends org.codelutin.vcs.ui.util.AbstractUIAction<AbstractTabUIHandler<?, ?>> { + + protected VCSEntryLocation location; + + private static final long serialVersionUID = 1L; + + public static AbstractAction createAction(VCSEntryLocation location, AbstractTabUI<?> ui) { + ChangeLocationAction action = new ChangeLocationAction(location); + action.setUi(ui); + return action; + } + + public void actionPerformed(ActionEvent e) { + checkInit(); + if (location == null) { + return; + } + getHandler().getModel().setLocation(getLocation()); + } + + protected VCSEntryLocation getLocation() { + return location; + } + + protected void setLocation(VCSEntryLocation location) { + this.location = location; + } + + protected ChangeLocationAction(VCSEntryLocation location) { + super(location.getLibelle(), UIHelper.createLocationIcon(location)); + this.location = location; + putValue(SHORT_DESCRIPTION, location.getTip()); + putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0); + putValue(MNEMONIC_KEY, (int) ((String) getValue(NAME)).charAt(0)); + } + +} Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -0,0 +1,78 @@ +/** + * # #% 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.action; + +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.ConfirmUI; +import org.codelutin.vcs.ui.handler.ConfirmUIHandler; +import org.codelutin.vcs.ui.util.UIHelper; + +import javax.swing.AbstractAction; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class ConfirmAction extends org.codelutin.vcs.ui.util.AbstractUIAction<ConfirmUIHandler> { + + protected VCSAction action; + + private static final long serialVersionUID = 1L; + + public static AbstractAction createAction(VCSAction action, ConfirmUI ui) { + ConfirmAction action1 = new ConfirmAction(action); + action1.setUi(ui); + return action1; + } + + public void actionPerformed(ActionEvent e) { + checkInit(); + if (action == null) { + return; + } + switch (action) { + case CHANGELOG: + case DIFF: + case REFRESH: + return; + case CHECKOUT: + case OVERWRITE_AND_UPDATE: + case ADD: + case COMMIT: + case DELETE: + case REVERT: + case UPDATE: + ConfirmUIHandler handler = getHandler(); + handler.doAction(getHandler().getUi().getCommitMessage().getText(), handler.getModel().getEntriesModel()); + return; + } + throw new IllegalStateException("could not perform action for action " + action + " (" + this + ')'); + } + + protected VCSAction getAction() { + return action; + } + + protected void setAction(VCSAction action) { + this.action = action; + } + + protected ConfirmAction(VCSAction action) { + super(null, UIHelper.createActionIcon(action)); + this.action = action; + //putValue(SHORT_DESCRIPTION, action.getTip()); + putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0); + putValue(MNEMONIC_KEY, (int) (action.getLibelle()).charAt(0)); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -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.action; + +import org.codelutin.vcs.ui.DiffUI; +import org.codelutin.vcs.ui.handler.DiffUIHandler; +import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon; + +import javax.swing.AbstractAction; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class DiffAction extends org.codelutin.vcs.ui.util.AbstractUIAction<DiffUIHandler> { + + protected boolean goUp; + + private static final long serialVersionUID = 1L; + + public static AbstractAction createAction(boolean goUp, DiffUI ui) { + DiffAction action1 = new DiffAction(goUp); + action1.setUi(ui); + return action1; + } + + public void actionPerformed(ActionEvent e) { + checkInit(); + if (goUp) { + getHandler().gotoPreviousDiff(); + } else { + getHandler().gotoNextDiff(); + } + } + + public boolean isGoUp() { + return goUp; + } + + public void setGoUp(boolean goUp) { + this.goUp = goUp; + } + + protected DiffAction(boolean goUp) { + super(null, createActionIcon("diff-" + (goUp ? "prev" : "next"))); + this.goUp = goUp; + //putValue(SHORT_DESCRIPTION, action.getTip()); + //putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0); + //putValue(MNEMONIC_KEY, (int) (action.getLibelle()).charAt(0)); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -0,0 +1,50 @@ +/** + * # #% 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.action; + +import static org.codelutin.i18n.I18n._; +import org.codelutin.vcs.ui.util.AbstractUI; +import org.codelutin.vcs.ui.util.AbstractUIHandler; +import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon; + +import javax.swing.AbstractAction; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class HelpAction extends org.codelutin.vcs.ui.util.AbstractUIAction<AbstractUIHandler<?, ?>> { + + public static <H extends AbstractUIHandler<?, ?>> AbstractAction createAction(AbstractUI<H> ui) { + HelpAction action = new HelpAction(); + action.setUi(ui); + return action; + } + + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent e) { + checkInit(); + log.info("//TODO : " + this + ", " + ui); + } + + protected HelpAction() { + super(_("lutinvcs.action.help.libelle"), createActionIcon("help")); + String name = (String) getValue(NAME); + putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1); + putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1)); + putValue(NAME, null); + putValue(SHORT_DESCRIPTION, _("lutinvcs.action.help.tip")); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -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.action; + +import static org.codelutin.i18n.I18n._; +import org.codelutin.vcs.ui.ConfirmUI; +import org.codelutin.vcs.ui.handler.ConfirmUIHandler; +import org.codelutin.vcs.ui.util.UIHelper; + +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public class ShowMessagesAction extends org.codelutin.vcs.ui.util.AbstractUIAction<ConfirmUIHandler> { + + private static final long serialVersionUID = 1L; + + public static AbstractAction createAction(ConfirmUI ui) { + ShowMessagesAction action1 = new ShowMessagesAction(); + action1.setUi(ui); + return action1; + } + + public void actionPerformed(ActionEvent e) { + checkInit(); + + String currentMessage = getHandler().getCurrentMessage(); + + if (!getHandler().getModel().containsMessage(currentMessage)) { + // save currentmessage in special 0 row + getHandler().setMessage(0, false, true, currentMessage); + } else { + // select + getHandler().getUi().getMessageSelectionModel().setValueIsAdjusting(true); + getHandler().getUi().getMessages().setSelectedValue(currentMessage, true); + getHandler().getUi().getMessageSelectionModel().setValueIsAdjusting(false); + } + + getHandler().getUi().getPopup().show((AbstractButton) e.getSource(), 0, 0); + //log.info("//TODO:" + this + " : " + messages.size()); + + } + + protected ShowMessagesAction() { + super(null, UIHelper.createActionIcon("showmessages")); + putValue(SHORT_DESCRIPTION, _("lutinvcs.action.showmessages.tip")); + setEnabled(false); + } + +} \ No newline at end of file Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -0,0 +1,98 @@ +/** + * # #% 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.action; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.util.AbstractTabUI; +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 java.awt.event.ActionEvent; +import java.util.List; + +/** @author chemit */ +public class TabUIAction extends org.codelutin.vcs.ui.util.AbstractUIAction<AbstractTabUIHandler<?, ?>> { + + protected VCSAction action; + protected boolean useSelection; + + private static final long serialVersionUID = 1L; + + public static AbstractAction createAction(VCSAction action, boolean useSelection, AbstractTabUI<?> ui) { + TabUIAction action1 = new TabUIAction(action, useSelection); + action1.setUi(ui); + return action1; + } + + public void actionPerformed(ActionEvent e) { + checkInit(); + if (action == null) { + return; + } + AbstractTabUIHandler<?, ?> handler = getHandler(); + AbstractVCSEntriesTableModel model = handler.getModel().getEntriesModel(); + List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? handler.getSelectionModel() : null)); + switch (action) { + case CHANGELOG: + //TODO + return; + case DIFF: + handler.showDiffUI(useSelection, model, entries); + return; + case REFRESH: + handler.doRefresh(model, entries, handler.getSelectionModel()); + return; + case CHECKOUT: + case OVERWRITE_AND_UPDATE: + case ADD: + case COMMIT: + case DELETE: + case REVERT: + case UPDATE: + handler.showConfirmUI(action, model, entries); + return; + } + throw new IllegalStateException("could not perform action for action " + action + " (" + this + ')'); + } + + protected VCSAction getAction() { + return action; + } + + protected boolean isUseSelection() { + return useSelection; + } + + protected void setAction(VCSAction action) { + this.action = action; + } + + protected void setUseSelection(boolean useSelection) { + this.useSelection = useSelection; + } + + protected TabUIAction(VCSAction action, boolean useSelection) { + super(null, UIHelper.createActionIcon(action)); + this.useSelection = useSelection; + this.action = action; + //putValue(SHORT_DESCRIPTION, action.getTip()); + putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0); + putValue(MNEMONIC_KEY, (int) (action.getLibelle()).charAt(0)); + } + +} \ No newline at end of file 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,14 +14,25 @@ */ package org.codelutin.vcs.ui.handler; +import static org.codelutin.i18n.I18n._; import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.ui.ConfirmUI; import org.codelutin.vcs.ui.model.ConfirmUIModel; import org.codelutin.vcs.ui.util.AbstractUIHandler; import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.util.UIHelper; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JComponent; +import javax.swing.JList; import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import java.awt.Component; import java.beans.PropertyChangeEvent; import java.util.List; @@ -33,8 +44,49 @@ ui.setHandler(this); } - public ListSelectionModel getSelectionModel() { - return getUi().getContentTable().getSelectionModel(); + @Override + public void init() { + super.init(); + getUi().getMessageModel().addElement(""); + + getUi().getMessageSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting() && getUi().getPopup().isVisible()) { + getUi().getCommitMessage().setText((String) getUi().getMessages().getSelectedValue()); + } + } + }); + + getUi().getPopup().addPopupMenuListener(new PopupMenuListener() { + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + reset(); + } + + public void popupMenuCanceled(PopupMenuEvent e) { + reset(); + } + + void reset() { + // reset special row 0 (to save message different than history) + setMessage(0, false, false, ""); + if (log.isDebugEnabled()) { + log.debug(this); + } + } + }); + getUi().getMessages().setCellRenderer(new DefaultListCellRenderer() { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JComponent listCellRendererComponent = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + String s = value + ""; + log.info(s); + listCellRendererComponent.setToolTipText(s.isEmpty() ? null : s.replaceAll("\\n", "<br>")); + return listCellRendererComponent; + } + }); } public void propertyChange(PropertyChangeEvent evt) { @@ -44,30 +96,73 @@ String action = evt.getPropertyName(); if (ConfirmUIModel.ACCEPT_PROPERTY_CHANGED.equals(action)) { - updateUI(); + afterActionChanged(); return; } - if (ConfirmUIModel.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { - updateMessageUI(); + afterMessagesChanged(); return; } - - throw new IllegalStateException("unimplemented property changed : " + evt); + throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this); } - protected void updateUI() { + protected void afterActionChanged() { VCSAction action = getModel().getAction(); + getUi().getActionLabel().setIcon(UIHelper.createActionIcon(action)); + getUi().getToolbar().setVisible(action.isCommit()); getUi().getAccept().setText(action.getLibelle()); - getUi().getToolbar().setVisible(action.isCommit()); getUi().getHandler().getSelectionModel().setSelectionInterval(0, getModel().getEntriesModel().getRowCount() - 1); } - protected void updateMessageUI() { - // update message history combo box ? - getUi().getLastMessages().setEnabled(!getModel().getCommitMessages().isEmpty()); + protected void afterSelectionChanged() { + VCSAction action = getModel().getAction(); + int nb = UIHelper.countAction(action, getModel().getEntriesModel(), getUi().getHandler().getSelectionModel()); + String msg; + String tip = null; + if (nb > 0) { + if (nb > 1) { + msg = _("lutinvcs.action.message", action.getLibelle(), nb); + tip = _("lutinvcs.action.confirm.tooltip", action.getLibelle(), nb); + } else { + msg = _("lutinvcs.action.message.one", action.getLibelle()); + tip = _("lutinvcs.action.confirm.one.tooltip", action.getLibelle()); + } + } else { + msg = _("lutinvcs.action.action.noselection", action.getLibelle()); + } + + getUi().getAccept().setEnabled(nb > 0); + getUi().getActionLabel().setText(msg); + getUi().getAccept().setToolTipText(tip); } + protected void afterMessagesChanged() { + boolean empty = getModel().getCommitMessages().isEmpty(); + getUi().getLastMessages().setEnabled(!empty); + if (!empty) { + setMessage(1, true, true, getUi().getCommitMessage().getText()); + } + } + + public String getCurrentMessage() { + return getUi().getCommitMessage().getText().trim(); + } + + public void setMessage(int pos, boolean insert, boolean select, String text) { + ListSelectionModel selectionModel = getUi().getMessageSelectionModel(); + selectionModel.setValueIsAdjusting(true); + DefaultListModel listModel = getUi().getMessageModel(); + if (insert) { + listModel.insertElementAt(text, pos); + } else { + listModel.setElementAt(text, pos); + } + if (select) { + selectionModel.setSelectionInterval(pos, pos); + } + selectionModel.setValueIsAdjusting(false); + } + public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { VCSAction action = this.getModel().getAction(); @@ -75,6 +170,7 @@ List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); if (action.isCommit()) { + this.getModel().addCommitMessage(commitMessage); } else { @@ -91,7 +187,4 @@ getUi().dispose(); } - public void showLastMessages() { - log.info("//TODO: " + this); - } } 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,19 +14,19 @@ */ package org.codelutin.vcs.ui.handler; +import static org.codelutin.i18n.I18n._; import org.codelutin.vcs.VCSEntry; import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.ui.DiffUI; import org.codelutin.vcs.ui.model.DiffUIModel; import org.codelutin.vcs.ui.util.AbstractTabUIHandler; -import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import javax.swing.AbstractButton; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import java.beans.PropertyChangeEvent; -import java.util.ArrayList; -import java.util.List; +import java.util.Collections; +import java.util.EnumMap; /** @author chemit */ public class DiffUIHandler extends AbstractTabUIHandler<DiffUIModel, DiffUI> { @@ -42,67 +42,79 @@ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); } if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) { - VCSEntry model = (VCSEntry) evt.getNewValue(); - boolean hasActions = false; - List<VCSAction> actions = null; - if (model != null) { - actions = model.getState().getActions(); - hasActions = !actions.isEmpty(); - } - DiffUI ui = getUi(); - updateAction(actions, hasActions, ui.getUpdate(), VCSAction.UPDATE); - updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT); - updateAction(actions, hasActions, ui.getCommit(), VCSAction.COMMIT); - ui.getRefresh().setEnabled(hasActions); - } else { - super.propertyChange(evt); + afterSelectionChanged(); + return; } - } - - public void doSelectLocation() { - AbstractVCSEntriesTableModel fileStatesModel = getModel().getEntriesModel(); - if (fileStatesModel.getRowCount() > 0) { - getSelectionModel().addSelectionInterval(0, 0); + if (DiffUIModel.DIFF_PROPERTY_CHANGED.equals(evt.getPropertyName())) { + afterDiffAction(); + return; } + super.propertyChange(evt); } @Override - public void init() { - super.init(); - getUi().getContentTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - if (!e.getValueIsAdjusting()) { - getModel().setFileModel(getSelectedEntry()); - } + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + // update model selected file ? TODO Is this really necessary, + ListSelectionModel selectionModel = (ListSelectionModel) e.getSource(); + VCSEntry vcsEntry = null; + if (!selectionModel.isSelectionEmpty()) { + vcsEntry = getModel().getEntriesModel().getDisplayedEntry(selectionModel.getMinSelectionIndex()); } - }); + getModel().setFileModel(vcsEntry); + } } - public VCSEntry getSelectedEntry() { - ListSelectionModel selectionModel = getSelectionModel(); - if (selectionModel.isSelectionEmpty()) { - return null; + public void afterLocationChanged() { + if (getModel().getEntriesModel().getRowCount() > 0) { + // select first row + getSelectionModel().addSelectionInterval(0, 0); } - return getModel().getEntriesModel().getDisplayedEntry(selectionModel.getMinSelectionIndex()); } - public void doAction(VCSAction action, VCSEntry file) { - AbstractVCSEntriesTableModel model = getModel().getEntriesModel(); - List<VCSEntry> entries = new ArrayList<VCSEntry>(1); - entries.add(file); - //log.info(action + " : " + model); - if (action == VCSAction.REFRESH) { - doRefresh(model, entries, getSelectionModel()); - } else { - doConfirm(action, model, entries); - } + protected void afterSelectionChanged() { + + VCSEntry vcsEntry = getModel().getFileModel(); + EnumMap<VCSAction, Integer> actions = vcsEntry == null ? null : getModel().getEntriesModel().countActions(Collections.singletonList(vcsEntry)); + boolean hasActions = actions != null && !actions.isEmpty(); + DiffUI ui = getUi(); + updateAction(actions, hasActions, ui.getUpdate(), VCSAction.UPDATE, vcsEntry); + updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT, vcsEntry); + updateAction(actions, hasActions, ui.getCommit(), VCSAction.COMMIT, vcsEntry); + updateAction(actions, hasActions, ui.getRefresh(), VCSAction.REFRESH, vcsEntry); + //TODO init diff handler } + protected void afterDiffAction() { + DiffUI ui = getUi(); + boolean hasNext = getModel().hasNext(); + boolean hasPrevious = getModel().hasPrevious(); + log.info("//TODO :" + this + " next:" + hasNext + ", prev:" + hasPrevious); + ui.getNextDiff().setEnabled(hasNext); + ui.getPreviousDiff().setEnabled(hasPrevious); + ui.getNextDiff().setToolTipText(hasNext ? _("lutinvcs.action.nextdiff.tip") : null); + ui.getPreviousDiff().setToolTipText(hasPrevious ? _("lutinvcs.action.previousdiff.tip") : null); + + //TODO init diff handler + } + public void gotoNextDiff() { + getModel().setDiff(getModel().getDiff() + 1); log.info("//TODO :" + this); } public void gotoPreviousDiff() { + getModel().setDiff(getModel().getDiff() - 1); log.info("//TODO :" + this); } + + protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) { + super.updateAction(actions, hasActions, ui, action); + boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0; + String tip = null; + if (useAction) { + tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName()); + } + ui.setToolTipText(tip); + } } 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-13 07:55:46 UTC (rev 457) @@ -1,17 +1,18 @@ package org.codelutin.vcs.ui.handler; -import org.codelutin.vcs.VCSEntry; +import static org.codelutin.i18n.I18n._; import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.ui.SynchUI; import org.codelutin.vcs.ui.model.SynchUIModel; import org.codelutin.vcs.ui.util.AbstractTabUIHandler; -import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel; +import javax.swing.AbstractButton; +import javax.swing.JPopupMenu; +import javax.swing.JTable; import javax.swing.ListSelectionModel; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.Arrays; -import java.util.List; +import java.util.EnumMap; /** @author chemit */ public class SynchUIHandler extends AbstractTabUIHandler<SynchUIModel, SynchUI> { @@ -24,81 +25,94 @@ @Override public void init() { super.init(); - getUi().getContentTable().addMouseListener(new ListMouseListener()); - } - protected void doSelectLocation() { + getUi().getContentTable().addMouseListener(new MouseAdapter() { + JPopupMenu popup; + JTable table; - List<VCSAction> actions = Arrays.asList(getModel().getEntriesModel().getActions((ListSelectionModel) null)); + @Override + public void mousePressed(MouseEvent e) { + super.mousePressed(e); + showPopup(e); + } - boolean hasActions = !actions.isEmpty(); - SynchUI ui = getUi(); - updateAction(actions, hasActions, ui.getDiffAll(), VCSAction.DIFF); - updateAction(actions, hasActions, ui.getUpdateAll(), VCSAction.UPDATE); - updateAction(actions, hasActions, ui.getRevertAll(), VCSAction.REVERT); - updateAction(actions, hasActions, ui.getCommitAll(), VCSAction.COMMIT); - updateAction(actions, hasActions, ui.getAddAll(), VCSAction.ADD); - updateAction(actions, hasActions, ui.getDeleteAll(), VCSAction.DELETE); - ui.getRefreshAll().setEnabled(hasActions); - } + @Override + public void mouseReleased(MouseEvent e) { + super.mouseReleased(e); + showPopup(e); + } - public void doAction(VCSAction action, boolean useSelection) { - AbstractVCSEntriesTableModel model = getModel().getEntriesModel(); - log.info(action + " : " + model); - ListSelectionModel selectionModel = getSelectionModel(); - List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? selectionModel : null)); + void showPopup(MouseEvent e) { + if (e.isPopupTrigger() && !getTable().getSelectionModel().isSelectionEmpty()) { + getPopupMenu().show(getTable(), e.getX(), e.getY()); + } + } - if (action == VCSAction.REFRESH) { - doRefresh(model, model.getEntries(), selectionModel); - return; - } + JPopupMenu getPopupMenu() { + return popup == null ? popup = getUi().getPopup() : popup; + } - if (entries.isEmpty()) { - // nothing to do - return; - } - if (action == VCSAction.DIFF) { - // show diff ui - doDiff(useSelection, model, entries); - return; - } + JTable getTable() { + return table == null ? table = getUi().getContentTable() : table; + } + }); + } - doConfirm(action, model, entries); + protected void afterSelectionChanged() { + ListSelectionModel selectionModel = getSelectionModel(); + EnumMap<VCSAction, Integer> actions = getModel().getEntriesModel().countActions(selectionModel); + boolean hasActions = !actions.isEmpty(); + SynchUI ui = getUi(); + int nbFiles = actions.get(VCSAction.REFRESH); + updateAction(actions, hasActions, ui.getDiff(), VCSAction.DIFF, false, nbFiles); + updateAction(actions, hasActions, ui.getUpdate(), VCSAction.UPDATE, false, nbFiles); + updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT, false, nbFiles); + updateAction(actions, hasActions, ui.getCommit(), VCSAction.COMMIT, false, nbFiles); + updateAction(actions, hasActions, ui.getAdd(), VCSAction.ADD, false, nbFiles); + updateAction(actions, hasActions, ui.getDelete(), VCSAction.DELETE, false, nbFiles); + updateAction(actions, hasActions, ui.getRefresh(), VCSAction.REFRESH, false, nbFiles); } + protected void afterLocationChanged() { - protected class ListMouseListener extends MouseAdapter { + EnumMap<VCSAction, Integer> actions = getModel().getEntriesModel().countActions((ListSelectionModel) null); + boolean hasActions = !actions.isEmpty(); + SynchUI ui = getUi(); + // refresh actions is enabled on all files + int nbFiles = actions.get(VCSAction.REFRESH); + updateAction(actions, hasActions, ui.getDiffAll(), VCSAction.DIFF, true, nbFiles); + updateAction(actions, hasActions, ui.getUpdateAll(), VCSAction.UPDATE, true, nbFiles); + updateAction(actions, hasActions, ui.getRevertAll(), VCSAction.REVERT, true, nbFiles); + updateAction(actions, hasActions, ui.getCommitAll(), VCSAction.COMMIT, true, nbFiles); + updateAction(actions, hasActions, ui.getAddAll(), VCSAction.ADD, true, nbFiles); + updateAction(actions, hasActions, ui.getDeleteAll(), VCSAction.DELETE, true, nbFiles); + updateAction(actions, hasActions, ui.getRefreshAll(), VCSAction.REFRESH, true, nbFiles); + } - @Override - public void mousePressed(MouseEvent e) { - super.mousePressed(e); - if (e.isPopupTrigger() && !getSelectionModel().isSelectionEmpty()) { - initPopup(e.getX(), e.getY(), getSelectionModel()); - } - } + protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, boolean all, int nbFiles) { - @Override - public void mouseReleased(MouseEvent e) { - super.mouseReleased(e); - if (e.isPopupTrigger() && !getSelectionModel().isSelectionEmpty()) { - initPopup(e.getX(), e.getY(), getSelectionModel()); + super.updateAction(actions, hasActions, ui, action); + Integer nbEntries = actions.get(action); + boolean useAction = hasActions && actions.containsKey(action) && nbEntries > 0; + String tip = null; + if (useAction) { + if (all) { + if (nbEntries == 1) { + tip = _("lutinvcs.action.confirm.all.tip", action.getLibelle(), nbFiles); + } else { + tip = _("lutinvcs.action.confirm.alls.tip", action.getLibelle(), nbEntries, nbFiles); + } + } else { + if (nbEntries == 1) { + tip = _("lutinvcs.action.confirm.selected.tip", action.getLibelle(), nbFiles); + } else { + tip = _("lutinvcs.action.confirm.selecteds.tip", action.getLibelle(), nbEntries, nbFiles); + } } } - - protected void initPopup(int x, int y, ListSelectionModel selectionModel) { - - List<VCSAction> actions = Arrays.asList(getModel().getEntriesModel().getActions(selectionModel)); - boolean hasActions = !actions.isEmpty(); - SynchUI ui = getUi(); - updateAction(actions, hasActions, ui.getDiff(), VCSAction.DIFF); - updateAction(actions, hasActions, ui.getUpdate(), VCSAction.UPDATE); - updateAction(actions, hasActions, ui.getRevert(), VCSAction.REVERT); - updateAction(actions, hasActions, ui.getCommit(), VCSAction.COMMIT); - updateAction(actions, hasActions, ui.getAdd(), VCSAction.ADD); - updateAction(actions, hasActions, ui.getDelete(), VCSAction.DELETE); - ui.getRefresh().setEnabled(hasActions); - // display popup - ui.getPopup().show(ui.getContentTable(), x, y); + if (!all) { + ui.setText(action.getLibelle() + " (" + nbEntries + '/' + nbFiles + ')'); } + ui.setToolTipText(tip); } } Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-13 07:55:46 UTC (rev 457) @@ -29,13 +29,14 @@ */ public class ConfirmUIModel extends AbstractUIModel { + public static final String ACCEPT_PROPERTY_CHANGED = "action"; + public static final String MESSAGE_HISTORY_PROPERTY_CHANGED = "historyMessage"; + /** 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) { @@ -48,11 +49,11 @@ return action; } - public void addCommitMessage(String commitMessage) { - if (commitMessage != null && !commitMessage.isEmpty() && !getCommitMessages().contains(commitMessage)) { + public void addCommitMessage(String msg) { + if (!(msg == null || msg.isEmpty() || containsMessage(msg))) { // add message in history - getCommitMessages().add(commitMessage); - firePropertyChange(MESSAGE_HISTORY_PROPERTY_CHANGED, null, commitMessage); + getCommitMessages().add(msg); + firePropertyChange(MESSAGE_HISTORY_PROPERTY_CHANGED, null, msg); } } @@ -68,4 +69,7 @@ firePropertyChange(ACCEPT_PROPERTY_CHANGED, null, action); } + public boolean containsMessage(String msg) { + return commitMessages != null && commitMessages.contains(msg); + } } \ No newline at end of file Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-13 07:55:46 UTC (rev 457) @@ -26,20 +26,57 @@ public class DiffUIModel extends AbstractTabUIModel { public static final String FILE_PROPERTY_CHANGED = "file"; + public static final String DIFF_PROPERTY_CHANGED = "diff"; /** current file displayed */ protected VCSEntry fileModel; + protected int nbDiffs; + + protected Integer diff; + + public VCSEntry getFileModel() { + return fileModel; + } + + public int getNbDiffs() { + return nbDiffs; + } + + public Integer getDiff() { + return diff; + } + + public void setDiff(Integer diff) { + Integer oldDiff = this.diff; + this.diff = diff; + // always notify ui (so do not propagate old value + firePropertyChange(DIFF_PROPERTY_CHANGED, oldDiff, diff); + } + + public void setNbDiffs(int nbDiffs) { + this.nbDiffs = nbDiffs; + // special reset of diff (to make sure, event will be propagate to ui;)) + diff = -1; + setDiff(nbDiffs > 0 ? 0 : null); + } + + public boolean hasNext() { + return diff != null && diff < nbDiffs; + } + + public boolean hasPrevious() { + return diff != null && diff > 0; + } + public void setFileModel(VCSEntry fileModel) { VCSEntry oldFileModel = this.fileModel; this.fileModel = fileModel; firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileModel); + // TODO acquire diff and prepare DiffModel... + setNbDiffs(0); } - public VCSEntry getFileModel() { - return fileModel; - } - public void init(VCSEntryLocation location, VCSEntry[] states) { getEntriesModel().clear(); getEntriesModel().populate(VCSEntryLocation.ALL, states); Modified: 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/AbstractTabUI.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,25 +14,25 @@ */ package org.codelutin.vcs.ui.util; +import org.codelutin.vcs.type.VCSAction; import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.action.ChangeLocationAction; +import org.codelutin.vcs.ui.action.TabUIAction; +import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JToggleButton; /** @author chemit */ public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractUI<H> { public abstract ButtonGroup getTabs(); - public abstract JToggleButton getAllTab(); + public abstract AbstractButton getAllTab(); - public abstract JToggleButton getLocalTab(); + public abstract AbstractButton getLocalTab(); - public abstract JToggleButton getRemoteTab(); + public abstract AbstractButton getRemoteTab(); public abstract AbstractButton getRefresh(); @@ -42,9 +42,6 @@ public abstract AbstractButton getRevert(); - public abstract AbstractButton getHelp(); - - public AbstractButton getButton(VCSEntryLocation modelName) { switch (modelName) { case ALL: @@ -59,12 +56,12 @@ throw new IllegalStateException("no popup found for " + modelName); } - protected void setLocation(VCSEntryLocation location) { - getHandler().getModel().setLocation(location); + protected AbstractAction createLocationAction(VCSEntryLocation location) { + return ChangeLocationAction.createAction(location, this); } - public ImageIcon createLocationIcon(VCSEntryLocation action) { - return jaxx.runtime.UIHelper.createImageIcon("location-" + action.name().toLowerCase() + ".png"); + protected AbstractAction createAction(VCSAction action, boolean useSelection) { + return TabUIAction.createAction(action, useSelection, this); } } Modified: 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/AbstractTabUIHandler.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-13 07:55:46 UTC (rev 457) @@ -21,9 +21,9 @@ import org.codelutin.vcs.ui.VCSUIFactory; import javax.swing.AbstractButton; -import javax.swing.JTable; import javax.swing.ListSelectionModel; import java.beans.PropertyChangeEvent; +import java.util.EnumMap; import java.util.List; /** @author chemit */ @@ -33,39 +33,32 @@ super(ui, model); } - /*@Override - public void init() { - super.init(); - }*/ - - public ListSelectionModel getSelectionModel() { - return getUi().getContentTable().getSelectionModel(); - } - public void propertyChange(PropertyChangeEvent evt) { if (log.isDebugEnabled()) { log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); } String action = evt.getPropertyName(); if (AbstractTabUIModel.LOCATION_PROPERTY_CHANGED.equals(action)) { - doSelectLocation(); + afterLocationChanged(); } } - protected abstract void doSelectLocation(); + protected abstract void afterLocationChanged(); - protected void updateAction(List<VCSAction> actions, boolean hasActions, AbstractButton ui, VCSAction diff) { - ui.setEnabled(hasActions && actions.contains(diff)); + + protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action) { + ui.setEnabled(hasActions && actions.containsKey(action) && actions.get(action) > 0); } - protected void doConfirm(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) { + public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) { ConfirmUI confirmUI = VCSUIFactory.newConfirmUI(); log.info("nb files:" + entries.size()); confirmUI.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); + confirmUI.getContentScroll().setEnabled(entries.size() > 1); confirmUI.setVisible(true); } - protected void doDiff(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) { + public void showDiffUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) { DiffUI diffUI = VCSUIFactory.newDiffUI(); if (!useSelection) { // take all entries @@ -73,14 +66,17 @@ } log.info("nb entries:" + entries.size()); diffUI.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()])); + diffUI.getContentScroll().setEnabled(entries.size() > 1); diffUI.setVisible(true); } - protected void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) { + public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) { log.info(selectionModel); selectionModel.clearSelection(); + log.info("nb entries:" + entries.size()); // do refresh of all states model.refresh(System.nanoTime(), entries); } + } \ No newline at end of file Modified: 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/AbstractUI.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,7 +14,10 @@ */ package org.codelutin.vcs.ui.util; -import javax.swing.ImageIcon; +import org.codelutin.vcs.ui.action.HelpAction; + +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -25,6 +28,8 @@ public abstract JTable getContentTable(); + public abstract AbstractButton getHelp(); + private H handler; protected AbstractUI() { @@ -39,12 +44,7 @@ this.handler = handler; } - protected void doHelp() { - handler.doHelp(); + protected AbstractAction createHelpAction() { + return HelpAction.createAction(this); } - - public ImageIcon createActionIcon(org.codelutin.vcs.type.VCSAction action) { - return jaxx.runtime.UIHelper.createImageIcon(action.name().toLowerCase() + ".png"); - } - } Added: trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-13 07:55:46 UTC (rev 457) @@ -0,0 +1,53 @@ +/** + * # #% 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; + +/** @author chemit */ +public abstract class AbstractUIAction<H extends AbstractUIHandler<?, ?>> extends javax.swing.AbstractAction { + + protected static Log log = LogFactory.getLog(AbstractUIAction.class); + + protected transient AbstractUI<? extends H> ui; + protected transient H handler; + + private static final long serialVersionUID = 1L; + + protected AbstractUIAction(String name, javax.swing.Icon icon) { + super(name, icon); + } + + protected H getHandler() { + checkInit(); + if (handler == null) { + handler = ui.getHandler(); + } + return handler; + } + + protected void setUi(AbstractUI<? extends H> ui) { + this.ui = ui; + this.handler = null; + } + + protected void checkInit() throws IllegalStateException { + if (handler == null && ui == null) { + throw new IllegalStateException("no handler, nor ui referenced in " + this); + } + } + +} Modified: 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/AbstractUIHandler.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-13 07:55:46 UTC (rev 457) @@ -22,10 +22,12 @@ import javax.swing.JTable; import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import java.beans.PropertyChangeListener; /** @author chemit */ -public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener { +public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener, ListSelectionListener { protected static Log log = LogFactory.getLog(AbstractUIHandler.class); @@ -35,13 +37,13 @@ /** model handled */ private M model; + protected abstract void afterSelectionChanged(); + protected AbstractUIHandler(U ui, M model) { this.ui = ui; this.model = model; } - public abstract ListSelectionModel getSelectionModel(); - public final U getUi() { return ui; } @@ -50,11 +52,23 @@ return model; } + public final ListSelectionModel getSelectionModel() { + return getUi().getContentTable().getSelectionModel(); + } + + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + // update popup states + afterSelectionChanged(); + } + } + public void init() { if (model == null) { throw new IllegalStateException("no model was defined for " + this); } model.addPropertyChangeListener(this); + getUi().getContentTable().getSelectionModel().addListSelectionListener(this); JTable table = getUi().getContentTable(); table.setModel(getModel().getEntriesModel()); // init table renderer @@ -69,8 +83,4 @@ return VCSFactory.getActionManager(); } - - public void doHelp() { - log.info("TODO " + this); - } } Modified: 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 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java 2008-04-13 07:55:46 UTC (rev 457) @@ -35,6 +35,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.EnumMap; /** * Simple Table model to display list of VCSFileState @@ -48,8 +49,6 @@ /** column names */ protected final String[] columnNames; - protected VCSEntryLocation location = VCSEntryLocation.UNKNOW; - /** delegate model */ protected final transient VCSEntries delegate; @@ -57,8 +56,10 @@ protected final transient List<VCSEntry> displayedEntries; /** row sorter */ - protected transient TableRowSorter<TableModel> rowSorter; + protected final transient TableRowSorter<TableModel> rowSorter; + protected VCSEntryLocation location; + private static final long serialVersionUID = 4697917831388337369L; @@ -69,6 +70,7 @@ this.displayedEntries = new ArrayList<VCSEntry>(); this.delegate = new VCSEntriesImpl(); this.rowSorter = new TableRowSorter<TableModel>(this); + this.location = VCSEntryLocation.UNKNOW; } public String getName() { @@ -118,8 +120,8 @@ fireTableDataChanged(); } - public VCSAction[] getActions(ListSelectionModel selectionModel) { - return getActions(getDisplayedEntries(selectionModel)); + public EnumMap<VCSAction, Integer> countActions(ListSelectionModel selectionModel) { + return countActions(getDisplayedEntries(selectionModel)); } @Override @@ -191,12 +193,12 @@ updateEntries(); } - public VCSAction[] getActions(List<VCSEntry> entries) { - return delegate.getActions(entries); + public EnumMap<VCSAction, Integer> countActions(List<VCSEntry> entries) { + return delegate.countActions(entries); } - public VCSState[] getStates(List<VCSEntry> entries) { - return delegate.getStates(entries); + public EnumMap<VCSState, Integer> countStates(List<VCSEntry> entries) { + return delegate.countStates(entries); } public void clear() { Modified: 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/UIHelper.java 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java 2008-04-13 07:55:46 UTC (rev 457) @@ -14,6 +14,11 @@ */ package org.codelutin.vcs.ui.util; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSState; +import org.codelutin.vcs.type.VCSEntryLocation; + import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JComponent; @@ -21,8 +26,12 @@ import javax.swing.JRootPane; import javax.swing.JTable; import javax.swing.KeyStroke; +import javax.swing.ListSelectionModel; +import javax.swing.ImageIcon; import java.awt.Color; import java.awt.event.ActionEvent; +import java.util.EnumMap; +import java.util.EnumSet; /** * UI Helper methods @@ -72,4 +81,64 @@ table.setRowSorter(((AbstractVCSEntriesTableModel) table.getModel()).getRowSorter()); } + public static int countAction(VCSAction action, AbstractVCSEntriesTableModel entries, ListSelectionModel selectionModel) { + EnumMap<VCSAction, Integer> map = countActions(EnumSet.of(action), entries, selectionModel); + if (map.isEmpty()) { + return 0; + } else { + return map.values().iterator().next(); + } + } + + public static EnumMap<VCSAction, Integer> countActions(EnumSet<VCSAction> set, AbstractVCSEntriesTableModel entries, ListSelectionModel selectionModel) { + if (set == null) { + set = EnumSet.allOf(VCSAction.class); + } + EnumMap<VCSAction, Integer> map = new EnumMap<VCSAction, Integer>(VCSAction.class); + int[] tmp = new int[VCSAction.values().length]; + for (int i = 0, max = entries.getRowCount(); i < max; i++) { + if (selectionModel == null || selectionModel.isSelectedIndex(i)) { + VCSEntry entry = entries.getDisplayedEntry(i); + for (VCSAction action : entry.getState().getActions()) { + tmp[action.ordinal()]++; + } + } + } + for (VCSAction vcsAction : set) { + int index = vcsAction.ordinal(); + map.put(vcsAction, tmp[index]); + } + return map; + } + + public static EnumMap<VCSState, Integer> countStates(EnumSet<VCSState> set, AbstractVCSEntriesTableModel entries, ListSelectionModel selectionModel) { + if (set == null) { + set = EnumSet.allOf(VCSState.class); + } + EnumMap<VCSState, Integer> map = new EnumMap<VCSState, Integer>(VCSState.class); + int[] tmp = new int[VCSState.values().length]; + for (int i = 0, max = entries.getRowCount(); i < max; i++) { + if (selectionModel == null || selectionModel.isSelectedIndex(i)) { + VCSEntry entry = entries.getDisplayedEntry(i); + tmp[entry.getState().ordinal()]++; + } + } + for (VCSState state : set) { + int index = state.ordinal(); + map.put(state, tmp[index]); + } + return map; + } + + public static ImageIcon createActionIcon(String name) { + return jaxx.runtime.UIHelper.createImageIcon("action-" + name + ".png"); + } + + public static ImageIcon createActionIcon(VCSAction location) { + return createActionIcon(location.name().toLowerCase()); + } + + public static ImageIcon createLocationIcon(VCSEntryLocation location) { + return jaxx.runtime.UIHelper.createImageIcon("location-" + location.name().toLowerCase() + ".png"); + } } Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-en_GB.properties =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-en_GB.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-en_GB.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -1,3 +1,18 @@ +lutinvcs.action.action.noselection=Action ''{0}'' (empty selection) +lutinvcs.action.confirm.all.tip=Perform action ''{0}'' on the signle matching file amoung {1} file(s) +lutinvcs.action.confirm.alls.tip=Perform action ''{0}'' on the {1} matching files amoung {2} files +lutinvcs.action.confirm.one.tooltip=Perform action ''{0}}'' on selected file +lutinvcs.action.confirm.selected.tip=Perform action ''{0}'' on the signle matching file amoung the {1} selected file(s) +lutinvcs.action.confirm.selecteds.tip=Perform action ''{0}'' on the {1} matching files amoung the {2} selected files +lutinvcs.action.confirm.tooltip=Perform action ''{0}}'' on {1} selected files +lutinvcs.action.help.libelle=Help +lutinvcs.action.help.tip=Obtain help +lutinvcs.action.message=Action ''{0}'' ({1} selected files) +lutinvcs.action.message.one=Action ''{0}'' (1 selected file) +lutinvcs.action.nextdiff.tip=goto next diff +lutinvcs.action.previousdiff.tip=goto previous diff +lutinvcs.action.showmessages.tip=show previous commit messages +lutinvcs.action.single.tip=Launch action ''{0}'' on selected file ''{1}'' lutinvcs.file=File lutinvcs.module=Module lutinvcs.status=Status Modified: trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-fr_FR.properties =================================================================== --- trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-fr_FR.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-common/src/main/resources/i18n/lutinvcs-ui-common-fr_FR.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -1,3 +1,18 @@ +lutinvcs.action.action.noselection=Action ''{0}'' (aucune s\u00E9lection) +lutinvcs.action.confirm.all.tip=Ex\u00E9cuter l''action ''{0}'' sur le seul fichier correspondant (parmis les {1} fichier(s)). +lutinvcs.action.confirm.alls.tip=Ex\u00E9cuter l''action ''{0}'' sur les {1} fichiers correspondants (parmis les {2} fichiers). +lutinvcs.action.confirm.one.tooltip=Ex\u00E9cuter l''action ''{0}'' sur le fichier s\u00E9lectionn\u00E9. +lutinvcs.action.confirm.selected.tip=Ex\u00E9cuter l''action ''{0}'' sur le fichier correspondant parmi les {1} fichier(s) s\u00E9lectionn\u00E9(s). +lutinvcs.action.confirm.selecteds.tip=Ex\u00E9cuter l''action ''{0}'' sur les {1} fichiers correspondants parmi les {2} fichiers s\u00E9lectionn\u00E9s. +lutinvcs.action.confirm.tooltip=Ex\u00E9cuter l''action ''{0}'' sur les {1} fichiers s\u00E9lectionn\u00E9s. +lutinvcs.action.help.libelle=Aide +lutinvcs.action.help.tip=Obtenir de l'aide +lutinvcs.action.message=Action ''{0}'' ({1} fichiers s\u00E9lectionn\u00E9s) +lutinvcs.action.message.one=Action ''{0}'' (1 fichier s\u00E9lectionn\u00E9) +lutinvcs.action.nextdiff.tip=voir la prochaine diff\u00E9rence +lutinvcs.action.previousdiff.tip=voir la diff\u00E9rence pr\u00E9c\u00E9dente +lutinvcs.action.showmessages.tip=voir les messages de publication pr\u00E9c\u00E9dents +lutinvcs.action.single.tip=ex\u00E9cuter l''action ''{0}'' sur le fichier s\u00E9l\u00E9ctionn\u00E9 ''{1}'' lutinvcs.file=Fichier lutinvcs.module=Module lutinvcs.status=Status Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-en_GB.properties =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-en_GB.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-en_GB.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -1,36 +1,4 @@ -lutinvcs.action.add=Add -lutinvcs.action.commit=commit -lutinvcs.action.delete=delete -lutinvcs.action.diff=show diff -lutinvcs.action.refresh=refresh -lutinvcs.action.revert=revert -lutinvcs.action.tooltip.add=add selected files -lutinvcs.action.tooltip.addAll=add all files -lutinvcs.action.tooltip.commit=commit selected files -lutinvcs.action.tooltip.commitAll=commit all files -lutinvcs.action.tooltip.delete=delete -lutinvcs.action.tooltip.deleteAll=delete all files -lutinvcs.action.tooltip.diff=show diff of selected files -lutinvcs.action.tooltip.diffAll=show diff of all files -lutinvcs.action.tooltip.help=Obtain help -lutinvcs.action.tooltip.lastMessages= -lutinvcs.action.tooltip.nextDiff=next diff -lutinvcs.action.tooltip.previousDiff=previous diff -lutinvcs.action.tooltip.refresh=refresh selected files -lutinvcs.action.tooltip.refreshAll=refrsh all files -lutinvcs.action.tooltip.revert=revert selected files -lutinvcs.action.tooltip.revertAll=revert all files -lutinvcs.action.tooltip.update=update selected files -lutinvcs.action.tooltip.updateAll=update all files -lutinvcs.action.update=update lutinvcs.commit.message=Please fill a message for your commit -lutinvcs.confirm.message=Message TODO lutinvcs.confirm.title=Confirm UI lutinvcs.diff.title=Diff UI -lutinvcs.synch.title=Synch -lutinvcs.tabs.all=all -lutinvcs.tabs.local=local -lutinvcs.tabs.remote=remote -lutinvcs.tabs.tooltip.all=Show all files (local and remote) -lutinvcs.tabs.tooltip.local=Show all local files -lutinvcs.tabs.tooltip.remote=Show all remote files +lutinvcs.synch.title=Synch UI Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-fr_FR.properties =================================================================== --- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-fr_FR.properties 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/i18n/lutinvcs-ui-jaxx-fr_FR.properties 2008-04-13 07:55:46 UTC (rev 457) @@ -1,36 +1,4 @@ -lutinvcs.action.add=Ajouter -lutinvcs.action.commit=committer -lutinvcs.action.delete=supprimer -lutinvcs.action.diff=voir les diff -lutinvcs.action.refresh=rafra\u00EEchir -lutinvcs.action.revert=annuler les modifications -lutinvcs.action.tooltip.add=ajouter les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.addAll=ajouter tous les fichiers -lutinvcs.action.tooltip.commit=commiter les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.commitAll=commiter tous les fichiers -lutinvcs.action.tooltip.delete=supprimer les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.deleteAll=supprimer tous les fichiers -lutinvcs.action.tooltip.diff=voir tous les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.diffAll=voir les diff\u00E9rences de tous les fichiers -lutinvcs.action.tooltip.help=Obtenir de l'aide -lutinvcs.action.tooltip.lastMessages= -lutinvcs.action.tooltip.nextDiff=voir la prochaine diff\u00E9rence -lutinvcs.action.tooltip.previousDiff=voir la diff\u00E9rence pr\u00E9c\u00E9dente -lutinvcs.action.tooltip.refresh=rafra\u00EEchir tous les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.refreshAll=rafra\u00EEchir tous les fichiers -lutinvcs.action.tooltip.revert=annuler les modifications sur les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.revertAll=annuler les modifications sur tous les fichiers -lutinvcs.action.tooltip.update=mettre \u00E0 jour les fichiers s\u00E9lectionn\u00E9s -lutinvcs.action.tooltip.updateAll=mettre \u00E0 jour tous les fichiers -lutinvcs.action.update=mettre \u00E0 jour -lutinvcs.commit.message=Renseigner le message de commit -lutinvcs.confirm.message=Message TODO +lutinvcs.commit.message=Renseigner le message de publication lutinvcs.confirm.title=Confirm UI lutinvcs.diff.title=Diff UI -lutinvcs.synch.title=Synchronisation -lutinvcs.tabs.all=all -lutinvcs.tabs.local=local -lutinvcs.tabs.remote=remote -lutinvcs.tabs.tooltip.all=voir tous les fichiers modifi\u00E9s localement ou \u00E0 distance -lutinvcs.tabs.tooltip.local=voir tous les fichiers locaux -lutinvcs.tabs.tooltip.remote=voir tous les fichiers \u00E0 distance +lutinvcs.synch.title=Synch UI Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-add.png (from rev 451, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/add.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-add.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-commit.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/commit.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-commit.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-delete.png (from rev 451, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/delete.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-delete.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-next.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-next.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-next.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-prev.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-prev.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff-prev.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-diff.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-help.png (from rev 451, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/help.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-help.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-refresh.png (from rev 452, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/refresh.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-refresh.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-revert.png (from rev 449, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/revert.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-revert.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-showmessages.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/recent_msgs.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-showmessages.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Copied: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-update.png (from rev 440, trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/update.png) =================================================================== (Binary files differ) Property changes on: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/action-update.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/add.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/commit.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/delete.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-next.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff-prev.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/diff.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/help.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/recent_msgs.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/refresh.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/revert.png =================================================================== (Binary files differ) Deleted: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/resources/icons/update.png =================================================================== (Binary files differ) Modified: 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/JaxxConfirmUI.jaxx 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx 2008-04-13 07:55:46 UTC (rev 457) @@ -1,10 +1,24 @@ <ConfirmUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true' resizable='false' height='300' width='400'> <style source="common.css"/> + <JPopupMenu id="popup"> + <JScrollPane styleClass='confirmScroll'> + <JList id='messages' model='{messageModel}' selectionModel='{messageSelectionModel}'/> + </JScrollPane> + </JPopupMenu> <Table> <row fill='both'> <cell fill='both'> - <JLabel id="actionLabel" text="lutinvcs.confirm.message"/> + <JToolBar> + <JLabel id="actionLabel"/> + <Table fill='both' insets='0,0,0,0'> + <row> + <cell fill='both'/> + </row> + </Table> + <!--JSeparator orientation="vertical"/--> + <JButton id='help' action='{createHelpAction()}'/> + </JToolBar> </cell> </row> <row fill='both'> @@ -19,15 +33,13 @@ <cell fill='both'/> </row> </Table> - <JSeparator orientation="vertical"/> - <JButton id='lastMessages' onActionPerformed='showLastMessages()'/> - <JButton id='help' onActionPerformed='doHelp()'/> + <JButton id='lastMessages' action='{createShowMessagesAction()}'/> </JToolBar> </cell> </row> <row fill='both'> <cell fill='both' columns='3' weightx='1'> - <JScrollPane id="commitScroll" height='90' verticalScrollBarPolicy="20" + <JScrollPane id="commitScroll" height='90' styleClass='confirmScroll' columnHeaderView="{tool}"> <JTextArea id="commitMessage" constructorParams="4,50"/> </JScrollPane> @@ -49,5 +61,7 @@ </cell> </row> </Table> + <DefaultListSelectionModel id='messageSelectionModel'/> + <DefaultListModel id='messageModel'/> </ConfirmUI> \ No newline at end of file Modified: 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/JaxxDiffUI.jaxx 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-13 07:55:46 UTC (rev 457) @@ -8,37 +8,33 @@ <row fill='both'> <cell fill='both' weightx='1'> <JToolBar> - <JToggleButton id='allTab' onActionPerformed='setLocation(ALL)'/> - <JToggleButton id='localTab' onActionPerformed='setLocation(LOCAL)'/> - <JToggleButton id='remoteTab' onActionPerformed='setLocation(REMOTE)'/> + <JToggleButton id='allTab' action='{createLocationAction(ALL)}'/> + <JToggleButton id='localTab' action='{createLocationAction(LOCAL)}'/> + <JToggleButton id='remoteTab' action='{createLocationAction(REMOTE)}'/> <JSeparator orientation="vertical"/> - - <JButton id='refresh' onActionPerformed='doAction(REFRESH)'/> + <JButton id='refresh' action='{createAction(REFRESH,true)}'/> <JSeparator orientation="vertical"/> - - <JButton id='nextDiff' onActionPerformed='gotoNextDiff()'/> - <JButton id='previousDiff' onActionPerformed='gotoPreviousDiff()'/> + <JButton id='nextDiff' action='{createDiffAction(false)}'/> + <JButton id='previousDiff' action='{createDiffAction(true)}'/> <JSeparator orientation="vertical"/> - - <JButton id='update' onActionPerformed='doAction(UPDATE)'/> - <JButton id='commit' onActionPerformed='doAction(COMMIT)'/> - <JButton id='revert' onActionPerformed='doAction(REVERT)'/> + <JButton id='update' action='{createAction(UPDATE,true)}'/> + <JButton id='commit' action='{createAction(COMMIT,true)}'/> + <JButton id='revert' action='{createAction(REVERT,true)}'/> <JSeparator orientation="vertical"/> - - <JButton id='help' onActionPerformed='doHelp()'/> + <JButton id='help' action='{createHelpAction()}'/> </JToolBar> </cell> </row> <row fill='both'> <cell fill='both'> <JScrollPane id='contentScroll' styleClass='diffScroll' height='100'> - <JTable id="contentTable" styleClass='diffTable' onMouseClicked="doSelectFile()"/> + <JTable id="contentTable" styleClass='diffTable'/> </JScrollPane> </cell> </row> <row fill='both'> <cell fill='both' weighty='1' weightx='1'> - <JSplitPane id='splitPane2' orientation='horizontal' resizeWeight="0.5" dividerLocation="{0.5}"> + <JSplitPane orientation='horizontal' resizeWeight="0.5" dividerLocation="{0.5}"> <JScrollPane id='remoteEditorScroll' styleClass='diffScroll'> <JTextArea id="remoteEditorContent" editable='false'/> </JScrollPane> Modified: 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/JaxxSynchUI.jaxx 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-13 07:55:46 UTC (rev 457) @@ -5,42 +5,36 @@ import static org.codelutin.vcs.type.VCSEntryLocation.*; </script> <JPopupMenu id="popup" invoker='{contentTable}'> - <JMenuItem id='refresh' text='lutinvcs.action.refresh' onActionPerformed='doAction(REFRESH,true)'/> - <JMenuItem id='diff' text='lutinvcs.action.diff' onActionPerformed='doAction(DIFF,true)'/> + <JMenuItem id='refresh' action='{createAction(REFRESH,true)}' font-size='10'/> + <JMenuItem id='diff' action='{createAction(DIFF,true)}' font-size='10'/> <JSeparator/> - <JMenuItem id='update' text='lutinvcs.action.update' onActionPerformed='doAction(UPDATE,true)'/> - <JMenuItem id='revert' text='lutinvcs.action.revert' onActionPerformed='doAction(REVERT,true)'/> + <JMenuItem id='update' action='{createAction(UPDATE,true)}' font-size='10'/> + <JMenuItem id='revert' action='{createAction(REVERT,true)}' font-size='10'/> <JSeparator/> - - <JMenuItem id='commit' text='lutinvcs.action.commit' onActionPerformed='doAction(COMMIT,true)'/> - <JMenuItem id='add' text='lutinvcs.action.add' onActionPerformed='doAction(ADD,true)'/> - <JMenuItem id='delete' text='lutinvcs.action.delete' onActionPerformed='doAction(DELETE,true)'/> + <JMenuItem id='commit' action='{createAction(COMMIT,true)}' font-size='10'/> + <JMenuItem id='add' action='{createAction(ADD,true)}' font-size='10'/> + <JMenuItem id='delete' action='{createAction(DELETE,true)}' font-size='10'/> </JPopupMenu> <Table id='table'> <row fill='both'> <cell fill='both' weightx='1'> <JToolBar> - <JToggleButton id='allTab' onActionPerformed='setLocation(ALL)'/> - <JToggleButton id='localTab' onActionPerformed='setLocation(LOCAL)'/> - <JToggleButton id='remoteTab' onActionPerformed='setLocation(REMOTE)'/> - + <JToggleButton id='allTab' action='{createLocationAction(ALL)}'/> + <JToggleButton id='localTab' action='{createLocationAction(LOCAL)}'/> + <JToggleButton id='remoteTab' action='{createLocationAction(REMOTE)}'/> <JSeparator orientation="vertical"/> - - <JButton id='refreshAll' onActionPerformed='doAction(REFRESH,false)'/> - <JButton id='diffAll' onActionPerformed='doAction(DIFF,false)'/> + <JButton id='refreshAll' action='{createAction(REFRESH,false)}'/> + <JButton id='diffAll' action='{createAction(DIFF,false)}'/> <JSeparator orientation="vertical"/> - - <JButton id='updateAll' onActionPerformed='doAction(UPDATE,false)'/> - <JButton id='revertAll' onActionPerformed='doAction(REVERT,false)'/> + <JButton id='updateAll' action='{createAction(UPDATE,false)}'/> + <JButton id='revertAll' action='{createAction(REVERT,false)}'/> <JSeparator orientation="vertical"/> - - <JButton id='commitAll' onActionPerformed='doAction(COMMIT,false)'/> - <JButton id='addAll' onActionPerformed='doAction(ADD,false)'/> - <JButton id='deleteAll' onActionPerformed='doAction(DELETE,false)'/> + <JButton id='commitAll' action='{createAction(COMMIT,false)}'/> + <JButton id='addAll' action='{createAction(ADD,false)}'/> + <JButton id='deleteAll' action='{createAction(DELETE,false)}'/> <JSeparator orientation="vertical"/> - - <JButton id='help' onActionPerformed='doHelp()'/> + <JButton id='help' action='{createHelpAction()}'/> </JToolBar> </cell> </row> Modified: 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 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-13 07:55:46 UTC (rev 457) @@ -10,248 +10,65 @@ opaque: false; borderPainted: false; enabled: false; - margin: 0; + margin: 0; /*font-size:10;*/ } JToggleButton { opaque: false; borderPainted: false; margin: 0; + selected: false; + font-size: 10; } -JMenuItem { +JMenuItem, JMenu { enabled: true; } -JMenu { - enabled: true; +JSeparator { + border: { null } -.smallSize { - font-size: 9; -} +; +opaque:false -.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 { +.updateScroll, .diffScroll, .confirmScroll { verticalScrollBarPolicy: 20; horizontalScrollBarPolicy: 31; } -.diffScroll { - verticalScrollBarPolicy: 20; - horizontalScrollBarPolicy: 31; -} - -.diffTable { - rowSelectionAllowed: true; - /*autoResizeMode: auto_resize_all_columns; - autoResizeMode: auto_resize_last_column;*/ +.updateTable, .confirmTable, .diffTable { showVerticalLines: false; cellSelectionEnabled: false; + rowSelectionAllowed: true; rowMargin: 0; - selectionMode: 0; } -#allTab { - buttonGroup: tabs; - mnemonic: A; - selected: false; - icon: { createLocationIcon( ALL ) +.updateTable, .confirmTable { + selectionMode: 2; } -; -text: - -"lutinvcs.tabs.all" -; -toolTipText: - -"lutinvcs.tabs.tooltip.all" -; +.diffTable { + selectionMode: 0; } -#localTab { +#allTab, #localTab, #remoteTab { buttonGroup: tabs; - mnemonic: L; - selected: false; - icon: { createLocationIcon( LOCAL ) } -; -text: - -"lutinvcs.tabs.local" -; -toolTipText: - -"lutinvcs.tabs.tooltip.local" -; +.smallSize { + font-size: 9; } -#remoteTab { - buttonGroup: tabs; - mnemonic: R; - selected: false; - icon: { createLocationIcon( REMOTE ) +#actionLabel, #actionCommitLabel { + font-size: 10; } -; -text: - -"lutinvcs.tabs.remote" -; -toolTipText: - -"lutinvcs.tabs.tooltip.remote" -; -} - -#refresh, #refreshAll { - icon: { createActionIcon( REFRESH ) -} - -; -} - -#diff, #diffAll { - icon: { createActionIcon( DIFF ) -} - -; -} - -#update, #updateAll { - icon: { createActionIcon( UPDATE ) -} - -; -} - -#revert, #revertAll { - icon: { createActionIcon( REVERT ) -} - -; -} - -#commit, #commitAll { - icon: { createActionIcon( COMMIT ) -} - -; -} - -#add, #addAll { - icon: { createActionIcon( ADD ) -} - -; -} - -#delete, #deleteAll { - icon: { createActionIcon( DELETE ) -} - -; -} - -#refresh { - toolTipText: "lutinvcs.action.tooltip.refresh"; -} - -#refreshAll { - toolTipText: "lutinvcs.action.tooltip.refreshAll"; -} - -#diff { - toolTipText: "lutinvcs.action.tooltip.diff"; -} - -#diffAll { - toolTipText: "lutinvcs.action.tooltip.diffAll"; -} - -#update { - toolTipText: "lutinvcs.action.tooltip.update"; -} - -#updateAll { - toolTipText: "lutinvcs.action.tooltip.updateAll"; -} - -#revert { - toolTipText: "lutinvcs.action.tooltip.revert"; -} - -#revertAll { - toolTipText: "lutinvcs.action.tooltip.revertAll"; -} - -#commit { - toolTipText: "lutinvcs.action.tooltip.commit"; -} - -#commitAll { - toolTipText: "lutinvcs.action.tooltip.commitAll"; -} - -#add { - toolTipText: "lutinvcs.action.tooltip.add"; -} - -#addAll { - toolTipText: "lutinvcs.action.tooltip.addAll"; -} - -#delete { - toolTipText: "lutinvcs.action.tooltip.delete"; -} - -#deleteAll { - toolTipText: "lutinvcs.action.tooltip.deleteAll"; -} - -#help { - toolTipText: "lutinvcs.action.tooltip.help"; - enabled: true; - icon: { createImageIcon( "help.png" ) -} - -; -} - -#nextDiff { - toolTipText: "lutinvcs.action.tooltip.nextDiff"; - icon: { createImageIcon( "diff-next.png" ) -} - -; -} - -#previousDiff { - toolTipText: "lutinvcs.action.tooltip.previousDiff"; - icon: { createImageIcon( "diff-prev.png" ) -} - -; -} - -#lastMessages { - toolTipText: "lutinvcs.action.tooltip.lastMessages"; - icon: { createImageIcon( "recent_msgs.png" ) -} - -; -} \ No newline at end of file +#messages { + fixedCellWidth: 300; + fixedCellHeight: 12; + visibleRowCount: 10; +} \ No newline at end of file Modified: trunk/lutinvcs/pom.xml =================================================================== --- trunk/lutinvcs/pom.xml 2008-04-11 19:52:14 UTC (rev 456) +++ trunk/lutinvcs/pom.xml 2008-04-13 07:55:46 UTC (rev 457) @@ -25,6 +25,7 @@ <module>lutinvcs-provider-svn</module> <module>lutinvcs-ui-common</module> <module>lutinvcs-ui-jaxx</module> + <module>lutinvcs-all-providers</module> <module>lutinvcs-all</module> </modules> @@ -226,11 +227,11 @@ <artifactId>lutinutil</artifactId> <version>0.30-SNAPSHOT</version> </dependency> - <dependency> + <!--dependency> <groupId>${common.groupId}</groupId> <artifactId>lutinvcs-api</artifactId> <version>${current.version}</version> - </dependency> + </dependency--> <dependency> <groupId>${common.groupId}</groupId> <artifactId>lutinvcs-core</artifactId> @@ -268,6 +269,11 @@ </dependency> <dependency> <groupId>${common.groupId}</groupId> + <artifactId>lutinvcs-all-providers</artifactId> + <version>${current.version}</version> + </dependency> + <dependency> + <groupId>${common.groupId}</groupId> <artifactId>lutinvcs-all</artifactId> <version>${current.version}</version> </dependency>
participants (1)
-
tchemit@users.labs.libre-entreprise.org