Author: tchemit Date: 2008-04-06 13:06:51 +0000 (Sun, 06 Apr 2008) New Revision: 399 Added: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractTabUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java Removed: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java Log: new module : ui-pre-jaxx Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler (from rev 371, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler) Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,81 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.ui.VCSUIConstants; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; -import org.codelutin.vcs.ui.model.ConfirmUIModel; - -import java.beans.PropertyChangeEvent; -import java.util.List; - -/** - * Abstract ConfirmUI handler - * - * @author chemit - */ -public abstract class AbstractConfirmUIHandler extends AbstractUIHandler<ConfirmUIModel> { - - protected abstract void updateUI(); - - protected abstract void updateMessageUI(); - - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - } - String action = evt.getPropertyName(); - - if (VCSUIConstants.ACTION_PROPERTY_CHANGED.equals(action)) { - updateUI(); - return; - } - - if (VCSUIConstants.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { - updateMessageUI(); - return; - } - - throw new IllegalStateException("unimplemented property changed : " + evt); - } - - public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { - - VCSAction action = getModel().getAction(); - - List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); - - if (action.isCommit()) { - getModel().addCommitMessage(commitMessage); - - } else { - commitMessage = null; - } - - if (log.isDebugEnabled()) { - log.debug("action:" + action + ", message:" + commitMessage + ", nb files:" + entries.size()); - } - - getActionManager().add(action, entries.toArray(new VCSEntry[entries.size()]), commitMessage); - - // dispose ui - getUi().dispose(); - - } - - -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractConfirmUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,82 @@ +/** + * # #% 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.handler; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.AbstractUI; +import org.codelutin.vcs.ui.VCSUIConstants; +import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; +import org.codelutin.vcs.ui.model.ConfirmUIModel; + +import java.beans.PropertyChangeEvent; +import java.util.List; + +/** + * Abstract ConfirmUI handler + * + * @author chemit + */ +public abstract class AbstractConfirmUIHandler extends AbstractUIHandler<ConfirmUIModel, AbstractUI> { + + protected abstract void updateUI(); + + protected abstract void updateMessageUI(); + + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + } + String action = evt.getPropertyName(); + + if (VCSUIConstants.ACTION_PROPERTY_CHANGED.equals(action)) { + updateUI(); + return; + } + + if (VCSUIConstants.MESSAGE_HISTORY_PROPERTY_CHANGED.equals(action)) { + updateMessageUI(); + return; + } + + throw new IllegalStateException("unimplemented property changed : " + evt); + } + + public void doAction(String commitMessage, AbstractVCSEntriesTableModel model) { + + VCSAction action = getModel().getAction(); + + List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(getSelectionModel())); + + if (action.isCommit()) { + getModel().addCommitMessage(commitMessage); + + } else { + commitMessage = null; + } + + if (log.isDebugEnabled()) { + log.debug("action:" + action + ", message:" + commitMessage + ", nb files:" + entries.size()); + } + + getActionManager().add(action, entries.toArray(new VCSEntry[entries.size()]), commitMessage); + + // dispose ui + getUi().dispose(); + + } + + +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,60 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.ui.VCSUIConstants; -import org.codelutin.vcs.ui.model.AbstractVCSEntriesTableModel; -import org.codelutin.vcs.ui.model.DiffUIModel; - -import java.beans.PropertyChangeEvent; - -/** @author chemit */ -public abstract class AbstractDiffUIHandler extends AbstractUIHandler<DiffUIModel> { - - public void propertyChange(PropertyChangeEvent evt) { - //if (log.isDebugEnabled()) { - log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - //} - String action = evt.getPropertyName(); - - if (VCSUIConstants.TAB_PROPERTY_CHANGED.equals(action)) { - doSelectTab((AbstractVCSEntriesTableModel) evt.getNewValue()); - } else { - if (VCSUIConstants.FILE_PROPERTY_CHANGED.equals(action)) { - doSelectFile((VCSEntry) evt.getNewValue()); - } else { - try { - VCSAction vcsAction = VCSAction.valueOf(action.toUpperCase()); - doAction(vcsAction, (VCSEntry) evt.getNewValue()); - } catch (IllegalArgumentException e) { - // ignore ite - } - } - } - } - - public abstract void doSelectTab(AbstractVCSEntriesTableModel action); - - public abstract void doSelectFile(VCSEntry model); - - public abstract void doAction(VCSAction action, VCSEntry model); - - public abstract void gotoNextDiff(); - - public abstract void gotoPreviousDiff(); - -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractDiffUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,67 @@ +/** + * # #% 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.handler; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.AbstractDiffUI; +import org.codelutin.vcs.ui.VCSUIConstants; +import org.codelutin.vcs.ui.model.DiffUIModel; + +import java.beans.PropertyChangeEvent; + +/** @author chemit */ +public abstract class AbstractDiffUIHandler<U extends AbstractDiffUI> extends AbstractTabUIHandler<DiffUIModel, U> { + + public void propertyChange(PropertyChangeEvent evt) { + //if (log.isDebugEnabled()) { + log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + //} + + String action = evt.getPropertyName(); + if (VCSUIConstants.FILE_PROPERTY_CHANGED.equals(action)) { + doSelectFile((VCSEntry) evt.getNewValue()); + } else { + super.propertyChange(evt); + } + } + + public abstract void doSelectFile(VCSEntry model); + + public abstract void doAction(VCSAction action, VCSEntry model); + + public abstract void gotoNextDiff(); + + public abstract void gotoPreviousDiff(); + + public void doSelectLocation(VCSEntryLocation location) { + log.info(location); + + getUi().getCardLayout().show(getUi().getPreview(), location.name().toLowerCase() + "Content"); + //VCSAction[] actions = getModel().getModel().getActions((ListSelectionModel) null); + /*List<String> acts = new ArrayList<String>(); + for (VCSAction action : actions) { + acts.add(action.name().toLowerCase()); + } */ + /*boolean hasActions = actions.length > 0; + getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); + getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); + getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); + getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); + getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); + getUi().getRefreshAll().setEnabled(hasActions);*/ + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,52 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntryLocation; -import org.codelutin.vcs.ui.VCSUIConstants; -import org.codelutin.vcs.ui.model.SynchUIModel; - -import java.beans.PropertyChangeEvent; - -/** @author chemit */ -public abstract class AbstractSynchUIHandler extends AbstractUIHandler<SynchUIModel> { - - public void propertyChange(PropertyChangeEvent evt) { - //if (log.isDebugEnabled()) { - log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); - //} - String action = evt.getPropertyName(); - - if (VCSUIConstants.TAB_PROPERTY_CHANGED.equals(action)) { - doSelectLocation((VCSEntryLocation) evt.getNewValue()); - } else if (action.endsWith("All")) { - try { - String actionName = action.substring(0, action.length() - 3); - VCSAction vcsAction = VCSAction.valueOf(actionName.toUpperCase()); - doAllAction(vcsAction); - } catch (IllegalArgumentException e) { - // ignore it ? - } - } - } - - //public abstract void doSelectAction(VCSAction action); - - public abstract void doAllAction(VCSAction action); - - public abstract void doSelectLocation(VCSEntryLocation action); - -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractSynchUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,49 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.handler; + +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.AbstractSynchUI; +import org.codelutin.vcs.ui.model.SynchUIModel; + +import javax.swing.ListSelectionModel; +import java.util.ArrayList; +import java.util.List; + +/** @author chemit */ +public abstract class AbstractSynchUIHandler<U extends AbstractSynchUI> extends AbstractTabUIHandler<SynchUIModel, U> { + + public abstract void doAllAction(VCSAction action); + + public void doSelectLocation(VCSEntryLocation location) { + + super.doSelectLocation(location); + + VCSAction[] actions = getModel().getModel().getActions((ListSelectionModel) null); + List<String> acts = new ArrayList<String>(); + for (VCSAction action : actions) { + acts.add(action.name().toLowerCase()); + } + boolean hasActions = actions.length > 0; + getUi().getDiffAll().setEnabled(hasActions && acts.contains("diff")); + getUi().getUpdateAll().setEnabled(hasActions && acts.contains("update")); + getUi().getCommitAll().setEnabled(hasActions && acts.contains("commit")); + getUi().getRevertAll().setEnabled(hasActions && acts.contains("revert")); + getUi().getDeleteAll().setEnabled(hasActions && acts.contains("delete")); + getUi().getRefreshAll().setEnabled(hasActions); + } + +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractTabUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,59 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.handler; + +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.AbstractTabUI; +import org.codelutin.vcs.ui.VCSUIConstants; +import org.codelutin.vcs.ui.model.AbstractTabUIModel; + +import javax.swing.ListSelectionModel; +import java.beans.PropertyChangeEvent; + +/** @author chemit */ +public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI> extends AbstractUIHandler<M, U> { + + protected abstract void initTab(VCSEntryLocation location); + + @Override + public void init() { + super.init(); + initTab(VCSEntryLocation.ALL); + initTab(VCSEntryLocation.LOCAL); + initTab(VCSEntryLocation.REMOTE); + } + + public ListSelectionModel getSelectionModel() { + return getUi().getTable(getLocation()).getSelectionModel(); + } + + public void propertyChange(PropertyChangeEvent evt) { + //if (log.isDebugEnabled()) { + log.info(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue()); + //} + String action = evt.getPropertyName(); + + if (VCSUIConstants.TAB_PROPERTY_CHANGED.equals(action)) { + doSelectLocation((VCSEntryLocation) evt.getNewValue()); + } + } + + public void doSelectLocation(VCSEntryLocation location) { + log.info(location); + getUi().getCardLayout().show(getUi().getPreview(), location.name().toLowerCase() + "Content"); + + } + +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,48 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.VCSFactory; -import org.codelutin.vcs.runner.VCSActionManager; -import org.codelutin.vcs.ui.model.AbstractUIModel; - -import javax.swing.JDialog; -import javax.swing.ListSelectionModel; -import java.beans.PropertyChangeListener; - -/** @author chemit */ -public abstract class AbstractUIHandler<M extends AbstractUIModel> implements PropertyChangeListener { - - protected static Log log = LogFactory.getLog(AbstractUIHandler.class); - - public abstract M getModel(); - - public abstract JDialog getUi(); - - public abstract ListSelectionModel getSelectionModel(); - - public void init() { - if (getModel() == null) { - throw new IllegalStateException("no model was defined for " + this); - } - getModel().addPropertyChangeListener(this); - } - - protected VCSActionManager getActionManager() { - return VCSFactory.getActionManager(); - } -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/AbstractUIHandler.java 2008-04-06 13:06:51 UTC (rev 399) @@ -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.handler; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.VCSFactory; +import org.codelutin.vcs.runner.VCSActionManager; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.AbstractUI; +import org.codelutin.vcs.ui.model.AbstractUIModel; + +import javax.swing.ListSelectionModel; +import java.beans.PropertyChangeListener; + +/** @author chemit */ +public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI> implements PropertyChangeListener { + + protected static Log log = LogFactory.getLog(AbstractUIHandler.class); + + public abstract M getModel(); + + public abstract U getUi(); + + public abstract ListSelectionModel getSelectionModel(); + + public void init() { + if (getModel() == null) { + throw new IllegalStateException("no model was defined for " + this); + } + getModel().addPropertyChangeListener(this); + } + + public VCSEntryLocation getLocation() { + return getModel().getModel().getLocation(); + } + + protected VCSActionManager getActionManager() { + return VCSFactory.getActionManager(); + } +} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,39 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.handler; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.VCSAction; - -import javax.swing.AbstractAction; - -/** @author chemit */ -public abstract class VCSAbsractAction extends AbstractAction { - - protected static Log log = LogFactory.getLog(VCSAbsractAction.class); - - protected VCSAction action; - - private static final long serialVersionUID = 1074145285171920255L; - - public VCSAbsractAction() { - } - - public void setAction(VCSAction action) { - this.action = action; - } - -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/handler/VCSAbsractAction.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,39 @@ +/** + * # #% 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.handler; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.type.VCSAction; + +import javax.swing.AbstractAction; + +/** @author chemit */ +public abstract class VCSAbsractAction extends AbstractAction { + + protected static Log log = LogFactory.getLog(VCSAbsractAction.class); + + protected VCSAction action; + + private static final long serialVersionUID = 1074145285171920255L; + + public VCSAbsractAction() { + } + + public void setAction(VCSAction action) { + this.action = action; + } + +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model (from rev 371, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model) Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractTabUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/AbstractTabUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractTabUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractTabUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,33 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.VCSUIConstants; + +/** + * Model of a repository + * + * @author chemit + */ +public class AbstractTabUIModel extends AbstractUIModel { + + public void setLocation(VCSEntryLocation location) { + VCSEntryLocation oldLocation = getModel().getLocation(); + getModel().setLocation(location); + firePropertyChange(VCSUIConstants.TAB_PROPERTY_CHANGED, oldLocation, location); + } + +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,113 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.VCSConnexion; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSEntryLocation; -import org.codelutin.vcs.VCSException; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.List; - -/** @author chemit */ -public abstract class AbstractUIModel { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static protected final Log log = LogFactory.getLog(AbstractUIModel.class); - - /** support for change properties support */ - protected PropertyChangeSupport changeSupport; - - protected final AbstractVCSEntriesTableModel model; - - protected AbstractUIModel() { - model = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName()); - } - - public AbstractVCSEntriesTableModel getModel() { - return model; - } - - public void populate(VCSConnexion connexion) throws VCSException { - getModel().populate(connexion, System.nanoTime()); - } - - public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException { - getModel().populate(connexion, relativeLocalPaths, location, System.nanoTime()); - } - - public void populate(VCSEntryLocation location, VCSEntry[] datas) { - getModel().populate(location, datas); - } - - public void refresh(List<VCSEntry> entries) { - getModel().refresh(entries, System.nanoTime()); - } - - public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - if (listener == null) { - return; - } - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - changeSupport.addPropertyChangeListener(propertyName, listener); - } - - public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { - if (listener == null) { - return; - } - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - changeSupport.addPropertyChangeListener(listener); - } - - public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { - if (listener == null || changeSupport == null) { - return; - } - changeSupport.removePropertyChangeListener(listener); - } - - public synchronized void removePropertyChangeListeners() { - if (changeSupport == null) { - return; - } - for (PropertyChangeListener listener : getPropertyChangeListeners()) { - changeSupport.removePropertyChangeListener(listener); - } - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - if (changeSupport == null) { - return new PropertyChangeListener[0]; - } - return changeSupport.getPropertyChangeListeners(); - } - - public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - if (changeSupport == null || (oldValue == null && newValue == null) || - (oldValue != null && oldValue.equals(newValue))) { - return; - } - changeSupport.firePropertyChange(propertyName, oldValue, newValue); - } -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,128 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.ui.VCSUIConstants; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.List; + +/** @author chemit */ +public abstract class AbstractUIModel { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static protected final Log log = LogFactory.getLog(AbstractUIModel.class); + + /** current action to be fired */ + protected VCSAction action; + + /** support for change properties support */ + protected PropertyChangeSupport changeSupport; + + protected final AbstractVCSEntriesTableModel model; + + protected AbstractUIModel() { + model = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName()); + } + + public AbstractVCSEntriesTableModel getModel() { + return model; + } + + public void populate(VCSConnexion connexion) throws VCSException { + getModel().populate(connexion, System.nanoTime()); + } + + public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException { + getModel().populate(connexion, relativeLocalPaths, location, System.nanoTime()); + } + + public void populate(VCSEntryLocation location, VCSEntry[] datas) { + getModel().populate(location, datas); + } + + public void refresh(List<VCSEntry> entries) { + getModel().refresh(entries, System.nanoTime()); + } + + public VCSAction getAction() { + return action; + } + + public void setAction(VCSAction action) { + VCSAction oldAction = this.action; + this.action = action; + firePropertyChange(VCSUIConstants.ACTION_PROPERTY_CHANGED, oldAction, action); + } + + public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(propertyName, listener); + } + + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + if (listener == null || changeSupport == null) { + return; + } + changeSupport.removePropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListeners() { + if (changeSupport == null) { + return; + } + for (PropertyChangeListener listener : getPropertyChangeListeners()) { + changeSupport.removePropertyChangeListener(listener); + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners() { + if (changeSupport == null) { + return new PropertyChangeListener[0]; + } + return changeSupport.getPropertyChangeListeners(); + } + + public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (changeSupport == null || (oldValue == null && newValue == null) || + (oldValue != null && oldValue.equals(newValue))) { + return; + } + changeSupport.firePropertyChange(propertyName, oldValue, newValue); + } +} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,187 +0,0 @@ -/* -* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* ##% */ -package org.codelutin.vcs.ui.model; - -import static org.codelutin.i18n.I18n._; -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSConnexion; -import org.codelutin.vcs.VCSEntries; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSEntryLocation; -import org.codelutin.vcs.VCSException; -import org.codelutin.vcs.VCSState; -import org.codelutin.vcs.util.VCSEntriesImpl; - -import javax.swing.ListSelectionModel; -import java.util.ArrayList; -import java.util.List; - -/** - * Simple Table model to display list of VCSFileState - * - * @author chemit - */ -public abstract class AbstractVCSEntriesTableModel extends javax.swing.table.AbstractTableModel implements VCSEntries { - - protected final String name; - - /** column names */ - protected final String[] columnNames; - - protected VCSEntryLocation location; - - /** delegate model */ - protected final transient VCSEntries delegate; - - /** displayed entries */ - protected final transient List<VCSEntry> displayedEntries; - - private static final long serialVersionUID = 4697917831388337369L; - - protected AbstractVCSEntriesTableModel(String name, String[] columnNames) { - super(); - this.name = name; - this.columnNames = columnNames; - this.displayedEntries = new ArrayList<VCSEntry>(); - this.delegate = new VCSEntriesImpl(); - } - - public String getName() { - return name; - } - - public VCSEntryLocation getLocation() { - return location; - } - - public List<VCSEntry> getDisplayedEntries(ListSelectionModel selectionModel) { - return selectionModel == null ? new ArrayList<VCSEntry>(displayedEntries) : filter(selectionModel, displayedEntries); - } - - public int getColumnCount() { - return columnNames.length; - } - - public int getRowCount() { - return displayedEntries.size(); - } - - @Override - public String getColumnName(int columnIndex) { - return _(columnNames[columnIndex]); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - // read only data - return false; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - // read only data - } - - public void setLocation(VCSEntryLocation location) { - this.location = location; - displayedEntries.clear(); - displayedEntries.addAll(filter(location, getEntries())); - fireTableDataChanged(); - } - - public VCSAction[] getActions(ListSelectionModel selectionModel) { - return getActions(getDisplayedEntries(selectionModel)); - } - - @Override - public String toString() { - return super.toString() + "<name:" + name + ", size:" + (getRowCount()) + '>'; - } - - //===================================================================================================// - // === delegate methods =============================================================================// - //===================================================================================================// - - public List<VCSEntry> getEntries() { - return delegate.getEntries(); - } - - public List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries) { - return delegate.filter(action, entries); - } - - public List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries) { - return delegate.filter(connexion, entries); - } - - public List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries) { - return delegate.filter(location, entries); - } - - public List<VCSEntry> filter(VCSState state, List<VCSEntry> entries) { - return delegate.filter(state, entries); - } - - public List<VCSEntry> filter(ListSelectionModel selectionModel, List<VCSEntry> entries) { - return delegate.filter(selectionModel, entries); - } - - public void populate(VCSConnexion connexion, long timestamp) throws VCSException { - delegate.populate(connexion, timestamp); - updateEntries(); - } - - public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException { - delegate.populate(connexion, relativeLocalPaths, location, timestamp); - updateEntries(); - } - - public void populate(VCSEntryLocation location, VCSEntry[] states) { - clear(); - this.location = location; - delegate.populate(location, states); - updateEntries(); - } - - public void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException { - delegate.refresh(entries, timestamp); - updateEntries(); - } - - public VCSAction[] getActions(List<VCSEntry> entries) { - return delegate.getActions(entries); - } - - public VCSState[] getStates(List<VCSEntry> entries) { - return delegate.getStates(entries); - } - - public void clear() { - delegate.clear(); - displayedEntries.clear(); - fireTableDataChanged(); - } - - protected void updateEntries() { - displayedEntries.clear(); - displayedEntries.addAll(filter(location, delegate.getEntries())); - fireTableDataChanged(); - } -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/AbstractVCSEntriesTableModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,187 @@ +/* +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package org.codelutin.vcs.ui.model; + +import static org.codelutin.i18n.I18n._; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSEntries; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.type.VCSState; +import org.codelutin.vcs.util.VCSEntriesImpl; + +import javax.swing.ListSelectionModel; +import java.util.ArrayList; +import java.util.List; + +/** + * Simple Table model to display list of VCSFileState + * + * @author chemit + */ +public abstract class AbstractVCSEntriesTableModel extends javax.swing.table.AbstractTableModel implements VCSEntries { + + protected final String name; + + /** column names */ + protected final String[] columnNames; + + protected VCSEntryLocation location; + + /** delegate model */ + protected final transient VCSEntries delegate; + + /** displayed entries */ + protected final transient List<VCSEntry> displayedEntries; + + private static final long serialVersionUID = 4697917831388337369L; + + protected AbstractVCSEntriesTableModel(String name, String[] columnNames) { + super(); + this.name = name; + this.columnNames = columnNames; + this.displayedEntries = new ArrayList<VCSEntry>(); + this.delegate = new VCSEntriesImpl(); + } + + public String getName() { + return name; + } + + public VCSEntryLocation getLocation() { + return location; + } + + public List<VCSEntry> getDisplayedEntries(ListSelectionModel selectionModel) { + return selectionModel == null ? new ArrayList<VCSEntry>(displayedEntries) : filter(selectionModel, displayedEntries); + } + + public int getColumnCount() { + return columnNames.length; + } + + public int getRowCount() { + return displayedEntries.size(); + } + + @Override + public String getColumnName(int columnIndex) { + return _(columnNames[columnIndex]); + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + // read only data + return false; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + // read only data + } + + public void setLocation(VCSEntryLocation location) { + this.location = location; + displayedEntries.clear(); + displayedEntries.addAll(filter(location, getEntries())); + fireTableDataChanged(); + } + + public VCSAction[] getActions(ListSelectionModel selectionModel) { + return getActions(getDisplayedEntries(selectionModel)); + } + + @Override + public String toString() { + return super.toString() + "<name:" + name + ", size:" + (getRowCount()) + '>'; + } + + //===================================================================================================// + // === delegate methods =============================================================================// + //===================================================================================================// + + public List<VCSEntry> getEntries() { + return delegate.getEntries(); + } + + public List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries) { + return delegate.filter(action, entries); + } + + public List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries) { + return delegate.filter(connexion, entries); + } + + public List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries) { + return delegate.filter(location, entries); + } + + public List<VCSEntry> filter(VCSState state, List<VCSEntry> entries) { + return delegate.filter(state, entries); + } + + public List<VCSEntry> filter(ListSelectionModel selectionModel, List<VCSEntry> entries) { + return delegate.filter(selectionModel, entries); + } + + public void populate(VCSConnexion connexion, long timestamp) throws VCSException { + delegate.populate(connexion, timestamp); + updateEntries(); + } + + public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException { + delegate.populate(connexion, relativeLocalPaths, location, timestamp); + updateEntries(); + } + + public void populate(VCSEntryLocation location, VCSEntry[] states) { + clear(); + this.location = location; + delegate.populate(location, states); + updateEntries(); + } + + public void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException { + delegate.refresh(entries, timestamp); + updateEntries(); + } + + public VCSAction[] getActions(List<VCSEntry> entries) { + return delegate.getActions(entries); + } + + public VCSState[] getStates(List<VCSEntry> entries) { + return delegate.getStates(entries); + } + + public void clear() { + delegate.clear(); + displayedEntries.clear(); + fireTableDataChanged(); + } + + protected void updateEntries() { + displayedEntries.clear(); + displayedEntries.addAll(filter(location, delegate.getEntries())); + fireTableDataChanged(); + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,65 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSEntryLocation; -import static org.codelutin.vcs.ui.VCSUIConstants.ACTION_PROPERTY_CHANGED; -import static org.codelutin.vcs.ui.VCSUIConstants.MESSAGE_HISTORY_PROPERTY_CHANGED; - -import java.util.ArrayList; -import java.util.List; - -/** - * Model of a repository - * - * @author chemit - */ -public class ConfirmUIModel extends AbstractUIModel { - - /** history of commit messages */ - protected List<String> commitMessages; - - /** current action to fired */ - protected VCSAction action; - - public VCSAction getAction() { - return action; - } - - public List<String> getCommitMessages() { - if (commitMessages == null) { - commitMessages = new ArrayList<String>(); - } - return commitMessages; - } - - public void addCommitMessage(String commitMessage) { - if (commitMessage != null && !commitMessage.isEmpty() && !getCommitMessages().contains(commitMessage)) { - // add message in history - getCommitMessages().add(commitMessage); - firePropertyChange(MESSAGE_HISTORY_PROPERTY_CHANGED, null, commitMessage); - } - } - - public void init(VCSAction action, VCSEntryLocation location, VCSEntry[] states) { - this.action = action; - model.clear(); - model.populate(location, states); - // never propagate old action, since need always the property changed - firePropertyChange(ACTION_PROPERTY_CHANGED, null, action); - } -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,59 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import static org.codelutin.vcs.ui.VCSUIConstants.MESSAGE_HISTORY_PROPERTY_CHANGED; + +import java.util.ArrayList; +import java.util.List; + +/** + * Model of a repository + * + * @author chemit + */ +public class ConfirmUIModel extends AbstractUIModel { + + /** history of commit messages */ + protected List<String> commitMessages; + + + public List<String> getCommitMessages() { + if (commitMessages == null) { + commitMessages = new ArrayList<String>(); + } + return commitMessages; + } + + public void addCommitMessage(String commitMessage) { + if (commitMessage != null && !commitMessage.isEmpty() && !getCommitMessages().contains(commitMessage)) { + // add message in history + getCommitMessages().add(commitMessage); + firePropertyChange(MESSAGE_HISTORY_PROPERTY_CHANGED, null, commitMessage); + } + } + + public void init(VCSAction action, VCSEntryLocation location, VCSEntry[] states) { + // always reset action in order to allow propagation of action changed + this.action = null; + model.clear(); + model.populate(location, states); + setAction(action); + } + +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,157 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSHandler; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.net.URL; - -/** - * Model of a diff panel (remote content vs local content - * - * @author chemit - */ -public class DiffPanelUIModel { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static protected final Log log = LogFactory.getLog(DiffPanelUIModel.class); - - /** local root : wroking copy */ - protected URL leftRoot; - - /** remote root : remote url */ - protected URL rightRoot; - - /** vcs handler to use (lazy instanciation) */ - protected VCSHandler handler; - - /** map of models */ - protected VCSEntry model; - - /** support for change properties support */ - protected PropertyChangeSupport changeSupport; - - /** local content */ - protected String leftContent; - - /** remote content */ - protected String rightContent; - - /** current action to fired */ - protected VCSAction action; - - public DiffPanelUIModel() { - } - - public DiffPanelUIModel(VCSHandler handler, URL leftRoot, URL rightRoot) { - this.handler = handler; - this.leftRoot = leftRoot; - this.rightRoot = rightRoot; - } - - public VCSHandler getHandler() { - return handler; - } - - public URL getLeftRoot() { - return leftRoot; - } - - public URL getRightRoot() { - return rightRoot; - } - - public String getLeftContent() { - return leftContent; - } - - public String getRightContent() { - return rightContent; - } - - public void setLeftContent(String leftContent) { - this.leftContent = leftContent; - } - - public void setLeftRoot(URL leftRoot) { - this.leftRoot = leftRoot; - } - - public void setRightContent(String rightContent) { - this.rightContent = rightContent; - } - - public void setRightRoot(URL rightRoot) { - this.rightRoot = rightRoot; - } - - public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - if (listener == null) { - return; - } - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - changeSupport.addPropertyChangeListener(propertyName, listener); - } - - public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { - if (listener == null) { - return; - } - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - changeSupport.addPropertyChangeListener(listener); - } - - public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { - if (listener == null || changeSupport == null) { - return; - } - changeSupport.removePropertyChangeListener(listener); - } - - public synchronized void removePropertyChangeListeners() { - if (changeSupport == null) { - return; - } - for (PropertyChangeListener listener : getPropertyChangeListeners()) { - changeSupport.removePropertyChangeListener(listener); - } - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - if (changeSupport == null) { - return new PropertyChangeListener[0]; - } - return changeSupport.getPropertyChangeListeners(); - } - - public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - if (changeSupport == null || (oldValue == null && newValue == null) || - (oldValue != null && oldValue.equals(newValue))) { - return; - } - changeSupport.firePropertyChange(propertyName, oldValue, newValue); - } - -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffPanelUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,157 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.VCSHandler; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.net.URL; + +/** + * Model of a diff panel (remote content vs local content + * + * @author chemit + */ +public class DiffPanelUIModel { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static protected final Log log = LogFactory.getLog(DiffPanelUIModel.class); + + /** local root : wroking copy */ + protected URL leftRoot; + + /** remote root : remote url */ + protected URL rightRoot; + + /** vcs handler to use (lazy instanciation) */ + protected VCSHandler handler; + + /** map of models */ + protected VCSEntry model; + + /** support for change properties support */ + protected PropertyChangeSupport changeSupport; + + /** local content */ + protected String leftContent; + + /** remote content */ + protected String rightContent; + + /** current action to fired */ + protected VCSAction action; + + public DiffPanelUIModel() { + } + + public DiffPanelUIModel(VCSHandler handler, URL leftRoot, URL rightRoot) { + this.handler = handler; + this.leftRoot = leftRoot; + this.rightRoot = rightRoot; + } + + public VCSHandler getHandler() { + return handler; + } + + public URL getLeftRoot() { + return leftRoot; + } + + public URL getRightRoot() { + return rightRoot; + } + + public String getLeftContent() { + return leftContent; + } + + public String getRightContent() { + return rightContent; + } + + public void setLeftContent(String leftContent) { + this.leftContent = leftContent; + } + + public void setLeftRoot(URL leftRoot) { + this.leftRoot = leftRoot; + } + + public void setRightContent(String rightContent) { + this.rightContent = rightContent; + } + + public void setRightRoot(URL rightRoot) { + this.rightRoot = rightRoot; + } + + public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(propertyName, listener); + } + + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + return; + } + if (changeSupport == null) { + changeSupport = new PropertyChangeSupport(this); + } + changeSupport.addPropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + if (listener == null || changeSupport == null) { + return; + } + changeSupport.removePropertyChangeListener(listener); + } + + public synchronized void removePropertyChangeListeners() { + if (changeSupport == null) { + return; + } + for (PropertyChangeListener listener : getPropertyChangeListeners()) { + changeSupport.removePropertyChangeListener(listener); + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners() { + if (changeSupport == null) { + return new PropertyChangeListener[0]; + } + return changeSupport.getPropertyChangeListeners(); + } + + public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (changeSupport == null || (oldValue == null && newValue == null) || + (oldValue != null && oldValue.equals(newValue))) { + return; + } + changeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,65 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSEntryLocation; -import org.codelutin.vcs.ui.VCSUIConstants; - -/** - * Model of a repository - * - * @author chemit - */ -public class DiffUIModel extends AbstractUIModel { - - - /** current file displayed */ - protected VCSEntry fileModel; - - /** current action to fired */ - protected VCSAction action; - - private VCSEntryLocation location; - - public void setLocation(VCSEntryLocation location) { - VCSEntryLocation oldLocation = this.location; - getModel().setLocation(location); - this.location = location; - firePropertyChange(VCSUIConstants.TAB_PROPERTY_CHANGED, oldLocation, location); - } - - - public void setFileModel(VCSEntry fileModel) { - VCSEntry oldFileModel = this.fileModel; - this.fileModel = fileModel; - firePropertyChange(VCSUIConstants.TAB_PROPERTY_CHANGED, oldFileModel, fileModel); - } - - public void doAllAction(VCSAction action) { - this.action = action; - firePropertyChange(action.name().toLowerCase() + "All", null, model); - } - - public void doAction(VCSAction action) { - this.action = action; - firePropertyChange(action.name().toLowerCase(), null, model); - } - - public VCSEntryLocation getLocation() { - return location; - } -} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,39 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.ui.VCSUIConstants; + +/** + * Model of a repository + * + * @author chemit + */ +public class DiffUIModel extends AbstractTabUIModel { + + /** current file displayed */ + protected VCSEntry fileModel; + + public void setFileModel(VCSEntry fileModel) { + VCSEntry oldFileModel = this.fileModel; + this.fileModel = fileModel; + firePropertyChange(VCSUIConstants.TAB_PROPERTY_CHANGED, oldFileModel, fileModel); + } + + public VCSEntry getFileModel() { + return fileModel; + } +} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,52 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.codelutin.vcs.VCSEntry; -import org.codelutin.vcs.VCSState; -import org.codelutin.vcs.ui.VCSUIConstants; - -/** @author chemit */ -public class SimpleVCSEntriesTableModelImpl extends AbstractVCSEntriesTableModel { - - private static final long serialVersionUID = -6397327068709720165L; - - protected SimpleVCSEntriesTableModelImpl(String name) { - - super(name, VCSUIConstants.SIMPLE_COLUMNS_NAMES); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - if (getRowCount() == 0) { - return null; - } - VCSEntry item = displayedEntries.get(rowIndex); - Object result = null; - if (columnIndex == 0) { - // get module - result = item.getRelativeLocalPath(); - } else if (columnIndex == 1) { - // get file - result = item.getFile().getName(); - } else if (columnIndex == 2) { - // get status - VCSState state = item.getState(); - result = state == null ? null : state.libelle(); - } - return result; - } - - -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,52 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.VCSEntry; +import org.codelutin.vcs.type.VCSState; +import org.codelutin.vcs.ui.VCSUIConstants; + +/** @author chemit */ +public class SimpleVCSEntriesTableModelImpl extends AbstractVCSEntriesTableModel { + + private static final long serialVersionUID = -6397327068709720165L; + + protected SimpleVCSEntriesTableModelImpl(String name) { + + super(name, VCSUIConstants.SIMPLE_COLUMNS_NAMES); + } + + public Object getValueAt(int rowIndex, int columnIndex) { + if (getRowCount() == 0) { + return null; + } + VCSEntry item = displayedEntries.get(rowIndex); + Object result = null; + if (columnIndex == 0) { + // get module + result = item.getRelativeLocalPath(); + } else if (columnIndex == 1) { + // get file + result = item.getFile().getName(); + } else if (columnIndex == 2) { + // get status + VCSState state = item.getState(); + result = state == null ? null : state.libelle(); + } + return result; + } + + +} Deleted: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-05 20:43:39 UTC (rev 371) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -1,42 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui.model; - -import org.codelutin.vcs.VCSAction; -import org.codelutin.vcs.VCSEntryLocation; -import org.codelutin.vcs.ui.VCSUIConstants; - -/** - * Model of a repository - * - * @author chemit - */ -public class SynchUIModel extends AbstractUIModel { - - /** current action to be fired */ - protected VCSAction action; - - public void setLocation(VCSEntryLocation location) { - VCSEntryLocation oldLocation = getModel().getLocation(); - getModel().setLocation(location); - firePropertyChange(VCSUIConstants.TAB_PROPERTY_CHANGED, oldLocation, location); - } - - public void doAllAction(VCSAction action) { - this.action = action; - firePropertyChange(action.name().toLowerCase() + "All", null, model); - } - -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-06 13:06:51 UTC (rev 399) @@ -0,0 +1,32 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui.model; + +import org.codelutin.vcs.type.VCSAction; + +/** + * Model of a repository + * + * @author chemit + */ +public class SynchUIModel extends AbstractTabUIModel { + + public void doAllAction(VCSAction action) { + + setAction(action); + firePropertyChange(action.name().toLowerCase() + "All", null, model); + } + +}