Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r619 - trunk/lutinui/src/main/java/org/codelutin/ui
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:22:28 +0000 (Sun, 27 Apr 2008)
New Revision: 619
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/AbstractUIAction.java
Log:
ui does not have all the time a parent
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/AbstractUIAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/AbstractUIAction.java 2008-04-27 08:21:45 UTC (rev 618)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/AbstractUIAction.java 2008-04-27 08:22:28 UTC (rev 619)
@@ -41,9 +41,9 @@
}
protected void checkInit() throws IllegalStateException {
- if (ui == null) {
+ /*if (ui == null) {
throw new IllegalStateException("no handler, nor ui referenced in " + this);
- }
+ } */
}
}
1
0
r618 - trunk/lutinvcs/core/src/test/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:21:45 +0000 (Sun, 27 Apr 2008)
New Revision: 618
Modified:
trunk/lutinvcs/core/src/test/java/org/codelutin/vcs/RepositoryGenerator.java
Log:
using VCSEntry[] vs VCSENtries :)
Modified: trunk/lutinvcs/core/src/test/java/org/codelutin/vcs/RepositoryGenerator.java
===================================================================
--- trunk/lutinvcs/core/src/test/java/org/codelutin/vcs/RepositoryGenerator.java 2008-04-27 08:20:09 UTC (rev 617)
+++ trunk/lutinvcs/core/src/test/java/org/codelutin/vcs/RepositoryGenerator.java 2008-04-27 08:21:45 UTC (rev 618)
@@ -85,8 +85,8 @@
FileUtil.deleteRecursively(root);
}
- public void generateStates(VCSEntries entries) {
- for (VCSEntry entry : entries.getEntries()) {
+ public void generateStates(VCSEntry[] entries) {
+ for (VCSEntry entry : entries) {
VCSState state;
state = entry.getRelativeLocalPath().startsWith("local") ? generateState(LOCAL) : generateState(REMOTE);
entry.setState(state);
1
0
r617 - trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:20:09 +0000 (Sun, 27 Apr 2008)
New Revision: 617
Removed:
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java
Log:
only one test now : UITest
Deleted: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java 2008-04-25 23:43:03 UTC (rev 616)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java 2008-04-27 08:20:09 UTC (rev 617)
@@ -1,38 +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;
-
-import org.codelutin.vcs.ui.UIActionHelper;
-
-/** @author chemit */
-public class ConfigUITest {
-
- public static void main(String[] args) throws Exception {
-
- RepositoryGenerator generator = new RepositoryGenerator();
-
- VCSConnexion connexion = UITest.initMockVCS(generator, 0, 0, 0, 0);
-
- connexion.open();
-
- UITest.initUI(generator, connexion);
-
- UIActionHelper.showConfigUI(connexion.getConfig(), null);
-
- //ConfigUI ui = VCSUIFactory.getUI(VCSUIFactory.CONFIG_UI);
- //ui.getHandler().getModel().populate(connexion.getConfig(), true, "tony", "chemit", "chemit(a)codelutin.com");
- //ui.setVisible(true);
- }
-}
\ No newline at end of file
1
0
r616 - trunk/lutinvcs/ui/jaxx/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 23:43:03 +0000 (Fri, 25 Apr 2008)
New Revision: 616
Modified:
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
Log:
add generic show ui action
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-25 23:42:54 UTC (rev 615)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-25 23:43:03 UTC (rev 616)
@@ -1,7 +1,5 @@
-isisfish.server.ssh.generateKey.title=
lutinvcs.apply=
lutinvcs.cancel=
-lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Please fill a message for your commit
lutinvcs.config.anonymous=
lutinvcs.config.change.dir=Change dir
@@ -23,12 +21,6 @@
lutinvcs.config.server.ssh.privateKeyFile=
lutinvcs.config.server.ssh.publicKeyFile=
lutinvcs.config.ssh=
-lutinvcs.config.test.tip=
-lutinvcs.config.title=
-lutinvcs.confirm.title=Confirm UI
-lutinvcs.diff.title=Diff UI
lutinvcs.generateSshKey.message=Generate
-lutinvcs.generateSskKey.title=Generate ssh keys
lutinvcs.no.config=
lutinvcs.reset=
-lutinvcs.synch.title=Synch UI
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-25 23:42:54 UTC (rev 615)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-25 23:43:03 UTC (rev 616)
@@ -1,7 +1,5 @@
-isisfish.server.ssh.generateKey.title=GenerateKey UI
lutinvcs.apply=Appliquer
lutinvcs.cancel=Annuler
-lutinvcs.changelog.title=Changelog UI
lutinvcs.commit.message=Renseigner le message de publication
lutinvcs.config.anonymous=anonyme
lutinvcs.config.change.dir=Changer le r\u00E9pertoire contenant les clef ssh g\u00E9n\u00E9r\u00E9es
@@ -23,12 +21,6 @@
lutinvcs.config.server.ssh.privateKeyFile=clef priv\u00E9e
lutinvcs.config.server.ssh.publicKeyFile=clef publique
lutinvcs.config.ssh=ssh
-lutinvcs.config.test.tip=Tester la connexion
-lutinvcs.config.title=Config UI
-lutinvcs.confirm.title=Confirm UI
-lutinvcs.diff.title=Diff UI
lutinvcs.generateSshKey.message=G\u00E9n\u00E9rer
-lutinvcs.generateSskKey.title=G\u00E9n\u00E9rer la paire de clef ssh
lutinvcs.no.config=< Pas de configuration >
lutinvcs.reset=R\u00E9initialiser
-lutinvcs.synch.title=Synch UI
1
0
r615 - in trunk/lutinvcs/ui/common/src/main: java/org/codelutin/vcs/ui java/org/codelutin/vcs/ui/action java/org/codelutin/vcs/ui/handler java/org/codelutin/vcs/ui/model java/org/codelutin/vcs/ui/util java/org/codelutin/vcs/ui/util/handler java/org/codelutin/vcs/ui/util/ui resources/i18n
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 23:42:54 +0000 (Fri, 25 Apr 2008)
New Revision: 615
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/GenerateSshKeyUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
Log:
add generic show ui action
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -15,6 +15,7 @@
package org.codelutin.vcs.ui;
import static org.codelutin.i18n.I18n._;
+import org.codelutin.ui.FormElement;
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
@@ -30,11 +31,12 @@
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import java.io.File;
+import java.util.Arrays;
/** @author chemit */
public abstract class ConfigUI extends AbstractUI<ConfigUIHandler> {
- public enum Element {
+ public enum Element implements FormElement<ConfigUI> {
firstname,
lastname,
email,
@@ -44,15 +46,62 @@
password,
passphrase,
nopassphrase,
- privateKeyFile
+ privateKeyFile;
+
+ public Object getValue(ConfigUI ui) {
+ return ui.getElementValue(this);
+ }
+
+ public void setValue(ConfigUI ui, String value) {
+ //TODO
+ JComponent component = ui.getElement(this);
+ }
+
+ public JLabel getLabel(ConfigUI ui) {
+ return ui.getElementLabel(this);
+ }
}
- public abstract String getElementValue(Element element);
+ public abstract ButtonGroup getConnexionMode();
- public abstract JLabel getElementLabel(Element element);
+ public abstract AbstractButton getChangePrivateKeyFile();
- public abstract JComponent getElement(Element element);
+ public abstract AbstractButton getGenerateKey();
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancel();
+
+ public abstract AbstractButton getTestConnection();
+
+ public String getElementValue(Element element) {
+ JComponent o = getElement(element);
+ if (o instanceof JPasswordField) {
+ return Arrays.toString(((JPasswordField) o).getPassword());
+ }
+ if (o instanceof JTextField) {
+ return ((JTextField) o).getText();
+ }
+ if (o instanceof JRadioButton) {
+ return String.valueOf(((JRadioButton) o).isSelected());
+ }
+ if (o instanceof JCheckBox) {
+ return String.valueOf(((JCheckBox) o).isSelected());
+ }
+ return "";
+ }
+
+ public JLabel getElementLabel(Element element) {
+ return (JLabel) getObjectById(element.name() + "Label");
+ }
+
+ public JComponent getElement(Element element) {
+ return (JComponent) getObjectById(element.name());
+ }
+
+
public abstract JEditorPane getDoc();
public abstract JTextField getFirstname();
@@ -79,20 +128,6 @@
public abstract JTextField getPrivateKeyFile();
- public abstract ButtonGroup getConnexionMode();
-
- public abstract AbstractButton getChangePrivateKeyFile();
-
- public abstract AbstractButton getGenerateKey();
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
- public abstract AbstractButton getTestConnection();
-
public abstract JLabel getFirstnameLabel();
public abstract JLabel getLastnameLabel();
@@ -158,8 +193,4 @@
//TODO
}
- protected void testConnexion() {
- //TODO
- }
-
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/GenerateSshKeyUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/GenerateSshKeyUI.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/GenerateSshKeyUI.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -24,7 +24,9 @@
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
import javax.swing.JTextField;
+import java.util.Arrays;
/** @author chemit */
public abstract class GenerateSshKeyUI extends AbstractUI<GenerateSshKeyUIHandler> {
@@ -37,11 +39,30 @@
keyName
}
- public abstract String getElementValue(Element element);
+ public String getElementValue(Element element) {
+ JComponent o = getElement(element);
+ if (o instanceof JPasswordField) {
+ return Arrays.toString(((JPasswordField) o).getPassword());
+ }
+ if (o instanceof JTextField) {
+ return ((JTextField) o).getText();
+ }
+ if (o instanceof JRadioButton) {
+ return String.valueOf(((JRadioButton) o).isSelected());
+ }
+ if (o instanceof JCheckBox) {
+ return String.valueOf(((JCheckBox) o).isSelected());
+ }
+ return "";
+ }
- public abstract JLabel getElementLabel(Element element);
+ public JLabel getElementLabel(Element element) {
+ return (JLabel) getObjectById(element.name() + "Label");
+ }
- public abstract JComponent getElement(Element element);
+ public JComponent getElement(Element element) {
+ return (JComponent) getObjectById(element.name());
+ }
public abstract JTextField getLogin();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -24,6 +24,8 @@
/** @author chemit */
public abstract class SynchUI extends AbstractTabUI<SynchUIHandler> {
+ public abstract AbstractButton getConfig() ;
+
public abstract AbstractButton getRefreshAll();
public abstract AbstractButton getDiffAll();
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -0,0 +1,74 @@
+/**
+ * # #% 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.ui.DialogUI;
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.action.ShowChangelogUIAction;
+import org.codelutin.vcs.ui.action.ShowConfigAction;
+import org.codelutin.vcs.ui.action.ShowConfirmUIAction;
+import org.codelutin.vcs.ui.action.ShowDiffUIAction;
+import org.codelutin.vcs.ui.action.ShowSynchUIAction;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class UIActionHelper {
+
+ public static void showSynchUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSEntry[] entries) {
+ ShowSynchUIAction action = new ShowSynchUIAction(ui, false);
+ action.setConfig(config);
+ action.setLocation(location);
+ action.setEntries(entries);
+ action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
+ }
+
+ public static void showConfigUI(VCSConnexionConfig config, DialogUI<?> ui) {
+ ShowConfigAction action = new ShowConfigAction(ui, false);
+ action.setConfig(config);
+ action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
+ }
+
+ public static void showConfirmUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSAction vcsAction, VCSEntry[] entries) {
+ ShowConfirmUIAction action = new ShowConfirmUIAction(ui, false);
+ action.setAction(vcsAction);
+ action.setLocation(location);
+ action.setEntries(entries);
+ action.setConfig(config);
+ action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
+ }
+
+ public static void showDiffUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSEntry[] entries) {
+ ShowDiffUIAction action = new ShowDiffUIAction(ui, false);
+ action.setLocation(location);
+ action.setEntries(entries);
+ action.setConfig(config);
+ action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
+ }
+
+ public static void showChangelogUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSEntry[] entries) {
+ ShowChangelogUIAction action = new ShowChangelogUIAction(ui, false);
+ action.setLocation(location);
+ action.setEntries(entries);
+ action.setConfig(config);
+ action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
+ }
+
+ protected UIActionHelper() {
+ }
+}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSInitializer.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -22,8 +22,8 @@
public void initialize() {
registerBean(getClassDescriptor(javax.swing.JMenuItem.class), jaxx.tags.swing.JRadioButtonHandler.class);
- for (VCSUI vcsui : VCSUI.values()) {
- Class<?> uiClass = vcsui.getUiClass();
+ for (org.codelutin.ui.DialogUIDef def : VCSUIFactory.defs()) {
+ Class<?> uiClass = def.getUiClass();
registerBean(getClassDescriptor(uiClass), jaxx.tags.swing.JWindowHandler.class);
registerDefaultNamespace(uiClass.getSimpleName(), "org.codelutin.vcs.ui.*");
}
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -1,61 +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.util.handler.AbstractUIHandler;
-import org.codelutin.vcs.ui.util.model.AbstractUIModel;
-import org.codelutin.vcs.ui.util.ui.AbstractUI;
-
-/**
- * @author chemit
- * @see org.codelutin.vcs.ui.util.ui.AbstractUI
- * @see AbstractUIModel
- * @see org.codelutin.vcs.ui.util.handler.AbstractUIHandler
- */
-public enum VCSUI {
-
- synch(SynchUI.class, org.codelutin.vcs.ui.handler.SynchUIHandler.class),
- diff(DiffUI.class, org.codelutin.vcs.ui.handler.DiffUIHandler.class),
- changelog(ChangelogUI.class, org.codelutin.vcs.ui.handler.ChangelogUIHandler.class),
- confirm(ConfirmUI.class, org.codelutin.vcs.ui.handler.ConfirmUIHandler.class),
- config(ConfigUI.class, org.codelutin.vcs.ui.handler.ConfigUIHandler.class),
- generateSshKey(GenerateSshKeyUI.class, org.codelutin.vcs.ui.handler.GenerateSshKeyUIHandler.class);
-
- private final Class<? extends AbstractUI> uiClass;
- private final Class<? extends AbstractUIHandler> handlerClass;
-
- private VCSUI(Class<? extends AbstractUI> uiClass, Class<? extends AbstractUIHandler> handlerClass) {
- this.uiClass = uiClass;
- this.handlerClass = handlerClass;
- }
-
- public Class<? extends AbstractUIHandler> getHandlerClass() {
- return handlerClass;
- }
-
- public Class<? extends AbstractUI> getUiClass() {
- return uiClass;
- }
-
- public static VCSUI valueOf(Class<AbstractUI> uiClass) {
- for (VCSUI vcsui : values()) {
- if (vcsui.getUiClass() == uiClass) {
- return vcsui;
- }
- }
- throw new IllegalStateException("could not find a UI for " + uiClass + ", availables : " + java.util.Arrays.toString(values()));
- }
-
-}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -14,8 +14,10 @@
*/
package org.codelutin.vcs.ui;
+import static org.codelutin.i18n.I18n.n_;
import org.codelutin.ui.DialogUI;
import org.codelutin.ui.DialogUIDef;
+import static org.codelutin.ui.DialogUIDef.newDef;
import org.codelutin.ui.DialogUIHandler;
import org.codelutin.ui.DialogUIModel;
import org.codelutin.ui.FactoryWindowListener;
@@ -49,15 +51,21 @@
*/
public class VCSUIFactory extends UIFactory {
- public static final DialogUIDef<SynchUIModel, SynchUI, SynchUIHandler> SYNCH_UI = new DialogUIDef<SynchUIModel, SynchUI, SynchUIHandler>(SynchUIHandler.class, SynchUI.class, SynchUIModel.class);
- public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI = new DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler>(DiffUIHandler.class, DiffUI.class, DiffUIModel.class);
- public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI = new DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler>(ChangelogUIHandler.class, ChangelogUI.class, ChangelogUIModel.class);
- public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI = new DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler>(ConfirmUIHandler.class, ConfirmUI.class, ConfirmUIModel.class);
- public static final DialogUIDef<ConfigUIModel, ConfigUI, ConfigUIHandler> CONFIG_UI = new DialogUIDef<ConfigUIModel, ConfigUI, ConfigUIHandler>(ConfigUIHandler.class, ConfigUI.class, ConfigUIModel.class);
- public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI = new DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler>(GenerateSshKeyUIHandler.class, GenerateSshKeyUI.class, GenerateSshKeyUIModel.class);
+ public static final DialogUIDef<SynchUIModel, SynchUI, SynchUIHandler> SYNCH_UI;
+ public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
+ public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
+ public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
+ public static final DialogUIDef<ConfigUIModel, ConfigUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
+ public static DialogUIDef[] defs() {
+ return new DialogUIDef[]{SYNCH_UI,DIFF_UI,CHANGELOG_UI,CONFIG_UI,CONFIRM_UI,GENERATE_SHH_KEY_UI};
+ }
+
protected static VCSUIFactory instance;
+
protected VCSConnexionConfig config;
+
protected static FactoryWindowListener closeConnextionsListener;
public static void initFactory(VCSConnexionConfig config, FactoryWindowListener myWindowAdapter) {
@@ -71,18 +79,18 @@
return getInstance().getUI(uiType, getInstance().config);
}
- protected VCSUIFactory(String applicationName, VCSConnexionConfig config, FactoryWindowListener... listeners) {
- super(applicationName, new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONFIRM_UI, CONFIG_UI, GENERATE_SHH_KEY_UI}, listeners);
- this.config = config;
- }
-
- protected static VCSUIFactory getInstance() throws IllegalStateException {
+ public static VCSUIFactory getInstance() throws IllegalStateException {
if (instance == null) {
throw new IllegalStateException("factory " + VCSUIFactory.class + " was not init");
- }
+ }
return instance;
}
+ protected VCSUIFactory(String applicationName, VCSConnexionConfig config, FactoryWindowListener... listeners) {
+ super(applicationName, defs(), listeners);
+ this.config = config;
+ }
+
protected static FactoryWindowListener getCloseConnextionsListener() {
if (closeConnextionsListener == null) {
closeConnextionsListener = new FactoryWindowListener() {
@@ -100,4 +108,31 @@
}
return closeConnextionsListener;
}
+
+ static {
+ SYNCH_UI = newDef(SynchUIHandler.class, SynchUI.class, SynchUIModel.class,
+ n_("lutinvcs.action.show.synchui"),
+ n_("lutinvcs.action.show.synchui.tip"),
+ n_("lutinvcs.synchui.title"));
+ DIFF_UI = newDef(DiffUIHandler.class, DiffUI.class, DiffUIModel.class,
+ n_("lutinvcs.action.showui.diffui"),
+ n_("lutinvcs.action.showui.diffui.tip"),
+ n_("lutinvcs.diffui.title"));
+ CHANGELOG_UI = newDef(ChangelogUIHandler.class, ChangelogUI.class, ChangelogUIModel.class,
+ n_("lutinvcs.action.show.changelogui"),
+ n_("lutinvcs.action.show.changelogui.tip"),
+ n_("lutinvcs.changelogui.title"));
+ CONFIRM_UI = newDef(ConfirmUIHandler.class, ConfirmUI.class, ConfirmUIModel.class,
+ n_("lutinvcs.action.show.confirmui"),
+ n_("lutinvcs.action.show.confirmui.tip"),
+ n_("lutinvcs.confirmui.title"));
+ CONFIG_UI = newDef(ConfigUIHandler.class, ConfigUI.class, ConfigUIModel.class,
+ n_("lutinvcs.action.show.configui"),
+ n_("lutinvcs.action.show.configui.tip"),
+ n_("lutinvcs.configui.title"));
+ GENERATE_SHH_KEY_UI = newDef(GenerateSshKeyUIHandler.class, GenerateSshKeyUI.class, GenerateSshKeyUIModel.class,
+ n_("lutinvcs.action.show.generatesshkeyui"),
+ n_("lutinvcs.action.show.generatesshkeyui.tip"),
+ n_("lutinvcs.generatesshkeyui.title"));
+ }
}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -1,41 +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.util.ui.AbstractUI;
-
-/** @author chemit */
-public abstract class VCSUIProvider {
-
- private Class<?>[] klasses;
-
- protected String name;
-
- protected VCSUIProvider(String name, Class<?>... klasses) {
- this.name = name;
- this.klasses = klasses;
- }
-
- /** @return the identifier of the vcs ui provider (eg jaxx, swing, ...) */
- public String getName() {
- return name;
- }
-
- public AbstractUI newUI(VCSUI uiType) throws InstantiationException, IllegalAccessException {
- Class<?> uiImpl = klasses[uiType.ordinal()];
- return (AbstractUI) (uiImpl != null ? uiImpl.newInstance() : null);
- }
-
-}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java (from rev 608, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -0,0 +1,63 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.VCSConnexion;
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.VCSFactory;
+import org.codelutin.vcs.ui.ConfigUI;
+import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+
+import javax.swing.JOptionPane;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+
+/** @author chemit */
+public class TestConnexionAction extends org.codelutin.ui.AbstractUIAction<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
+
+
+ private static final long serialVersionUID = 1L;
+
+ public TestConnexionAction(org.codelutin.vcs.ui.ConfigUI ui) {
+ super(null, org.codelutin.ui.UIHelper.createActionIcon("test"), ui);
+ putValue(SHORT_DESCRIPTION, org.codelutin.i18n.I18n._("lutinvcs.config.test.tip"));
+ //putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ //putValue(MNEMONIC_KEY, (int) (action.getLibelle()).charAt(0));
+ }
+
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ checkInit();
+ ConfigUIHandler uiHandler = getHandler();
+ VCSConnexionConfig config = uiHandler.getConfig();
+ VCSConnexion connexion = VCSFactory.newConnexion(config);
+ ConfigUI ui = uiHandler.getUi();
+ boolean result = false;
+ try {
+ connexion.testConnection();
+ //TODO should notify ConfigModel, connexion is safe, need a testConnexion state (reset as soon as model modified)
+ JOptionPane.showMessageDialog(ui, _("lutinvcs.success.test"), _("lutinvcs.test.result"), INFORMATION_MESSAGE);
+ result = true;
+ } catch (VCSException e1) {
+ String message = _("lutinvcs.error.test", e1.getMessage());
+ log.warn(message);
+ JOptionPane.showMessageDialog(ui, message, _("lutinvcs.test.result"), ERROR_MESSAGE);
+ } finally {
+ uiHandler.getModel().setConnexionState(result);
+ }
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -39,8 +39,8 @@
protected List<Element> errors;
- public ConfigUIHandler(ConfigUI ui,VCSConnexionConfig config) {
- super(ui, new ConfigUIModel(),config);
+ public ConfigUIHandler(ConfigUI ui, VCSConnexionConfig config) {
+ super(ui, new ConfigUIModel(), config);
ui.setHandler(this);
errors = new ArrayList<Element>();
}
@@ -75,9 +75,19 @@
if (ConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
- getUi().getReset().setEnabled(newValue != null && newValue);
+ boolean modified = newValue != null && newValue;
+ getUi().getReset().setEnabled(modified);
+ getUi().getTestConnection().setEnabled(modified && isConfigValid());
return;
}
+
+ if (ConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean validConnexion = newValue != null && newValue;
+ getUi().getOk().setEnabled(validConnexion);
+ getUi().getTestConnection().setEnabled(!validConnexion);
+ return;
+ }
throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
}
@@ -176,8 +186,12 @@
}
if (modify) {
model.addModified(element);
+ // reset connexion state
+ model.setConnexionState(null);
} else if (model.getModifieds().contains(element)) {
model.removeModified(element);
+ // reset connexion state
+ model.setConnexionState(null);
}
}
@@ -187,7 +201,7 @@
}
public boolean isConfigValid() {
- return errors.isEmpty();
+ return errors.isEmpty() && getModel().isConnexionState();
}
public void reset() {
@@ -218,6 +232,7 @@
getUi().getLastname().setText(model.getLasttname());
getUi().getEmail().setText(model.getEmail());
}
+ ui.getTestConnection().setEnabled(true);
}
protected void updateUI(final VCSConnexionMode mode) {
@@ -252,7 +267,7 @@
ConfigUI ui = getUi();
boolean valid = isConfigValid();
ui.getOk().setEnabled(valid && getModel().isModified());
- ui.getTestConnection().setEnabled(valid);
+ //ui.getTestConnection().setEnabled(valid);
ui.getGenerateKey().setEnabled(getModel().getMode() == VCSConnexionMode.SSH && !errors.contains(sshLogin) && !errors.contains(passphrase));
for (Element element : values()) {
setLabelColor(errors, element);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -39,6 +39,8 @@
public static final String CONFIG_PROPERTY_CHANGED = "config";
+ public static final String CONNEXION_STATE_PROPERTY_CHANGED = "connexionState";
+
public static final String MODE_PROPERTY_CHANGED = "mode";
public static final String IDENTITY_PROPERTY_CHANGED = "identity";
@@ -55,6 +57,8 @@
protected List<Element> modifieds;
protected VCSConnexionConfig config;
+ protected Boolean connexionState;
+
public ConfigUIModel() {
modifieds = new ArrayList<Element>();
}
@@ -101,6 +105,7 @@
addModified(connexion);
}
firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
+ setConnexionState(null);
}
public String getEmail() {
@@ -127,6 +132,10 @@
return modifieds;
}
+ public Boolean isConnexionState() {
+ return connexionState != null && connexionState;
+ }
+
public VCSConnexionConfig getConfig() throws IllegalStateException {
checkConnexionInit();
return config;
@@ -140,8 +149,7 @@
public void addModified(Element elementname) {
if (!modifieds.contains(elementname)) {
modifieds.add(elementname);
-
- }
+ }
setModified(!modifieds.isEmpty());
}
@@ -207,4 +215,10 @@
throw new IllegalStateException("no config found in model " + this);
}
}
+
+ public void setConnexionState(Boolean connexionState) {
+ Boolean oldConnexionState = this.connexionState;
+ this.connexionState = connexionState;
+ firePropertyChange(CONNEXION_STATE_PROPERTY_CHANGED, oldConnexionState, connexionState);
+ }
}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java (from rev 608, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -0,0 +1,57 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.util;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIDef;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.DialogUIModel;
+import org.codelutin.ui.ShowUIAction;
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.ui.VCSUIFactory;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public abstract class AbstractShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>, HH extends DialogUIHandler<?, ?>> extends ShowUIAction<M, U, H, HH> {
+
+ protected transient VCSConnexionConfig config;
+
+ private static final long serialVersionUID = 1L;
+
+ public <UU extends DialogUI<HH>> AbstractShowUIAction(UU ui, DialogUIDef<M, U, H> uiDef, boolean showText) {
+ super(ui, uiDef, VCSUIFactory.getInstance(), showText);
+ }
+
+ public VCSConnexionConfig getConfig() {
+ return config;
+ }
+
+ public void setConfig(VCSConnexionConfig config) {
+ this.config = config;
+ }
+
+ protected U initUI(ActionEvent e) {
+ return getFactory().getUI(uiDef, config);
+ }
+
+ @Override
+ protected void checkInit() throws IllegalStateException {
+ super.checkInit();
+ if (config == null) {
+ throw new IllegalStateException("no config found in " + this);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -18,10 +18,6 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSAction;
-import org.codelutin.vcs.ui.ChangelogUI;
-import org.codelutin.vcs.ui.ConfirmUI;
-import org.codelutin.vcs.ui.DiffUI;
-import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import org.codelutin.vcs.ui.util.model.AbstractTabUIModel;
import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
@@ -62,45 +58,6 @@
ui.setEnabled(hasActions && actions.containsKey(action) && actions.get(action) > 0);
}
- public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- ConfirmUI ui = VCSUIFactory.getUI(VCSUIFactory.CONFIRM_UI);
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
- public void showDiffUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- DiffUI ui = VCSUIFactory.getUI(VCSUIFactory.DIFF_UI);
- if (!useSelection) {
- // take all entries
- entries = model.filter(VCSAction.DIFF, model.getEntries());
- }
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getButton(model.getLocation()).setSelected(false);
- ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
- public void showChangelogUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- ChangelogUI ui = VCSUIFactory.getUI(VCSUIFactory.CHANGELOG_UI);
- if (!useSelection) {
- // take all entries
- entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
- }
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) {
log.info(selectionModel);
selectionModel.clearSelection();
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java (from rev 601, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java 2008-04-25 23:42:54 UTC (rev 615)
@@ -0,0 +1,30 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.ui;
+
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
+/**
+ * The base dialog to be used in vcs project
+ *
+ * @author chemit
+ */
+public abstract class AbstractFormUI<H extends AbstractUIHandler> extends org.codelutin.ui.DialogUI<H> {
+
+ /*protected javax.swing.AbstractAction createHelpAction() {
+ return org.codelutin.vcs.ui.action.HelpAction.createAction(this);
+ }*/
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-25 23:42:54 UTC (rev 615)
@@ -13,13 +13,33 @@
lutinvcs.action.nextfile.tip=select newt file
lutinvcs.action.previousdiff.tip=goto previous diff
lutinvcs.action.previousfile.tip=select previous file
-lutinvcs.action.showconfig.libelle=
-lutinvcs.action.showconfig.tip=
+lutinvcs.action.show.changelogui=
+lutinvcs.action.show.changelogui.tip=
+lutinvcs.action.show.configui=
+lutinvcs.action.show.configui.tip=
+lutinvcs.action.show.confirmui=
+lutinvcs.action.show.confirmui.tip=
+lutinvcs.action.show.generatesshkeyui=
+lutinvcs.action.show.generatesshkeyui.tip=
+lutinvcs.action.show.synchui=
+lutinvcs.action.show.synchui.tip=
lutinvcs.action.showmessages.tip=show previous commit messages
+lutinvcs.action.showui.diffui=
+lutinvcs.action.showui.diffui.tip=
lutinvcs.action.single.tip=Launch action ''{0}'' on selected file ''{1}''
+lutinvcs.changelogui.title=
lutinvcs.config.accept=Accept
lutinvcs.config.find.public.key=Public ssh key (*.pub) associated with the required private key
lutinvcs.config.find.ssh.dir=Change container dir of shh keys
+lutinvcs.config.test.tip=Test connexion
+lutinvcs.configui.title=
+lutinvcs.confirmui.title=
+lutinvcs.diffui.title=
+lutinvcs.error.test=Connexion failed fro reason {0}
lutinvcs.file=File
+lutinvcs.generatesshkeyui.title=
lutinvcs.module=Module
lutinvcs.status=Status
+lutinvcs.success.test=Connexion was successfull established
+lutinvcs.synchui.title=
+lutinvcs.test.result=Connexion Result UI
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-25 23:42:47 UTC (rev 614)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-25 23:42:54 UTC (rev 615)
@@ -13,13 +13,33 @@
lutinvcs.action.nextfile.tip=S\u00E9lectionner le prochain fichier
lutinvcs.action.previousdiff.tip=voir la diff\u00E9rence pr\u00E9c\u00E9dente
lutinvcs.action.previousfile.tip=S\u00E9lectionner le pr\u00E9c\u00E9dent fichier
-lutinvcs.action.showconfig.libelle=Modifier la configuration
-lutinvcs.action.showconfig.tip=Modifier la configuration vcs
+lutinvcs.action.show.changelogui=Voir le journal des changements
+lutinvcs.action.show.changelogui.tip=Cliquer ici pour ouvrir le journal des changements
+lutinvcs.action.show.configui=Configuration
+lutinvcs.action.show.configui.tip=Modifier la configuration vcs
+lutinvcs.action.show.confirmui=Confirmer
+lutinvcs.action.show.confirmui.tip=Cliquer ic pour ouvrir la fen\u00EAtre de confirmation
+lutinvcs.action.show.generatesshkeyui=G\u00E9n\u00E9rer la clef
+lutinvcs.action.show.generatesshkeyui.tip=G\u00E9n\u00E9rer la paire de clefs ssh
+lutinvcs.action.show.synchui=Synchroniser
+lutinvcs.action.show.synchui.tip=Voir la fen\u00EAtre de synchronisation
lutinvcs.action.showmessages.tip=voir les messages de publication pr\u00E9c\u00E9dents
+lutinvcs.action.showui.diffui=Voir les diff\u00E9rences
+lutinvcs.action.showui.diffui.tip=Voir les diff\u00E9rences
lutinvcs.action.single.tip=ex\u00E9cuter l''action ''{0}'' sur le fichier s\u00E9l\u00E9ctionn\u00E9 ''{1}''
+lutinvcs.changelogui.title=Voir le journal des changements
lutinvcs.config.accept=Accepter
lutinvcs.config.find.public.key=Clef publique ssh (*.pub) associ\u00E9e \u00E0 la clef priv\u00E9e
lutinvcs.config.find.ssh.dir=Changer le r\u00E9pertoire contenant la paire de clef ssh g\u00E9n\u00E9r\u00E9
+lutinvcs.config.test.tip=Tester la connexion
+lutinvcs.configui.title=Config UI
+lutinvcs.confirmui.title=Confirm UI
+lutinvcs.diffui.title=Diff UI
+lutinvcs.error.test=La connexion n''a pas pu \u00EAtre \u00E9tablie pour la raison suivante \: {0}
lutinvcs.file=Fichier
+lutinvcs.generatesshkeyui.title=GenerateSshKey UI
lutinvcs.module=Module
lutinvcs.status=Status
+lutinvcs.success.test=Connexion \u00E9tablie avec succ\u00E8s
+lutinvcs.synchui.title=Synch UI
+lutinvcs.test.result=Config Result UI
1
0
r614 - trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 23:42:47 +0000 (Fri, 25 Apr 2008)
New Revision: 614
Modified:
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
Log:
add generic show ui action
Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java 2008-04-25 23:39:52 UTC (rev 613)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/ConfigUITest.java 2008-04-25 23:42:47 UTC (rev 614)
@@ -14,8 +14,7 @@
*/
package org.codelutin.vcs;
-import org.codelutin.vcs.ui.ConfigUI;
-import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.UIActionHelper;
/** @author chemit */
public class ConfigUITest {
@@ -26,12 +25,14 @@
VCSConnexion connexion = UITest.initMockVCS(generator, 0, 0, 0, 0);
- ConfigUI ui = UITest.initUI(generator, connexion, VCSUIFactory.CONFIG_UI);
-
connexion.open();
- ui.getHandler().getModel().populate(connexion.getConfig(), true, "tony", "chemit", "chemit(a)codelutin.com");
+ UITest.initUI(generator, connexion);
- ui.setVisible(true);
+ UIActionHelper.showConfigUI(connexion.getConfig(), null);
+
+ //ConfigUI ui = VCSUIFactory.getUI(VCSUIFactory.CONFIG_UI);
+ //ui.getHandler().getModel().populate(connexion.getConfig(), true, "tony", "chemit", "chemit(a)codelutin.com");
+ //ui.setVisible(true);
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-25 23:39:52 UTC (rev 613)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-25 23:42:47 UTC (rev 614)
@@ -16,16 +16,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.ui.DialogUI;
-import org.codelutin.ui.DialogUIDef;
-import org.codelutin.ui.DialogUIHandler;
-import org.codelutin.ui.DialogUIModel;
-import org.codelutin.vcs.ui.SynchUI;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.UIActionHelper;
import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.model.SynchUIModel;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
+import java.util.List;
/** @author chemit */
public class UITest {
@@ -39,15 +38,23 @@
VCSConnexion connexion = initMockVCS(generator, 10, 5, 10, 1024);
- connexion.open();
+ VCSEntry[] entries = initModel(generator, connexion);
- SynchUI ui = initUI(generator, connexion, VCSUIFactory.SYNCH_UI);
+ initUI(generator, connexion);
- ui.getHandler().getModel().populate(connexion);
+ UIActionHelper.showSynchUI(connexion.getConfig(), null, VCSEntryLocation.ALL, entries);
- generator.generateStates(ui.getHandler().getModel().getEntriesModel());
+ }
- ui.setVisible(true);
+ protected static VCSEntry[] initModel(RepositoryGenerator generator, VCSConnexion connexion) throws VCSException {
+
+ connexion.open();
+
+ SynchUIModel model = new SynchUIModel();
+ model.populate(connexion);
+ generator.generateStates(model.getEntriesModel());
+ List<VCSEntry> entries = model.getEntriesModel().getEntries();
+ return entries.toArray(new VCSEntry[entries.size()]);
}
public static VCSConnexion initMockVCS(final RepositoryGenerator generator, int i, int i1, int i2, int i3) throws IOException {
@@ -66,8 +73,7 @@
return VCSFactory.newConnexion(config);
}
- protected static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U initUI(
- final RepositoryGenerator generator, final VCSConnexion connexion, DialogUIDef<M, U, H> configUi) {
+ protected static void initUI(final RepositoryGenerator generator, final VCSConnexion connexion) {
VCSUIFactory.initFactory(connexion.getConfig(), new org.codelutin.ui.FactoryWindowListener() {
public void allWindowsClosed(WindowEvent e) {
@@ -78,7 +84,5 @@
}
});
-
- return VCSUIFactory.getUI(configUi);
}
}
\ No newline at end of file
1
0
r613 - in trunk/lutinvcs/ui: common/src/main/java/org/codelutin/vcs/ui/action jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 23:39:52 +0000 (Fri, 25 Apr 2008)
New Revision: 613
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
add generic show ui action
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -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.action;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.ChangelogUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.ChangelogUIHandler;
+import org.codelutin.vcs.ui.model.ChangelogUIModel;
+import org.codelutin.vcs.ui.util.AbstractShowUIAction;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowChangelogUIAction extends AbstractShowUIAction<ChangelogUIModel, ChangelogUI, ChangelogUIHandler, DialogUIHandler<?, ?>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private VCSEntryLocation location;
+ private VCSEntry[] entries;
+
+ public ShowChangelogUIAction(DialogUI ui, boolean showText) {
+ super(ui, VCSUIFactory.CHANGELOG_UI, showText);
+ }
+
+ public void setLocation(VCSEntryLocation location) {
+ this.location = location;
+ }
+
+ public void setEntries(VCSEntry[] entries) {
+ this.entries = entries;
+ }
+
+ @Override
+ protected ChangelogUI initUI(ActionEvent e) {
+ ChangelogUI ui = super.initUI(e);
+ ui.getHandler().getModel().init(getLocation(), entries);
+ ui.getContentScroll().setEnabled(entries.length > 1);
+ return ui;
+ }
+
+ protected VCSEntryLocation getLocation() {
+ if (location == null) {
+ location = VCSEntryLocation.ALL;
+ }
+ return location;
+ }
+
+ protected VCSEntry[] getEntries() {
+ return entries;
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -14,34 +14,29 @@
*/
package org.codelutin.vcs.ui.action;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.ui.AbstractUIAction;
+import org.codelutin.ui.DialogUIHandler;
import org.codelutin.vcs.ui.ConfigUI;
-import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
-import org.codelutin.vcs.ui.util.ui.AbstractUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.util.AbstractShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractUIAction<AbstractUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractShowUIAction<ConfigUIModel, ConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
- public ShowConfigAction(AbstractUI<? extends AbstractUIHandler<?, ?>> ui) {
- super(_("lutinvcs.action.showconfig.libelle"), org.codelutin.ui.UIHelper.createActionIcon("showconfig"), ui);
- String name = (String) getValue(NAME);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
- putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
- putValue(NAME, null);
- putValue(SHORT_DESCRIPTION, _("lutinvcs.action.showconfig.tip"));
+ public ShowConfigAction(org.codelutin.ui.DialogUI ui, boolean showText) {
+ super(ui, VCSUIFactory.CONFIG_UI, showText);
}
- public void actionPerformed(ActionEvent e) {
- checkInit();
- ConfigUI ui = org.codelutin.vcs.ui.VCSUIFactory.getUI(org.codelutin.vcs.ui.VCSUIFactory.CONFIG_UI);
- // populate with common config
- ui.getHandler().getModel().populate(ui.getHandler().getConfig());
- ui.setVisible(true);
+ @Override
+ protected ConfigUI initUI(ActionEvent e) {
+ ConfigUI ui = super.initUI(e);
+ ui.getHandler().getModel().populate(getConfig());
+ return ui;
}
}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java (from rev 608, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -0,0 +1,85 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.ConfirmUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
+import org.codelutin.vcs.ui.model.ConfirmUIModel;
+import org.codelutin.vcs.ui.util.AbstractShowUIAction;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowConfirmUIAction extends AbstractShowUIAction<ConfirmUIModel, ConfirmUI, ConfirmUIHandler, DialogUIHandler<?, ?>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private VCSAction action;
+ private VCSEntryLocation location;
+ private VCSEntry[] entries;
+
+ public ShowConfirmUIAction(DialogUI ui, boolean showText) {
+ super(ui, VCSUIFactory.CONFIRM_UI, showText);
+ }
+
+ public VCSAction getAction() {
+ return action;
+ }
+
+ public void setAction(VCSAction action) {
+ this.action = action;
+ }
+
+ public VCSEntryLocation getLocation() {
+ if (location == null) {
+ location = VCSEntryLocation.ALL;
+ }
+ return location;
+ }
+
+ public void setLocation(VCSEntryLocation location) {
+ this.location = location;
+ }
+
+ public VCSEntry[] getEntries() {
+ return entries;
+ }
+
+ public void setEntries(VCSEntry[] entries) {
+ this.entries = entries;
+ }
+
+ @Override
+ protected ConfirmUI initUI(ActionEvent e) {
+ ConfirmUI ui = super.initUI(e);
+ ui.getHandler().getModel().init(action, getLocation(), entries);
+ ui.getContentScroll().setEnabled(entries.length > 1);
+ return ui;
+ }
+
+ @Override
+ protected void checkInit() throws IllegalStateException {
+ super.checkInit();
+ if (action == null) {
+ throw new IllegalStateException("no action found in " + this);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -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.action;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.DiffUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.DiffUIHandler;
+import org.codelutin.vcs.ui.model.DiffUIModel;
+import org.codelutin.vcs.ui.util.AbstractShowUIAction;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowDiffUIAction extends AbstractShowUIAction<DiffUIModel, DiffUI, DiffUIHandler, DialogUIHandler<?, ?>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private VCSEntryLocation location;
+ private VCSEntry[] entries;
+
+ public ShowDiffUIAction(DialogUI ui, boolean showText) {
+ super(ui, VCSUIFactory.DIFF_UI, showText);
+ }
+
+ public VCSEntryLocation getLocation() {
+ if (location == null) {
+ location = VCSEntryLocation.ALL;
+ }
+ return location;
+ }
+
+ public void setLocation(VCSEntryLocation location) {
+ this.location = location;
+ }
+
+ public VCSEntry[] getEntries() {
+ return entries;
+ }
+
+ public void setEntries(VCSEntry[] entries) {
+ this.entries = entries;
+ }
+
+ @Override
+ protected DiffUI initUI(ActionEvent e) {
+ DiffUI ui = super.initUI(e);
+ ui.getHandler().getModel().init(getLocation(), entries);
+ ui.getContentScroll().setEnabled(entries.length > 1);
+ return ui;
+ }
+}
\ No newline at end of file
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -0,0 +1,68 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.SynchUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.SynchUIHandler;
+import org.codelutin.vcs.ui.model.SynchUIModel;
+import org.codelutin.vcs.ui.util.AbstractShowUIAction;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowSynchUIAction extends AbstractShowUIAction<SynchUIModel, SynchUI, SynchUIHandler, DialogUIHandler<?,?>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private VCSEntryLocation location;
+ private VCSEntry[] entries;
+
+ public ShowSynchUIAction(DialogUI ui, boolean showText) {
+ super(ui, VCSUIFactory.SYNCH_UI, showText);
+ }
+
+ public VCSEntryLocation getLocation() {
+ if (location == null) {
+ location = VCSEntryLocation.ALL;
+ }
+ return location;
+ }
+
+ public void setLocation(VCSEntryLocation location) {
+ this.location = location;
+ }
+
+ public VCSEntry[] getEntries() {
+ return entries;
+ }
+
+ public void setEntries(VCSEntry[] entries) {
+ this.entries = entries;
+ }
+
+ @Override
+ protected SynchUI initUI(ActionEvent e) {
+ SynchUI ui = super.initUI(e);
+ ui.getHandler().getModel().populate(getLocation(), entries);
+ ui.getContentScroll().setEnabled(entries.length > 1);
+ ((AbstractShowUIAction) ui.getConfig().getAction()).setConfig(ui.getHandler().getConfig());
+ return ui;
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-25 23:39:52 UTC (rev 613)
@@ -15,8 +15,11 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.ui.AbstractUIAction;
+import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.UIActionHelper;
import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
@@ -31,6 +34,7 @@
private static final long serialVersionUID = 1L;
+
public TabUIAction(AbstractTabUI<?> ui, VCSAction action, boolean useSelection) {
super(null, org.codelutin.vcs.ui.util.UIHelper.createActionIcon(action), ui);
this.useSelection = useSelection;
@@ -48,12 +52,22 @@
AbstractTabUIHandler<?, ?> handler = getHandler();
org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel model = handler.getModel().getEntriesModel();
List<VCSEntry> entries = model.filter(action, model.getDisplayedEntries(useSelection ? handler.getSelectionModel() : null));
+ VCSConnexionConfig config = getHandler().getConfig();
+ VCSEntryLocation location = model.getLocation();
switch (action) {
case CHANGELOG:
- handler.showChangelogUI(useSelection, model, entries);
+ if (!useSelection) {
+ // take all entries
+ entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
+ }
+ UIActionHelper.showChangelogUI(config, ui, location, entries.toArray(new VCSEntry[entries.size()]));
return;
case DIFF:
- handler.showDiffUI(useSelection, model, entries);
+ if (!useSelection) {
+ // take all entries
+ entries = model.filter(VCSAction.DIFF, model.getEntries());
+ }
+ UIActionHelper.showDiffUI(config, ui, location, entries.toArray(new VCSEntry[entries.size()]));
return;
case REFRESH:
handler.doRefresh(model, entries, handler.getSelectionModel());
@@ -65,7 +79,7 @@
case DELETE:
case REVERT:
case UPDATE:
- handler.showConfirmUI(action, model, entries);
+ UIActionHelper.showConfirmUI(config, ui, location, action, entries.toArray(new VCSEntry[entries.size()]));
return;
}
throw new IllegalStateException("could not perform action for action " + action + " (" + this + ')');
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,4 +1,4 @@
-<JDialog title='isisfish.server.ssh.generateKey.title' modal='true'>
+<JDialog modal='true'>
<script>
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxChangelogUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,4 +1,4 @@
-<ChangelogUI title='lutinvcs.changelog.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='400' width='500'>
+<ChangelogUI modal="true" height='400' width='500'>
<style source="common.css"/>
<script>
import static org.codelutin.vcs.type.VCSAction.*;
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,35 +1,9 @@
-<ConfigUI title='lutinvcs.config.title' modal='true'>
- <!--ConfigUI title='lutinvcs.config.title' resizable='false'-->
+<ConfigUI modal='true' resizable='false'>
<style source="config.css"/>
<script>
import static org.codelutin.vcs.type.VCSConnexionMode.*;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.action.*;
-
- public String getElementValue(Element element) {
- JComponent o = getElement(element);
- if (o instanceof JPasswordField) {
- return Arrays.toString(((JPasswordField) o).getPassword());
- }
- if (o instanceof JTextField) {
- return ((JTextField) o).getText();
- }
- if (o instanceof JRadioButton) {
- return String.valueOf(((JRadioButton) o).isSelected());
- }
- if (o instanceof JCheckBox) {
- return String.valueOf(((JCheckBox) o).isSelected());
- }
- return "";
- }
-
- public JLabel getElementLabel(Element element) {
- return (JLabel) $objectMap.get(element.name() + "Label");
- }
-
- public JComponent getElement(Element element) {
- return (JComponent) $objectMap.get(element.name());
- }
</script>
<java.awt.CardLayout id='connexionPanelLayout'>
@@ -117,19 +91,16 @@
<JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
borderPainted='false'/>
<JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/>
- <JButton id='testConnection' onActionPerformed="testConnexion()" icon='{createActionIcon("test")}'
- borderPainted='false'/>
+ <JButton id='testConnection' action='{newAction(TestConnexionAction.class)}' borderPainted='false'/>
</JToolBar>
-
- <!--JToolBar id='identityHead' opaque='false' onMouseClicked="identityContent.setVisible(!identityContent.isVisible());if (!identityContent.isVisible()) identityScroll.setSize(0,0);pack();identityScroll.invalidate();"-->
+
<JToolBar id='identityHead' opaque='false'>
<JLabel id='identityLabel'/>
</JToolBar>
<Table fill='both' insets="1,1,1,1">
<row fill='horizontal'>
<cell columns='2'>
- <JScrollPane columnHeaderView='{top}'>
- <!--JScrollPane height="60" columnHeaderView='{top}' width="420"-->
+ <JScrollPane columnHeaderView='{top}'>
<JEditorPane id="doc"/>
</JScrollPane>
</cell>
@@ -168,8 +139,7 @@
</row>
<row fill='horizontal'>
<cell columns="2" fill='both'>
- <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
- <!--JScrollPane columnHeaderView='{connexionHead}' height="120" width="420" styleClass='connexionScroll'-->
+ <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
<JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
</JScrollPane>
</cell>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfirmUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,5 +1,4 @@
-<ConfirmUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true'
- resizable='false' height='300' width='400'>
+<ConfirmUI modal='true' resizable='false' height='300' width='400'>
<style source="common.css"/>
<script>import org.codelutin.vcs.ui.action.*;</script>
<JPopupMenu id="popup">
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxDiffUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,4 +1,4 @@
-<DiffUI title='lutinvcs.diff.title' modal="true" defaultCloseOperation='DISPOSE_ON_CLOSE' height='600' width='500'>
+<DiffUI modal="true" height='600' width='500'>
<style source="common.css"/>
<script>
import static org.codelutin.vcs.type.VCSAction.*;
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,34 +1,9 @@
-<GenerateSshKeyUI title='lutinvcs.generateSskKey.title'>
+<GenerateSshKeyUI modal="true">
<!--ConfigUI title='lutinvcs.config.title' resizable='false'-->
<style source="config.css"/>
<script>
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.action.*;
-
- public String getElementValue(Element element) {
- JComponent o = getElement(element);
- if (o instanceof JPasswordField) {
- return Arrays.toString(((JPasswordField) o).getPassword());
- }
- if (o instanceof JTextField) {
- return ((JTextField) o).getText();
- }
- if (o instanceof JRadioButton) {
- return String.valueOf(((JRadioButton) o).isSelected());
- }
- if (o instanceof JCheckBox) {
- return String.valueOf(((JCheckBox) o).isSelected());
- }
- return "";
- }
-
- public JLabel getElementLabel(Element element) {
- return (JLabel) $objectMap.get(element.name() + "Label");
- }
-
- public JComponent getElement(Element element) {
- return (JComponent) $objectMap.get(element.name());
- }
</script>
<JToolBar id='top'>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-25 23:39:52 UTC (rev 613)
@@ -1,4 +1,4 @@
-<SynchUI title='lutinvcs.synch.title' defaultCloseOperation='DISPOSE_ON_CLOSE'>
+<SynchUI>
<style source="common.css"/>
<script>
import static org.codelutin.vcs.type.VCSAction.*;
@@ -37,7 +37,7 @@
<JButton id='addAll' action='{newAction(TabUIAction.class,ADD,false)}'/>
<JButton id='deleteAll' action='{newAction(TabUIAction.class,DELETE,false)}'/>
<JSeparator orientation="vertical"/>
- <JButton id='config' action='{newAction(ShowConfigAction.class)}'/>
+ <JButton id='config' action='{newAction(ShowConfigAction.class,false)}'/>
<JButton id='help' action='{newAction(HelpAction.class)}'/>
</JToolBar>
</cell>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-25 23:38:14 UTC (rev 612)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-25 23:39:52 UTC (rev 613)
@@ -97,11 +97,6 @@
toolTipText: "lutinvcs.config.server.ssh.key.generate";
}
-#testConnection {
- /*text: "lutinvcs.config.test";*/
- toolTipText: "lutinvcs.config.test.tip";
-}
-
#ok {
text: "lutinvcs.apply";
}
1
0
r612 - trunk/lutinvcs/ui/jaxx/src/main/resources/icons
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 23:38:14 +0000 (Fri, 25 Apr 2008)
New Revision: 612
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-changelogui.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-configui.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-confirmui.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-diffui.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-synchui.png
Log:
add generic show ui action
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-changelogui.png (from rev 609, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-changelog.png)
===================================================================
(Binary files differ)
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-configui.png (from rev 605, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-showconfig.png)
===================================================================
(Binary files differ)
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-confirmui.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-confirmui.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-diffui.png (from rev 609, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-diff.png)
===================================================================
(Binary files differ)
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-synchui.png (from rev 609, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/versioning-view.png)
===================================================================
(Binary files differ)
1
0
r611 - trunk/lutinui/src/main/java/org/codelutin/ui
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 22:12:42 +0000 (Fri, 25 Apr 2008)
New Revision: 611
Added:
trunk/lutinui/src/main/java/org/codelutin/ui/ShowUIAction.java
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/DialogUIDef.java
trunk/lutinui/src/main/java/org/codelutin/ui/UIFactory.java
Log:
add generic show ui action
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/DialogUIDef.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogUIDef.java 2008-04-25 22:11:57 UTC (rev 610)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogUIDef.java 2008-04-25 22:12:42 UTC (rev 611)
@@ -14,6 +14,10 @@
*/
package org.codelutin.ui;
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.ImageIcon;
+
/**
* Definition of an ui, with his model, handler and ui class definitions.
* <p/>
@@ -23,6 +27,12 @@
*/
public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
+ public static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> DialogUIDef<M, U, H> newDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass, String showActionLibelle, String showActionTip, String uiTitle) {
+ DialogUIDef<M, U, H> result;
+ result = new DialogUIDef<M, U, H>(handlerClass, uiClass, modelClass, showActionLibelle, showActionTip, uiTitle);
+ return result;
+ }
+
/** model class */
private final Class<M> modelClass;
@@ -38,12 +48,28 @@
/** shared instance of ui */
protected U uiInstance;
+ /** unique name of ui def */
+ protected final String name;
+
+ protected final String uiTitle;
+ protected final String showActionLibelle;
+
+ protected final String showActionTip;
+
+ protected ImageIcon showUIActionIcon;
+
+
private static final long serialVersionUID = 1L;
- public DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass) {
+ private DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass,
+ String showActionLibelle, String showActionTip, String uiTitle) {
this.handlerClass = handlerClass;
this.uiClass = uiClass;
this.modelClass = modelClass;
+ this.showActionLibelle = showActionLibelle;
+ this.name = uiClass.getSimpleName().toLowerCase();
+ this.showActionTip = showActionTip;
+ this.uiTitle = uiTitle;
}
public Class<U> getUiClass() {
@@ -62,6 +88,25 @@
return uiImplClass;
}
+ public String getUiTitle() {
+ return _(uiTitle);
+ }
+
+ public String getShowActionLibelle() {
+ return _(showActionLibelle);
+ }
+
+ public String getShowActionTip() {
+ return _(showActionTip);
+ }
+
+ public ImageIcon getShowUIActionIcon() {
+ if (showUIActionIcon == null) {
+ showUIActionIcon = UIHelper.createActionIcon("show-" + name);
+ }
+ return showUIActionIcon;
+ }
+
@SuppressWarnings({"unchecked"})
public void setUiImplClass(Class<?> uiImplClass) {
this.uiImplClass = (Class<? extends U>) uiImplClass;
Added: trunk/lutinui/src/main/java/org/codelutin/ui/ShowUIAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/ShowUIAction.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/ShowUIAction.java 2008-04-25 22:12:42 UTC (rev 611)
@@ -0,0 +1,68 @@
+/**
+ * # #% 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.ui;
+
+/** @author chemit */
+public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>, HH extends org.codelutin.ui.DialogUIHandler<?, ?>> extends AbstractUIAction<HH> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected DialogUIDef<M, U, H> uiDef;
+
+ protected transient UIFactory factory;
+
+ protected abstract U initUI(java.awt.event.ActionEvent e);
+
+ public <UU extends DialogUI<HH>> ShowUIAction(UU ui, DialogUIDef<M, U, H> uiDef, UIFactory factory, boolean showText) {
+ super(uiDef.getShowActionLibelle(), uiDef.getShowUIActionIcon(), ui);
+ this.uiDef = uiDef;
+ String name = (String) getValue(NAME);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
+ putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
+ if (!showText) {
+ putValue(NAME, null);
+ }
+ putValue(SHORT_DESCRIPTION, uiDef.getShowActionTip());
+ this.factory = factory;
+ }
+
+ public DialogUIDef<M, U, H> getUiDef() {
+ return uiDef;
+ }
+
+ public void setUiDef(DialogUIDef<M, U, H> uiDef) {
+ this.uiDef = uiDef;
+ }
+
+ public UIFactory getFactory() {
+ return factory;
+ }
+
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ checkInit();
+ U ui = initUI(e);
+ ui.setTitle(uiDef.getUiTitle());
+ log.info(ui.getTitle());
+ ui.setVisible(true);
+ }
+
+ @Override
+ protected void checkInit() throws IllegalStateException {
+ super.checkInit();
+ if (factory == null) {
+ throw new IllegalStateException("no factory found in " + this);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/UIFactory.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/UIFactory.java 2008-04-25 22:11:57 UTC (rev 610)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/UIFactory.java 2008-04-25 22:12:42 UTC (rev 611)
@@ -154,7 +154,7 @@
close();
}
- protected <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
+ public <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
U result = uiType.uiInstance;
if (result == null) {
try {
1
0
r610 - trunk/lutinui/src/main/java/org/codelutin/ui
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
by tchemit@users.labs.libre-entreprise.org 25 Apr '08
25 Apr '08
Author: tchemit
Date: 2008-04-25 22:11:57 +0000 (Fri, 25 Apr 2008)
New Revision: 610
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/DialogUI.java
Log:
use convinient method to obtain components (compatible with jaxx)
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/DialogUI.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogUI.java 2008-04-20 12:25:05 UTC (rev 609)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogUI.java 2008-04-25 22:11:57 UTC (rev 610)
@@ -68,6 +68,8 @@
private H handler;
public abstract AbstractButton getHelp();
+
+ public abstract Object getObjectById(java.lang.String s);
protected DialogUI() {
UIHelper.setQuitAction(this);
1
0