Author: tchemit Date: 2008-04-06 13:07:15 +0000 (Sun, 06 Apr 2008) New Revision: 400 Added: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractUI.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/UIHelper.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java Removed: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractUI.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/UIHelper.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java Log: new module : ui-pre-jaxx Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,64 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.ui.handler.AbstractDiffUIHandler; -import org.codelutin.vcs.ui.handler.AbstractTabUIHandler; -import org.codelutin.vcs.ui.model.AbstractTabUIModel; -import org.codelutin.vcs.ui.model.DiffUIModel; - -import javax.swing.JButton; -import javax.swing.JTable; - -/** @author chemit */ -public abstract class AbstractDiffUI extends AbstractTabUI { - - public abstract JButton getNextDiff(); - - public abstract JButton getPreviousDiff(); - - public AbstractDiffUI() { - super(); - } - - public AbstractDiffUI(AbstractTabUIHandler handler, AbstractTabUIModel model) { - super(handler, model); - } - - public DiffUIModel getModel() { - return (DiffUIModel) model; - } - - protected AbstractDiffUIHandler getHandler() { - return (AbstractDiffUIHandler) handler; - } - - protected void selectFile(JTable table) { - getModel().setFileModel(model.getModel().getDisplayedEntries(table.getSelectionModel()).get(0)); - } - - protected void doAction(VCSAction action) { - getHandler().doAction(action, getModel().getFileModel()); - } - - protected void gotoNextDiff() { - getHandler().gotoNextDiff(); - } - - protected void gotoPreviousDiff() { - getHandler().gotoPreviousDiff(); - } -} Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,80 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.handler.AbstractSynchUIHandler; -import org.codelutin.vcs.ui.model.SynchUIModel; - -import javax.swing.JButton; -import java.awt.CardLayout; - -/** @author chemit */ -public abstract class AbstractSynchUI extends AbstractTabUI { - - public abstract JButton getRefreshAll(); - - public abstract JButton getDiffAll(); - - public abstract JButton getUpdateAll(); - - public abstract JButton getCommitAll(); - - public abstract JButton getRevertAll(); - - public abstract JButton getDeleteAll(); - - public abstract AbstractVCSPopup getAllPopup(); - - public abstract AbstractVCSPopup getLocalPopup(); - - public abstract AbstractVCSPopup getRemotePopup(); - - - public AbstractSynchUI() { - super(); - } - - public AbstractSynchUI(AbstractSynchUIHandler handler, SynchUIModel model) { - super(handler, model); - } - - public SynchUIModel getModel() { - return (SynchUIModel) model; - } - - protected AbstractSynchUIHandler getHandler() { - return (AbstractSynchUIHandler) handler; - } - - protected void doAllAction(VCSAction action) { - getModel().doAllAction(action); - } - - public AbstractVCSPopup getPopup(VCSEntryLocation modelName) { - switch (modelName) { - case ALL: - return getAllPopup(); - case LOCAL: - return getLocalPopup(); - case REMOTE: - return getRemotePopup(); - case UNKNOW: - break; - } - throw new IllegalStateException("no popup found for " + modelName); - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,95 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.ui.handler.AbstractTabUIHandler; -import org.codelutin.vcs.ui.model.AbstractTabUIModel; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JToggleButton; -import java.awt.CardLayout; - -/** @author chemit */ -public abstract class AbstractTabUI extends AbstractUI { - - public abstract JToggleButton getAllTab(); - - public abstract JToggleButton getLocalTab(); - - public abstract JToggleButton getRemoteTab(); - - public abstract JScrollPane getAllContent(); - - public abstract JScrollPane getLocalContent(); - - public abstract JScrollPane getRemoteContent(); - - public abstract JTable getAllTable(); - - public abstract JTable getLocalTable(); - - public abstract JTable getRemoteTable(); - - public abstract JPanel getPreview(); - - public abstract CardLayout getCardLayout(); - - public AbstractTabUI(AbstractTabUIHandler handler, AbstractTabUIModel model) { - super(handler, model); - } - - public AbstractTabUI() { - // for jaxx but never used - super(); - } - - public AbstractTabUIModel getModel() { - return (AbstractTabUIModel) model; - } - - protected AbstractTabUIHandler getHandler() { - return (AbstractTabUIHandler) handler; - } - - @Override - public void setVisible(boolean b) { - if (handler.getLocation() == VCSEntryLocation.UNKNOW) { - // first launch, no tab model selected,choose one - getAllTab().doClick(); - } - super.setVisible(b); - } - - public JTable getTable(VCSEntryLocation modelName) { - switch (modelName) { - case ALL: - return getAllTable(); - case LOCAL: - return getLocalTable(); - case REMOTE: - return getRemoteTable(); - case UNKNOW: - break; - } - throw new IllegalStateException("no table found for " + modelName); - } - - protected void setLocation(VCSEntryLocation location) { - getModel().setLocation(location); - } -} Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractUI.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractUI.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,47 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import org.codelutin.vcs.ui.handler.AbstractUIHandler; -import org.codelutin.vcs.ui.model.AbstractUIModel; - -/** @author chemit */ -public class AbstractUI extends javax.swing.JDialog { - - protected final AbstractUIModel model; - - protected final AbstractUIHandler handler; - - public AbstractUI() { - // Jaxx always generate the default constructor, so need it, but DO NOT USE IT! - throw new IllegalStateException("the default constructor can NOT be used!"); - } - - public AbstractUI(AbstractUIHandler handler, AbstractUIModel model) { - this.handler = handler; - this.model = model; - UIHelper.setQuitAction(this); - } - - public AbstractUIModel getModel() { - return model; - } - - protected AbstractUIHandler getHandler() { - return handler; - } - - -} Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java 2008-04-06 13:07:15 UTC (rev 400) @@ -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; - -import org.codelutin.vcs.ui.handler.VCSAbsractAction; -import org.codelutin.vcs.type.VCSAction; - -import javax.swing.JMenuItem; -import java.awt.event.ActionEvent; - -/** @author chemit */ -public abstract class AbstractVCSPopup extends javax.swing.JPopupMenu {/* begin raw body code */ - protected VCSAbsractAction dispatchAction; - - public abstract JMenuItem getRefresh(); - - public abstract JMenuItem getDiff(); - - public abstract JMenuItem getUpdate(); - - public abstract JMenuItem getCommit(); - - public abstract JMenuItem getRevert(); - - public abstract JMenuItem getDelete(); - - protected void setDispatchAction(VCSAbsractAction action) { - this.dispatchAction = action; - } - - protected void doAction(VCSAction action, JMenuItem item) { - dispatchAction.setAction(action); - ActionEvent e = new ActionEvent(item, 1, action.name()); - dispatchAction.actionPerformed(e); - } -} Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/UIHelper.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/UIHelper.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/UIHelper.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,45 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import javax.swing.JDialog; -import javax.swing.JRootPane; -import javax.swing.Action; -import javax.swing.AbstractAction; -import javax.swing.JComponent; -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -/** - * UI Helper methods - * - * @author chemit - */ -public class UIHelper { - public static void setQuitAction(final JDialog ui) { - JRootPane rootPane = ui.getRootPane(); - //rootPane.setDefaultButton(accept); - - Action quitAction = new AbstractAction("quit") { - private static final long serialVersionUID = -869095664995763057L; - - public void actionPerformed(ActionEvent e) { - ui.dispose(); - } - }; - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); - rootPane.getActionMap().put("quit", quitAction); - } -} Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,44 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.TagManager; -import jaxx.tags.swing.JPopupMenuHandler; -import jaxx.tags.swing.JWindowHandler; - -import java.beans.Introspector; - -public class VCSInitializer implements jaxx.spi.Initializer { - - public void initialize() { - String[] searchPath = Introspector.getBeanInfoSearchPath(); - String[] newSearchPath = new String[searchPath.length + 1]; - System.arraycopy(searchPath, 0, newSearchPath, 0, searchPath.length); - newSearchPath[newSearchPath.length - 1] = "jaxx.beaninfos"; - - Introspector.setBeanInfoSearchPath(newSearchPath); - - TagManager.registerTag("org.codelutin.vcs.ui.*", "JVCSPopup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JPopupMenuHandler.class))); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractSynchUI.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractVCSPopup.class), JPopupMenuHandler.class); - - //TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractUI.class), JDialog.class); - - //TagManager.registerDefaultNamespace("AbstractUI", "javax.swing.*"); - - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java 2008-04-06 13:06:51 UTC (rev 399) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java 2008-04-06 13:07:15 UTC (rev 400) @@ -1,67 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.ui; - -import static org.codelutin.i18n.I18n.n_; - -/** @author chemit */ -public class VCSUIConstants { - - /** columns names for a simple table model with module, file and status */ - public static final String[] SIMPLE_COLUMNS_NAMES = new String[]{ - n_("lutinvcs.module"), - n_("lutinvcs.file"), - n_("lutinvcs.status") - }; - - /** model name for synchronize ui */ - public static final String SYNCH_MODEL_PROPERTY = "modelSynch"; - - /** model name for confirm ui */ - public static final String CONFIRM_MODEL_PROPERTY = "modelConfirm"; - - /** model name for diff ui */ - public static final String DIFF_MODEL_PROPERTY = "modelConfirm"; - - public static final String ACTION_PROPERTY_CHANGED = "action"; - - public static final String MESSAGE_HISTORY_PROPERTY_CHANGED = "historyMessage"; - - public static final String FILE_PROPERTY_CHANGED = "file"; - - public static final String NEXT_DIFF_PROPERTY_CHANGED = "nextDiff"; - - public static final String PREVIOUS_DIFF_PROPERTY_CHANGED = "previousDiff"; - - public static final String REFRESH_PROPERTY_CHANGED = "refresh"; - - public static final String TAB_PROPERTY_CHANGED = "tab"; - - public static final String DIFF_ALL_PROPERTY_CHANGED = "diffAll"; - - public static final String COMMIT_ALL_PROPERTY_CHANGED = "commitAll"; - - public static final String UPDATE_ALL_PROPERTY_CHANGED = "updateAll"; - - public static final String REVERT_ALL_PROPERTY_CHANGED = "revertAll"; - - public static final String DIFF_PROPERTY_CHANGED = "diff"; - - public static final String COMMIT_PROPERTY_CHANGED = "commit"; - - public static final String UPDATE_PROPERTY_CHANGED = "update"; - - public static final String REVERT_PROPERTY_CHANGED = "revert"; -} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractDiffUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,64 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.ui.handler.AbstractDiffUIHandler; +import org.codelutin.vcs.ui.handler.AbstractTabUIHandler; +import org.codelutin.vcs.ui.model.AbstractTabUIModel; +import org.codelutin.vcs.ui.model.DiffUIModel; + +import javax.swing.JButton; +import javax.swing.JTable; + +/** @author chemit */ +public abstract class AbstractDiffUI extends AbstractTabUI { + + public abstract JButton getNextDiff(); + + public abstract JButton getPreviousDiff(); + + public AbstractDiffUI() { + super(); + } + + public AbstractDiffUI(AbstractTabUIHandler handler, AbstractTabUIModel model) { + super(handler, model); + } + + public DiffUIModel getModel() { + return (DiffUIModel) model; + } + + protected AbstractDiffUIHandler getHandler() { + return (AbstractDiffUIHandler) handler; + } + + protected void selectFile(JTable table) { + getModel().setFileModel(model.getModel().getDisplayedEntries(table.getSelectionModel()).get(0)); + } + + protected void doAction(VCSAction action) { + getHandler().doAction(action, getModel().getFileModel()); + } + + protected void gotoNextDiff() { + getHandler().gotoNextDiff(); + } + + protected void gotoPreviousDiff() { + getHandler().gotoPreviousDiff(); + } +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractSynchUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,80 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.handler.AbstractSynchUIHandler; +import org.codelutin.vcs.ui.model.SynchUIModel; + +import javax.swing.JButton; +import java.awt.CardLayout; + +/** @author chemit */ +public abstract class AbstractSynchUI extends AbstractTabUI { + + public abstract JButton getRefreshAll(); + + public abstract JButton getDiffAll(); + + public abstract JButton getUpdateAll(); + + public abstract JButton getCommitAll(); + + public abstract JButton getRevertAll(); + + public abstract JButton getDeleteAll(); + + public abstract AbstractVCSPopup getAllPopup(); + + public abstract AbstractVCSPopup getLocalPopup(); + + public abstract AbstractVCSPopup getRemotePopup(); + + + public AbstractSynchUI() { + super(); + } + + public AbstractSynchUI(AbstractSynchUIHandler handler, SynchUIModel model) { + super(handler, model); + } + + public SynchUIModel getModel() { + return (SynchUIModel) model; + } + + protected AbstractSynchUIHandler getHandler() { + return (AbstractSynchUIHandler) handler; + } + + protected void doAllAction(VCSAction action) { + getModel().doAllAction(action); + } + + public AbstractVCSPopup getPopup(VCSEntryLocation modelName) { + switch (modelName) { + case ALL: + return getAllPopup(); + case LOCAL: + return getLocalPopup(); + case REMOTE: + return getRemotePopup(); + case UNKNOW: + break; + } + throw new IllegalStateException("no popup found for " + modelName); + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractTabUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,95 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.ui.handler.AbstractTabUIHandler; +import org.codelutin.vcs.ui.model.AbstractTabUIModel; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JToggleButton; +import java.awt.CardLayout; + +/** @author chemit */ +public abstract class AbstractTabUI extends AbstractUI { + + public abstract JToggleButton getAllTab(); + + public abstract JToggleButton getLocalTab(); + + public abstract JToggleButton getRemoteTab(); + + public abstract JScrollPane getAllContent(); + + public abstract JScrollPane getLocalContent(); + + public abstract JScrollPane getRemoteContent(); + + public abstract JTable getAllTable(); + + public abstract JTable getLocalTable(); + + public abstract JTable getRemoteTable(); + + public abstract JPanel getPreview(); + + public abstract CardLayout getCardLayout(); + + public AbstractTabUI(AbstractTabUIHandler handler, AbstractTabUIModel model) { + super(handler, model); + } + + public AbstractTabUI() { + // for jaxx but never used + super(); + } + + public AbstractTabUIModel getModel() { + return (AbstractTabUIModel) model; + } + + protected AbstractTabUIHandler getHandler() { + return (AbstractTabUIHandler) handler; + } + + @Override + public void setVisible(boolean b) { + if (handler.getLocation() == VCSEntryLocation.UNKNOW) { + // first launch, no tab model selected,choose one + getAllTab().doClick(); + } + super.setVisible(b); + } + + public JTable getTable(VCSEntryLocation modelName) { + switch (modelName) { + case ALL: + return getAllTable(); + case LOCAL: + return getLocalTable(); + case REMOTE: + return getRemoteTable(); + case UNKNOW: + break; + } + throw new IllegalStateException("no table found for " + modelName); + } + + protected void setLocation(VCSEntryLocation location) { + getModel().setLocation(location); + } +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractUI.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractUI.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractUI.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractUI.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,47 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.ui.handler.AbstractUIHandler; +import org.codelutin.vcs.ui.model.AbstractUIModel; + +/** @author chemit */ +public class AbstractUI extends javax.swing.JDialog { + + protected final AbstractUIModel model; + + protected final AbstractUIHandler handler; + + public AbstractUI() { + // Jaxx always generate the default constructor, so need it, but DO NOT USE IT! + throw new IllegalStateException("the default constructor can NOT be used!"); + } + + public AbstractUI(AbstractUIHandler handler, AbstractUIModel model) { + this.handler = handler; + this.model = model; + UIHelper.setQuitAction(this); + } + + public AbstractUIModel getModel() { + return model; + } + + protected AbstractUIHandler getHandler() { + return handler; + } + + +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/AbstractVCSPopup.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,48 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import org.codelutin.vcs.ui.handler.VCSAbsractAction; +import org.codelutin.vcs.type.VCSAction; + +import javax.swing.JMenuItem; +import java.awt.event.ActionEvent; + +/** @author chemit */ +public abstract class AbstractVCSPopup extends javax.swing.JPopupMenu {/* begin raw body code */ + protected VCSAbsractAction dispatchAction; + + public abstract JMenuItem getRefresh(); + + public abstract JMenuItem getDiff(); + + public abstract JMenuItem getUpdate(); + + public abstract JMenuItem getCommit(); + + public abstract JMenuItem getRevert(); + + public abstract JMenuItem getDelete(); + + protected void setDispatchAction(VCSAbsractAction action) { + this.dispatchAction = action; + } + + protected void doAction(VCSAction action, JMenuItem item) { + dispatchAction.setAction(action); + ActionEvent e = new ActionEvent(item, 1, action.name()); + dispatchAction.actionPerformed(e); + } +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/UIHelper.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/UIHelper.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/UIHelper.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/UIHelper.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,45 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import javax.swing.JDialog; +import javax.swing.JRootPane; +import javax.swing.Action; +import javax.swing.AbstractAction; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +/** + * UI Helper methods + * + * @author chemit + */ +public class UIHelper { + public static void setQuitAction(final JDialog ui) { + JRootPane rootPane = ui.getRootPane(); + //rootPane.setDefaultButton(accept); + + Action quitAction = new AbstractAction("quit") { + private static final long serialVersionUID = -869095664995763057L; + + public void actionPerformed(ActionEvent e) { + ui.dispose(); + } + }; + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); + rootPane.getActionMap().put("quit", quitAction); + } +} Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-06 13:07:15 UTC (rev 400) @@ -0,0 +1,44 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.ui; + +import jaxx.reflect.ClassDescriptorLoader; +import jaxx.tags.TagManager; +import jaxx.tags.swing.JPopupMenuHandler; +import jaxx.tags.swing.JWindowHandler; + +import java.beans.Introspector; + +public class VCSInitializer implements jaxx.spi.Initializer { + + public void initialize() { + String[] searchPath = Introspector.getBeanInfoSearchPath(); + String[] newSearchPath = new String[searchPath.length + 1]; + System.arraycopy(searchPath, 0, newSearchPath, 0, searchPath.length); + newSearchPath[newSearchPath.length - 1] = "jaxx.beaninfos"; + + Introspector.setBeanInfoSearchPath(newSearchPath); + + TagManager.registerTag("org.codelutin.vcs.ui.*", "JVCSPopup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JPopupMenuHandler.class))); + + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractSynchUI.class), JWindowHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractVCSPopup.class), JPopupMenuHandler.class); + + //TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(AbstractUI.class), JDialog.class); + + //TagManager.registerDefaultNamespace("AbstractUI", "javax.swing.*"); + + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java (from rev 398, trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java) =================================================================== --- trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java (rev 0) +++ trunk/lutinvcs/lutinvcs-ui-pre-jaxx/src/main/java/org/codelutin/vcs/ui/VCSUIConstants.java 2008-04-06 13:07:15 UTC (rev 400) @@ -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; + +import static org.codelutin.i18n.I18n.n_; + +/** @author chemit */ +public class VCSUIConstants { + + /** columns names for a simple table model with module, file and status */ + public static final String[] SIMPLE_COLUMNS_NAMES = new String[]{ + n_("lutinvcs.module"), + n_("lutinvcs.file"), + n_("lutinvcs.status") + }; + + /** model name for synchronize ui */ + public static final String SYNCH_MODEL_PROPERTY = "modelSynch"; + + /** model name for confirm ui */ + public static final String CONFIRM_MODEL_PROPERTY = "modelConfirm"; + + /** model name for diff ui */ + public static final String DIFF_MODEL_PROPERTY = "modelConfirm"; + + public static final String ACTION_PROPERTY_CHANGED = "action"; + + public static final String MESSAGE_HISTORY_PROPERTY_CHANGED = "historyMessage"; + + public static final String FILE_PROPERTY_CHANGED = "file"; + + public static final String NEXT_DIFF_PROPERTY_CHANGED = "nextDiff"; + + public static final String PREVIOUS_DIFF_PROPERTY_CHANGED = "previousDiff"; + + public static final String REFRESH_PROPERTY_CHANGED = "refresh"; + + public static final String TAB_PROPERTY_CHANGED = "tab"; + + public static final String DIFF_ALL_PROPERTY_CHANGED = "diffAll"; + + public static final String COMMIT_ALL_PROPERTY_CHANGED = "commitAll"; + + public static final String UPDATE_ALL_PROPERTY_CHANGED = "updateAll"; + + public static final String REVERT_ALL_PROPERTY_CHANGED = "revertAll"; + + public static final String DIFF_PROPERTY_CHANGED = "diff"; + + public static final String COMMIT_PROPERTY_CHANGED = "commit"; + + public static final String UPDATE_PROPERTY_CHANGED = "update"; + + public static final String REVERT_PROPERTY_CHANGED = "revert"; +}