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
May 2008
- 1 participants
- 36 discussions
r672 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . type util
by tchemit@users.labs.libre-entreprise.org 17 May '08
by tchemit@users.labs.libre-entreprise.org 17 May '08
17 May '08
Author: tchemit
Date: 2008-05-17 11:32:26 +0000 (Sat, 17 May 2008)
New Revision: 672
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
Log:
ajout modulePath dans la config
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-05-17 11:32:03 UTC (rev 671)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-05-17 11:32:26 UTC (rev 672)
@@ -46,6 +46,8 @@
String getSshPassphrase();
+ String getModulePath();
+
File getSshPrivateKeyFile();
void setRootConfig(VCSRootConfig rootConfig);
@@ -64,6 +66,8 @@
void setSshLogin(String sshLogin);
+ void setModulePath(String newModulePath);
+
void setSshPassphrase(String sshPassphrase);
void setSshPrivateKeyFile(File sshPrivateKeyFile);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-05-17 11:32:03 UTC (rev 671)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-05-17 11:32:26 UTC (rev 672)
@@ -29,6 +29,9 @@
/** property <code>rootConfig</code>, as a {@link org.codelutin.vcs.VCSRootConfig} */
rootConfig(VCSRootConfig.class),
+ /** property <code>modulePath</code> */
+ modulePath(String.class),
+
/** property <code>typeRepo</code>, type of repo to use, as a {@link VCSTypeRepo} */
typeRepo(VCSTypeRepo.class),
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-17 11:32:03 UTC (rev 671)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-17 11:32:26 UTC (rev 672)
@@ -75,6 +75,10 @@
return (File) properties.get(sshPrivateKeyFile);
}
+ public String getModulePath() {
+ return (String) properties.get(modulePath);
+ }
+
public void setRootConfig(VCSRootConfig newRootConfig) {
setProperty(rootConfig, newRootConfig);
}
@@ -107,6 +111,10 @@
setProperty(sshLogin, newSshLogin);
}
+ public void setModulePath(String newModulePath) {
+ setProperty(modulePath, newModulePath);
+ }
+
public void setSshPassphrase(String newSshPassphrase) {
setProperty(sshPassphrase, newSshPassphrase);
}
1
0
r671 - in trunk/lutinvcs/ui/jaxx/src/main: resources/i18n uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 17 May '08
by tchemit@users.labs.libre-entreprise.org 17 May '08
17 May '08
Author: tchemit
Date: 2008-05-17 11:32:03 +0000 (Sat, 17 May 2008)
New Revision: 671
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
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
ajout modulePath dans la config
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-05-15 07:56:26 UTC (rev 670)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-05-17 11:32:03 UTC (rev 671)
@@ -8,7 +8,11 @@
lutinvcs.config.generate=Generate
lutinvcs.config.lastName=
lutinvcs.config.message=
+lutinvcs.config.modulePath=
lutinvcs.config.pass=
+lutinvcs.config.remoteURL=
+lutinvcs.config.rootConfig=
+lutinvcs.config.rootConfigHead=
lutinvcs.config.server.authenticationMethod=
lutinvcs.config.server.login=
lutinvcs.config.server.passphrase=
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-05-15 07:56:26 UTC (rev 670)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-05-17 11:32:03 UTC (rev 671)
@@ -8,8 +8,12 @@
lutinvcs.config.generate=G\u00E9n\u00E9rer
lutinvcs.config.lastName=Nom
lutinvcs.config.message=Configuration de la connexion
+lutinvcs.config.modulePath=Module path
lutinvcs.config.pass=password
-lutinvcs.config.server.authenticationMethod=Connexion
+lutinvcs.config.remoteURL=URL
+lutinvcs.config.rootConfig=Repository
+lutinvcs.config.rootConfigHead=Serveur distant
+lutinvcs.config.server.authenticationMethod=Authentification
lutinvcs.config.server.login=Login
lutinvcs.config.server.passphrase=passe-phrase
lutinvcs.config.server.password=Mot de passe
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-15 07:56:26 UTC (rev 670)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-17 11:32:03 UTC (rev 671)
@@ -77,7 +77,6 @@
</row>
</Table>
<JButton id='reset' action='{newAction(org.codelutin.ui.config.ResetAction.class,false)}' borderPainted='false'/>
- <!--JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/-->
<JButton id='testConnection' action='{newAction(TestConnexionAction.class)}' borderPainted='false'/>
<JButton id='help' action='{newAction(HelpAction.class)}' borderPainted='false'/>
</JToolBar>
@@ -92,9 +91,20 @@
<cell fill='both'/>
</row>
</Table>
- <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
- borderPainted='false'/>
+ <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()" borderPainted='false'/>
</JToolBar>
+
+ <JToolBar id='remoteHead' opaque='false' height='26'>
+ <JLabel id='rootConfigHeadLabel'/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='editRoot' icon='{createActionIcon("editroot")}' borderPainted='false' onActionPerformed="editRoot()"/>
+ <JButton id='addRoot' icon='{createActionIcon("addroot")}' borderPainted='false' onActionPerformed="addRoot()"/>
+ <JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/>
+ </JToolBar>
<Table fill='both' insets="1,1,1,1">
<row fill='horizontal'>
@@ -106,13 +116,22 @@
</row>
<row fill='horizontal'>
<cell columns="2" fill='both'>
- <JToolBar id='rootHead' opaque='false' height='26'>
- <JComboBox id='rootsList'/>
- <JButton id='editRoot' icon='{createActionIcon("editroot")}' borderPainted='false' onActionPerformed="editRoot()"/>
- <JButton id='addRoot' icon='{createActionIcon("addroot")}' borderPainted='false' onActionPerformed="addRoot()"/>
- <JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/>
- <!--JSeparator orientation="vertical"/-->
- </JToolBar>
+ <JScrollPane columnHeaderView='{remoteHead}' styleClass='connexionScroll'>
+ <Table insets="2,2,2,2" fill='horizontal'>
+ <row fill='horizontal'>
+ <cell><JLabel id='rootConfigLabel'/></cell>
+ <cell><JComboBox id='rootsList'/></cell>
+ </row>
+ <row fill='horizontal'>
+ <cell><JLabel id='modulePathLabel'/></cell>
+ <cell><JTextField id='modulePath' onKeyReleased="doCheck(VCSConnexionConfigProperty.modulePath)"/></cell>
+ </row>
+ <row fill='horizontal'>
+ <cell><JLabel id='remoteURLLabel'/></cell>
+ <cell><JTextField id='remoteURL' enabled='false'/></cell>
+ </row>
+ </Table>
+ </JScrollPane>
</cell>
</row>
<row fill='horizontal'>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx 2008-05-15 07:56:26 UTC (rev 670)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx 2008-05-17 11:32:03 UTC (rev 671)
@@ -15,7 +15,7 @@
<row fill='horizontal'>
<cell columns="2" fill='both'>
<JScrollPane columnHeaderView='{identityHead}' styleClass='connexionScroll'>
- <Table>
+ <Table fill='horizontal'>
<row fill='horizontal'>
<cell>
<JLabel id='firstNameLabel'/>
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-05-15 07:56:26 UTC (rev 670)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-05-17 11:32:03 UTC (rev 671)
@@ -77,6 +77,19 @@
text: "lutinvcs.config.workingCopyFile";
}
+#modulePathLabel {
+ text: "lutinvcs.config.modulePath";
+}
+#rootConfigLabel {
+ text: "lutinvcs.config.rootConfig";
+}
+#rootConfigHeadLabel {
+ text: "lutinvcs.config.rootConfigHead";
+}
+#remoteURLLabel {
+ text: "lutinvcs.config.remoteURL";
+}
+
#changePrivateKeyFile {
toolTipText: "lutinvcs.config.server.ssh.key.change";
opaque:false;
@@ -123,6 +136,8 @@
}
.connexionScroll{
- verticalScrollBarPolicy: 20;
+ verticalScrollBarPolicy: 21;
horizontalScrollBarPolicy: 31;
+ height:110;
+ width:400;
}
\ No newline at end of file
1
0
r670 - trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action
by tchemit@users.labs.libre-entreprise.org 15 May '08
by tchemit@users.labs.libre-entreprise.org 15 May '08
15 May '08
Author: tchemit
Date: 2008-05-15 07:56:26 +0000 (Thu, 15 May 2008)
New Revision: 670
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java
Log:
pb de cast suite ?\195?\160 refactoring config de connexion
Modified: 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 2008-05-14 16:59:17 UTC (rev 669)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java 2008-05-15 07:56:26 UTC (rev 670)
@@ -15,7 +15,6 @@
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;
@@ -62,7 +61,8 @@
SynchUI ui = super.initUI(e);
ui.getHandler().getModel().populate(getLocation(), entries);
ui.getContentScroll().setEnabled(entries.length > 1);
- ((AbstractVCSShowUIAction) ui.getConfig().getAction()).setConfig(ui.getHandler().getConfig());
+ // positionnement de la config dans l'action d'affichage d'edition de la config
+ ((ShowConfigAction) ui.getConfig().getAction()).setSrc(ui.getHandler().getConfig());
return ui;
}
}
\ No newline at end of file
1
0
14 May '08
Author: tchemit
Date: 2008-05-14 16:59:17 +0000 (Wed, 14 May 2008)
New Revision: 669
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java
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/ShowConfigAction.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/handler/ConnexionConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
use generic config dialog for connexionconfig
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -68,6 +68,8 @@
void setSshPrivateKeyFile(File sshPrivateKeyFile);
- boolean isNoPassPhrase();
+ boolean isSshNoPassphrase();
+ void setSshNoPassphrase(boolean newNoPassPhrase);
+
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -14,41 +14,58 @@
*/
package org.codelutin.vcs.type;
+import org.codelutin.vcs.VCSRootConfig;
+
+import java.io.File;
+
/**
* Enumaration of properties useable in a {@link org.codelutin.vcs.VCSConnexionConfig}
*
* @author chemit
* @see org.codelutin.vcs.VCSConnexionConfig
*/
-public enum VCSConnexionConfigProperty {
+public enum VCSConnexionConfigProperty implements org.codelutin.util.config.Property {
/** property <code>rootConfig</code>, as a {@link org.codelutin.vcs.VCSRootConfig} */
- rootConfig,
+ rootConfig(VCSRootConfig.class),
/** property <code>typeRepo</code>, type of repo to use, as a {@link VCSTypeRepo} */
- typeRepo,
+ typeRepo(VCSTypeRepo.class),
/** property <code>typeRepoValue</code>, the value associated to typeRepo (eg, branch or tag name, null for a head connexion) */
- typeRepoValue,
+ typeRepoValue(String.class),
/** property <code>workingCopyFile</code>, the location of local working copy, it null (no working copy declared) */
- workingCopyFile,
+ workingCopyFile(File.class),
/** property <code>connexionMode</code>, as a {@link org.codelutin.vcs.type.VCSConnexionMode} */
- connexionMode,
+ connexionMode(VCSConnexionMode.class),
/** property <code>login</code>, login for a password connexion */
- login,
+ login(String.class),
/** property <code>password</code>, password for a password connexion */
- password,
+ password(String.class),
/** property <code>sshLogin</code>, login for a ssh connexion */
- sshLogin,
+ sshLogin(String.class),
+ /** property <code>sshNoPassphrase</code>, to tell if use of passphrase for a ssh connexion */
+ sshNoPassphrase(Boolean.class),
+
/** property <code>sshPassphrase</code>, passphrase for a ssh connexion */
- sshPassphrase,
+ sshPassphrase(String.class),
+
+ /** property <code>sshPrivateKey</code>, path of the ssh private key file for a ssh connexion */
+ sshPrivateKeyFile(File.class);
- /** property <code>sshPrivateKey</code>, path of the ssh private key file for a ssh connexion */
- sshPrivateKeyFile
+ private Class<?> type;
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ VCSConnexionConfigProperty(Class<?> type) {
+ this.type = type;
+ }
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -115,7 +115,16 @@
setProperty(sshPrivateKeyFile, newSshPrivateKeyFile);
}
- public boolean isNoPassPhrase() {
- return getSshPassphrase() == null;
+ public boolean isSshNoPassphrase() {
+ Boolean o = (Boolean) getProperty(sshNoPassphrase);
+ return o == null || o;
}
+
+ public void setSshNoPassphrase(boolean newNoPassPhrase) {
+ setProperty(sshNoPassphrase, newNoPassPhrase);
+ //if (newNoPassPhrase!=null && newNoPassPhrase) {
+ // remove passphrase if any
+ // setSshPassphrase(null);
+ //}
+ }
}
Modified: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -78,7 +78,7 @@
// just push in System properties that's we need for this...
System.setProperty("svnkit.ssh2.key", config.getSshPrivateKeyFile().getAbsolutePath());
System.setProperty("svnkit.ssh2.username", config.getSshLogin());
- if (!config.isNoPassPhrase()) {
+ if (!config.isSshNoPassphrase()) {
char[] pass = getConfig().getSshPassphrase().toCharArray();
if (pass != null) {
System.setProperty("svnkit.ssh2.passphrase", Arrays.toString(pass));
Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -19,7 +19,12 @@
import org.codelutin.ui.DialogUIDef;
import org.codelutin.util.config.IdentityConfig;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
-import static org.codelutin.vcs.type.VCSConnexionConfigProperty.*;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.connexionMode;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshLogin;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshNoPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPrivateKeyFile;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.workingCopyFile;
import org.codelutin.vcs.ui.UIActionHelper;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.model.SynchUIModel;
@@ -32,9 +37,7 @@
import java.util.EnumMap;
import java.util.List;
-/**
- * @author chemit
- */
+/** @author chemit */
public class UITest {
static protected final Log log = LogFactory.getLog(UITest.class);
@@ -110,6 +113,7 @@
EnumMap<VCSConnexionConfigProperty, Object> props = new EnumMap<VCSConnexionConfigProperty, Object>(VCSConnexionConfigProperty.class);
props.put(sshPrivateKeyFile, new File("/home/tony/.ssh/id_dsa"));
props.put(sshPassphrase, "passphrase");
+ props.put(sshNoPassphrase, false);
props.put(sshLogin, "login");
props.put(connexionMode, org.codelutin.vcs.type.VCSConnexionMode.SSH);
props.put(workingCopyFile, root);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -15,51 +15,25 @@
package org.codelutin.vcs.ui;
import static org.codelutin.i18n.I18n._;
-import org.codelutin.ui.FormElement;
+import org.codelutin.ui.config.DialogConfigUI;
import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
-import org.codelutin.vcs.ui.util.ui.AbstractUI;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
-import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import java.io.File;
-import java.util.Arrays;
/** @author chemit */
-public abstract class ConnexionConfigUI extends AbstractUI<ConnexionConfigUIHandler> {
+public abstract class ConnexionConfigUI extends DialogConfigUI<VCSConnexionConfigProperty, ConnexionConfigUIHandler> {
- public enum Element implements FormElement<ConnexionConfigUI> {
- connexion,
- login,
- sshLogin,
- password,
- passphrase,
- nopassphrase,
- privateKeyFile,
- workingCopyFile;
-
- public Object getValue(ConnexionConfigUI ui) {
- return ui.getElementValue(this);
- }
-
- public void setValue(ConnexionConfigUI ui, String value) {
- //TODO
- JComponent component = ui.getElement(this);
- }
-
- public JLabel getLabel(ConnexionConfigUI ui) {
- return ui.getElementLabel(this);
- }
- }
-
public abstract ButtonGroup getConnexionMode();
public abstract AbstractButton getChangePrivateKeyFile();
@@ -68,12 +42,6 @@
public abstract AbstractButton getGenerateKey();
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
public abstract AbstractButton getTestConnection();
public abstract AbstractButton getAddRoot();
@@ -82,32 +50,6 @@
public abstract AbstractButton getEditRoot();
- 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 JRadioButton getConnexionModeAnonymous();
@@ -122,11 +64,11 @@
public abstract JPasswordField getPassword();
- public abstract JPasswordField getPassphrase();
+ public abstract JPasswordField getSshPassphrase();
- public abstract JCheckBox getNoPassPhrase();
+ public abstract JCheckBox getSshNoPassphrase();
- public abstract JTextField getPrivateKeyFile();
+ public abstract JTextField getSshPrivateKeyFile();
public abstract JTextField getWorkingCopyFile();
@@ -136,10 +78,12 @@
public abstract JLabel getPasswordLabel();
- public abstract JLabel getPassphraseLabel();
+ public abstract JLabel getSshPassphraseLabel();
- public abstract JLabel getPrivateKeyFileLabel();
+ //public abstract JLabel getSshNoPassphraseLabel();
+ public abstract JLabel getSshPrivateKeyFileLabel();
+
public abstract JLabel getWorkingCopyFileLabel();
public abstract javax.swing.JPanel getConnexionPanel();
@@ -155,26 +99,9 @@
public abstract javax.swing.JComboBox getRootsList();
- public boolean isConfigValid() {
- return getHandler().isConfigValid();
- }
-
- protected void reset() {
- getHandler().reset();
- }
-
- protected void save() {
- getHandler().save();
- dispose();
- }
-
- protected void doCheck(Element element) {
- getHandler().doCheck(element);
- }
-
protected void changeAutheticationMode(VCSConnexionMode mode) {
getHandler().getModel().setConnexionMode(mode);
- doCheck(Element.connexion);
+ doCheck(VCSConnexionConfigProperty.connexionMode);
}
protected void changePrivateKeyFile() {
@@ -182,8 +109,8 @@
File file = FileUtil.getFile(".*.pub$", _("lutinvcs.config.find.public.key"));
if (file != null) {
String path = file.getAbsolutePath();
- getPrivateKeyFile().setText(path.substring(0, path.length() - 4));
- doCheck(Element.privateKeyFile);
+ getSshPrivateKeyFile().setText(path.substring(0, path.length() - 4));
+ doCheck(VCSConnexionConfigProperty.sshPrivateKeyFile);
}
}
@@ -193,7 +120,7 @@
if (file != null) {
String path = new File(file).getAbsolutePath();
getWorkingCopyFile().setText(path);
- doCheck(Element.workingCopyFile);
+ doCheck(VCSConnexionConfigProperty.workingCopyFile);
}
}
Modified: 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 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -46,7 +46,7 @@
public static void showConfigUI(VCSConnexionConfig config, DialogUI ui, String position) {
ShowConfigAction action = new ShowConfigAction(ui, false);
- action.setConfig(config);
+ action.setSrc(config);
action.setPosition(position);
fireAction(ui, action);
}
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-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -16,27 +16,37 @@
import org.codelutin.ui.DialogUI;
import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.ShowUIAction;
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
-import org.codelutin.vcs.ui.util.AbstractVCSShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> {
+public class ShowConfigAction extends ShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> {
private static final long serialVersionUID = 1L;
+ protected transient Object src;
+
+ public Object getSrc() {
+ return src;
+ }
+
+ public void setSrc(Object src) {
+ this.src = src;
+ }
+
public ShowConfigAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
- super(ui, VCSUIFactory.CONNEXION_CONFIG_UI, showText);
+ super(ui, VCSUIFactory.CONNEXION_CONFIG_UI, VCSUIFactory.getInstance(), showText);
}
@Override
protected ConnexionConfigUI initUI(ActionEvent e) {
ConnexionConfigUI ui = super.initUI(e);
- ui.getHandler().getModel().populate(getConfig());
+ ui.getHandler().getModel().populate(src);
ui.pack();
return ui;
}
Modified: 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/action/TestConnexionAction.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -42,7 +42,7 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
checkInit();
ConnexionConfigUIHandler uiHandler = getHandler();
- VCSConnexionConfig config = uiHandler.getConfig();
+ VCSConnexionConfig config = uiHandler.getModel().getCurrent();
VCSConnexion connexion = VCSFactory.newConnexion(config);
ConnexionConfigUI ui = uiHandler.getUi();
boolean result = false;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -14,43 +14,34 @@
*/
package org.codelutin.vcs.ui.handler;
+import org.codelutin.ui.config.DialogConfigUIHandler;
import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.connexionMode;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.login;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.password;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshLogin;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshNoPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPrivateKeyFile;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.ConnexionConfigUI;
-import org.codelutin.vcs.ui.ConnexionConfigUI.Element;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.sshLogin;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.values;
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
-import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
-import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
-import javax.swing.text.JTextComponent;
-import java.awt.Color;
import java.beans.PropertyChangeEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.EnumSet;
/** @author chemit */
-public class ConnexionConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
+public class ConnexionConfigUIHandler extends DialogConfigUIHandler<VCSConnexionConfigProperty, ConnexionConfigUIModel, ConnexionConfigUI> {
- protected List<Element> errors;
-
-
- public ConnexionConfigUIHandler(ConnexionConfigUI ui,ConnexionConfigUIModel model, VCSConnexionConfig config) {
- super(ui, model, config);
+ public ConnexionConfigUIHandler(ConnexionConfigUI ui, ConnexionConfigUIModel model) {
+ super(ui, model);
ui.setHandler(this);
- errors = new ArrayList<Element>();
}
+ @Override
public void init() {
super.init();
ConnexionConfigUI ui = getUi();
@@ -60,32 +51,19 @@
connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
}
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
if (log.isDebugEnabled()) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
}
String action = evt.getPropertyName();
- if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI((ConnexionConfigUIModel) evt.getNewValue());
- doCheck(null);
- return;
- }
if (ConnexionConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
+ doCheckAll();
updateUI((VCSConnexionMode) evt.getNewValue());
- doCheck(null);
return;
}
- if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean modified = newValue != null && newValue;
- getUi().getReset().setEnabled(modified);
- getUi().getTestConnection().setEnabled(modified && isConfigValid());
- return;
- }
-
if (ConnexionConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
boolean validConnexion = newValue != null && newValue;
@@ -93,151 +71,150 @@
getUi().getTestConnection().setEnabled(!validConnexion);
return;
}
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
- public synchronized List<Element> validateModel(Element element) {
- errors.clear();
- ConnexionConfigUI ui = getUi();
- if (element != null) {
- // compute modifed
- setModified(element, ui);
+ if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean modified = newValue != null && newValue;
+
+ getUi().getTestConnection().setEnabled(modified && getModel().isConfigValid());
+ // do not return, use super class code
}
- switch (getModel().getMode()) {
- case ANONYMOUS:
- // nothing to validate
- break;
- case PASSWORD:
- // login + password not empty
- checkData(ui.getLogin(), login);
- checkData(ui.getPassword().getPassword().length == 0, password);
- break;
- case SSH:
- // login + private key exists
- checkData(ui.getSshLogin(), sshLogin);
- String s = ui.getPrivateKeyFile().getText();
- File file = new File(s);
- checkData(s.isEmpty() || !file.exists(), privateKeyFile);
- if (ui.getElementValue(nopassphrase).equals("false")) {
- // check it there is a pass-phrase
- checkData(ui.getPassphrase().getPassword().length == 0, passphrase);
- } else {
- errors.remove(passphrase);
- }
- break;
- }
- return errors;
+
+ // try in super class
+ super.propertyChange(evt);
}
- public void setModified(Element element, ConnexionConfigUI ui) {
- boolean modify = false;
- ConnexionConfigUIModel model = getModel();
+ public void doCheck(VCSConnexionConfigProperty key) {
+ switch (key) {
- String value = ui.getElementValue(element);
-
- switch (element) {
- case connexion:
- modify = model.getMode() != model.getConfig().getConnexionMode();
+ case connexionMode:
+ // special case (not checkable property)
+ doCheck(getModel().getMode());
break;
- case login:
- modify = !value.equals(model.getConfig().getLogin());
+ case sshNoPassphrase:
+ Boolean noPass = (Boolean) getUi().getElementValue(key);
+ getModel().setNoSshPassPhrase(noPass);
+ //super.doCheck(key);
+ if (noPass) {
+ getModel().clear(sshPassphrase);
+ } //else {
+ super.doCheck(sshPassphrase);
+ //}
break;
+ case login:
+ case password:
+ case rootConfig:
case sshLogin:
- modify = !value.equals(model.getConfig().getSshLogin());
+ case sshPassphrase:
+ case sshPrivateKeyFile:
+ case workingCopyFile:
+ super.doCheck(key);
break;
- case password:
- modify = !Arrays.toString(ui.getPassword().getPassword()).equals(model.getConfig().getPassword());
+ case typeRepo:
+ case typeRepoValue:
break;
- case nopassphrase:
- boolean b = ui.getNoPassPhrase().isSelected();
- modify = (model.getConfig().getSshPassphrase() != null && !model.getConfig().getSshPassphrase().isEmpty()) == b;
- if (!b) {
- model.removeModified(passphrase);
- } else {
- char[] password = ui.getPassphrase().getPassword();
- boolean modify2;
- if (model.getConfig().getSshPassphrase() == null || model.getConfig().getSshPassphrase().isEmpty()) {
- modify2 = password.length == 0;
- } else {
- modify2 = model.getConfig().getSshPassphrase().equals(Arrays.toString(password));
- }
- if (modify2) {
- model.addModified(passphrase);
- }
- }
- break;
- case passphrase:
- modify = !value.equals(model.getConfig().getSshPassphrase());
- break;
- case privateKeyFile:
- modify = !value.equals(model.getConfig().getSshPrivateKeyFile() + "");
- break;
+ }
+ }
- case workingCopyFile:
- modify = !value.equals(model.getConfig().getWorkingCopyFile() + "");
+ protected boolean doCheck(VCSConnexionMode value) {
+
+ boolean result = value != null;
+ switch (value) {
+ case ANONYMOUS:
+ // always valid :)
+ return true;
+ case PASSWORD:
+ doCheck(login);
+ doCheck(password);
break;
+ case SSH:
+ doCheck(sshLogin);
+ doCheck(sshNoPassphrase);
+ doCheck(sshPassphrase);
+ doCheck(sshPrivateKeyFile);
+ break;
}
- 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);
- }
+ return result;
}
- public void doCheck(Element element) {
- List<Element> errors = validateModel(element);
- updateUI(errors);
- }
- public boolean isConfigValid() {
- return errors.isEmpty() && getModel().isConnexionState();
+ @Override
+ public void doCheckAll() {
+ super.doCheckAll();
}
- public void reset() {
- getModel().reset();
- }
+ @Override
+ protected void populateUI() {
+ super.populateUI();
- protected void populateUI(ConnexionConfigUIModel model) {
ConnexionConfigUI ui = getUi();
- VCSConnexionConfig config = model.getConfig();
+ ConnexionConfigUIModel model = getModel();
+ VCSConnexionConfig config = model.getCurrent();
switch (config.getConnexionMode()) {
case ANONYMOUS:
+ populateUI(ui, login, null);
+ populateUI(ui, password, null);
+ populateUI(ui, sshLogin, null);
+ populateUI(ui, sshNoPassphrase, true);
+ populateUI(ui, sshPassphrase, null);
+ populateUI(ui, sshPrivateKeyFile, null);
break;
case PASSWORD:
- ui.getLogin().setText(config.getLogin());
- ui.getPassword().setText(config.getPassword() == null ? "" : config.getPassword());
+ populateUI(ui, sshLogin, null);
+ populateUI(ui, sshNoPassphrase, true);
+ populateUI(ui, sshPassphrase, null);
+ populateUI(ui, sshPrivateKeyFile, null);
break;
case SSH:
- ui.getSshLogin().setText(config.getSshLogin());
- ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
- ui.getPrivateKeyFile().setText(config.getSshPrivateKeyFile() == null ? "" : config.getSshPrivateKeyFile().getAbsolutePath());
- ui.getPassphrase().setText(config.getSshPassphrase() == null ? "" : config.getSshPassphrase());
+ populateUI(ui, login, null);
+ populateUI(ui, password, null);
break;
}
ui.getTestConnection().setEnabled(true);
}
+
+ @Override
+ protected boolean prepareSave() {
+ boolean b = super.prepareSave();
+ if (b) {
+ VCSConnexionConfig current = getModel().getCurrent();
+ EnumSet<VCSConnexionConfigProperty> modifieds = getModel().getModifieds();
+ if (modifieds.contains(connexionMode)) {
+ current.setConnexionMode(getModel().getMode());
+ }
+
+ if (modifieds.contains(sshNoPassphrase)) {
+ boolean o = getModel().isNoSshPassPhrase();
+ current.setSshNoPassphrase(o);
+ if (o) {
+ // no passphrase
+ current.setSshPassphrase(null);
+ modifieds.add(VCSConnexionConfigProperty.sshPassphrase);
+ }
+ }
+
+ }
+ return b;
+ }
+
protected void updateUI(final VCSConnexionMode mode) {
ConnexionConfigUI ui = getUi();
- //getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
switch (mode) {
case ANONYMOUS:
ui.getConnexionModeAnonymous().setSelected(true);
break;
case PASSWORD:
+ doCheck(login);
+ doCheck(password);
ui.getConnexionModePassword().setSelected(true);
- setModified(login, ui);
- setModified(password, ui);
break;
case SSH:
- setModified(sshLogin, ui);
- setModified(nopassphrase, ui);
- setModified(passphrase, ui);
- setModified(privateKeyFile, ui);
+
+ doCheck(sshLogin);
+ doCheck(sshNoPassphrase);
+ doCheck(sshPassphrase);
+ doCheck(sshPrivateKeyFile);
ui.getConnexionModeSsh().setSelected(true);
break;
}
@@ -249,44 +226,4 @@
});
}
- protected void updateUI(List<Element> errors) {
- ConnexionConfigUI ui = getUi();
- boolean valid = isConfigValid();
- ui.getOk().setEnabled(valid && getModel().isModified());
- //ui.getTestConnection().setEnabled(valid);
- ui.getGenerateKey().setEnabled(getModel().getMode() == VCSConnexionMode.SSH && !errors.contains(sshLogin) && !errors.contains(passphrase));
- for (Element element : values()) {
- setLabelColor(errors, element);
- }
- }
-
- protected void checkData(JTextComponent component, Element errorName) {
- if (component.getText().isEmpty()) {
- errors.add(errorName);
- }
- }
-
- protected void checkData(boolean notValid, Element errorName) {
- if (notValid) {
- errors.add(errorName);
- }
- }
-
- protected void setLabelColor(List<Element> errors, Element element) {
- JComponent component = getUi().getElementLabel(element);
- if (component != null && component.isVisible()) {
- component.setForeground(errors.contains(element) ? Color.red : Color.black);
- }
- }
-
- public void save() {
- if (!getModel().isModified()) {
- log.warn("nothing to save");
- }
- for (Element element : getModel().getModifieds()) {
- String value = getUi().getElementValue(element);
- getModel().save(element, value);
- log.info("save " + element);
- }
- }
-}
\ No newline at end of file
+}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -14,53 +14,56 @@
*/
package org.codelutin.vcs.ui.model;
+import org.codelutin.ui.config.DialogConfigUIModel;
import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.*;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConnexionConfigUI.Element;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.connexion;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.sshLogin;
-import org.codelutin.vcs.ui.util.model.AbstractUIModel;
+import org.codelutin.vcs.util.SimpleVCSConnexionConfig;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.EnumSet;
/**
* Model of a a confirmation of action on entries (single type of action possible)
*
* @author chemit
*/
-public class ConnexionConfigUIModel extends AbstractUIModel {
+public class ConnexionConfigUIModel extends DialogConfigUIModel<VCSConnexionConfigProperty, VCSConnexionConfig> {
- 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 MODIFIED_PROPERTY_CHANGED = "modify";
- protected VCSConnexionMode mode;
- protected List<Element> modifieds;
- protected VCSConnexionConfig config;
protected Boolean connexionState;
+ protected Boolean noSshPassPhrase;
+ protected VCSConnexionMode mode;
+
public ConnexionConfigUIModel() {
- modifieds = new ArrayList<Element>();
+ super(VCSConnexionConfigProperty.class);
+ uncheckedKeys = EnumSet.noneOf(VCSConnexionConfigProperty.class);
+ uncheckedKeys.add(connexionMode);
+ uncheckedKeys.add(rootConfig);
+ uncheckedKeys.add(typeRepo);
+ uncheckedKeys.add(typeRepoValue);
}
- public void populate(VCSConnexionConfig config) {
- this.config = config;
- setConnexionMode(config.getConnexionMode());
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ @Override
+ public void populate(Object src) {
+ current.copyFrom(src, EnumSet.of(sshNoPassphrase));
+ noSshPassPhrase = current.isSshNoPassphrase();
+ super.populate(src);
+ /*if (noSshPassPhrase) {
+ clear(sshPassphrase);
+ }*/
+ setConnexionMode(current.getConnexionMode());
}
- public void reset() {
- checkConnexionInit();
- populate(config);
+ public void setNoSshPassPhrase(Boolean noSshPassPhrase) {
+ Boolean old = this.noSshPassPhrase;
+ this.noSshPassPhrase = noSshPassPhrase;
+ if (old!=null) {
+ changeModifiedState(sshNoPassphrase, noSshPassPhrase,current.isSshNoPassphrase());
+ }
}
public void setConnexionMode(VCSConnexionMode mode) {
@@ -72,114 +75,90 @@
// nothing to clean
break;
case PASSWORD:
- removeModified(login, password);
+ clear(login);
+ clear(password);
break;
case SSH:
- removeModified(sshLogin, passphrase, nopassphrase, privateKeyFile);
+ clear(sshLogin);
+ clear(sshPassphrase);
+ clear(sshNoPassphrase);
+ clear(sshPrivateKeyFile);
break;
}
}
- if (mode == getConfig().getConnexionMode()) {
- removeModified(connexion);
- } else {
- addModified(connexion);
- }
+ changeModifiedState(connexionMode, mode, getCurrent().getConnexionMode());
+
firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
setConnexionState(null);
}
- public boolean isModified() {
- return !modifieds.isEmpty();
+ protected VCSConnexionConfig newConfig() {
+ return new SimpleVCSConnexionConfig();
}
- public List<Element> getModifieds() {
- return modifieds;
- }
-
- public Boolean isConnexionState() {
- return connexionState != null && connexionState;
- }
-
- public VCSConnexionConfig getConfig() throws IllegalStateException {
- checkConnexionInit();
- return config;
- }
-
- public VCSConnexionMode getMode() throws IllegalStateException {
- checkConnexionInit();
- return mode;
- }
-
- public void addModified(Element elementname) {
- if (!modifieds.contains(elementname)) {
- modifieds.add(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(Element... elementnames) {
- for (Element elementname : elementnames) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- }
-
- public void setModified(boolean modified) {
- if (!modified) {
- modifieds.clear();
- }
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void save(Element element, String value) {
- checkConnexionInit();
- switch (element) {
- case connexion:
- config.setConnexionMode(mode);
+ protected boolean isValid(VCSConnexionConfigProperty key, Object value) {
+ boolean result = value != null;
+ switch (key) {
+ case connexionMode:
break;
case login:
- if (mode == VCSConnexionMode.PASSWORD) {
- config.setLogin(value);
- }
+ if (mode != VCSConnexionMode.PASSWORD) {
+ result = true;
+ } else
+ result &= !String.valueOf(value).trim().isEmpty();
break;
- case nopassphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPassphrase(null);
- }
- break;
case password:
- if (mode == VCSConnexionMode.PASSWORD) {
- config.setPassword(value);
- }
- case passphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPassphrase(value);
- }
+ if (mode != VCSConnexionMode.PASSWORD) {
+ result = true;
+ } else
+ result &= !String.valueOf(value).trim().isEmpty();
break;
- case privateKeyFile:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPrivateKeyFile(new File(value));
- }
+ case rootConfig:
break;
case sshLogin:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshLogin(value);
+ if (mode != VCSConnexionMode.SSH) {
+ result = true;
+ } else
+ result &= !String.valueOf(value).trim().isEmpty();
+ break;
+ case sshPassphrase:
+ if (mode != VCSConnexionMode.SSH || isNoSshPassPhrase()) {
+ result = true;
+ } else
+ result &= !String.valueOf(value).trim().isEmpty();
+ break;
+ case sshPrivateKeyFile:
+ if (mode != VCSConnexionMode.SSH) {
+ result = true;
+ } else if (result) {
+ String f = String.valueOf(value).trim();
+ result = !f.isEmpty() && new java.io.File(f).exists();
}
break;
+ case typeRepo:
+ break;
+ case typeRepoValue:
+ break;
case workingCopyFile:
- config.setWorkingCopyFile(new File(value));
+ if (result) {
+ String f = String.valueOf(value).trim();
+ result = !f.isEmpty() && new java.io.File(f).exists();
+ }
break;
+ case sshNoPassphrase:
+ // always valid :)
+ result = true;
+ break;
}
+ return result;
}
+ public Boolean isConnexionState() {
+ return connexionState != null && connexionState;
+ }
- protected void checkConnexionInit() throws IllegalStateException {
- if (config == null) {
- throw new IllegalStateException("no config found in model " + this);
- }
+ public VCSConnexionMode getMode() throws IllegalStateException {
+ return mode;
}
public void setConnexionState(Boolean connexionState) {
@@ -187,4 +166,8 @@
this.connexionState = connexionState;
firePropertyChange(CONNEXION_STATE_PROPERTY_CHANGED, oldConnexionState, connexionState);
}
+
+ public boolean isNoSshPassPhrase() {
+ return noSshPassPhrase != null && noSshPassPhrase;
+ }
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java 2008-05-14 16:59:17 UTC (rev 669)
@@ -14,22 +14,8 @@
*/
package org.codelutin.vcs.ui.model;
-import org.codelutin.vcs.VCSConnexionConfig;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConnexionConfigUI.Element;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.connexion;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.sshLogin;
import org.codelutin.vcs.ui.util.model.AbstractUIModel;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Model of a a confirmation of action on entries (single type of action possible)
*
@@ -37,156 +23,9 @@
*/
public class RootConfigUIModel extends AbstractUIModel {
- 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 MODIFIED_PROPERTY_CHANGED = "modify";
- protected VCSConnexionMode mode;
-
- protected List<Element> modifieds;
-
- protected VCSConnexionConfig config;
- protected Boolean connexionState;
-
public RootConfigUIModel() {
- modifieds = new ArrayList<Element>();
- }
- public void populate(VCSConnexionConfig config) {
- this.config = config;
- setConnexionMode(config.getConnexionMode());
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
- public void reset() {
- checkConnexionInit();
- populate(config);
- }
-
- public void setConnexionMode(VCSConnexionMode mode) {
- VCSConnexionMode oldMode = this.mode;
- this.mode = mode;
- if (oldMode != null) {
- switch (oldMode) {
- case ANONYMOUS:
- // nothing to clean
- break;
- case PASSWORD:
- removeModified(login, password);
- break;
- case SSH:
- removeModified(sshLogin, passphrase, nopassphrase, privateKeyFile);
- break;
- }
- }
- if (mode == getConfig().getConnexionMode()) {
- removeModified(connexion);
- } else {
- addModified(connexion);
- }
- firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
- setConnexionState(null);
- }
-
- public boolean isModified() {
- return !modifieds.isEmpty();
- }
-
- public List<Element> getModifieds() {
- return modifieds;
- }
-
- public Boolean isConnexionState() {
- return connexionState != null && connexionState;
- }
-
- public VCSConnexionConfig getConfig() throws IllegalStateException {
- checkConnexionInit();
- return config;
- }
-
- public VCSConnexionMode getMode() throws IllegalStateException {
- checkConnexionInit();
- return mode;
- }
-
- public void addModified(Element elementname) {
- if (!modifieds.contains(elementname)) {
- modifieds.add(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(Element... elementnames) {
- for (Element elementname : elementnames) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- }
-
- public void setModified(boolean modified) {
- if (!modified) {
- modifieds.clear();
- }
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void save(Element element, String value) {
- checkConnexionInit();
- switch (element) {
- case connexion:
- config.setConnexionMode(mode);
- break;
- case login:
- if (mode == VCSConnexionMode.PASSWORD) {
- config.setLogin(value);
- }
- break;
- case nopassphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPassphrase(null);
- }
- break;
- case password:
- if (mode == VCSConnexionMode.PASSWORD) {
- config.setPassword(value);
- }
- case passphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPassphrase(value);
- }
- break;
- case privateKeyFile:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshPrivateKeyFile(new File(value));
- }
- break;
- case sshLogin:
- if (mode == VCSConnexionMode.SSH) {
- config.setSshLogin(value);
- }
- break;
- case workingCopyFile:
- config.setWorkingCopyFile(new File(value));
- break;
- }
- }
-
-
- protected void checkConnexionInit() throws IllegalStateException {
- if (config == null) {
- 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
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-14 16:59:17 UTC (rev 669)
@@ -2,6 +2,7 @@
<style source="config.css"/>
<script>
import static org.codelutin.vcs.type.VCSConnexionMode.*;
+ import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.action.*;
</script>
@@ -20,15 +21,15 @@
<JLabel id='loginLabel'/>
</cell>
<cell>
- <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
+ <JTextField id='login' onKeyReleased="doCheck(VCSConnexionConfigProperty.login)"/>
</cell>
</row>
<row fill='horizontal'>
<cell>
- <JLabel id='passwordLabel' labelFor='{password}'/>
+ <JLabel id='passwordLabel' labelFor='{passwordLabel}'/>
</cell>
<cell>
- <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
+ <JPasswordField id='password' onKeyReleased="doCheck(VCSConnexionConfigProperty.password)"/>
</cell>
</row>
</Table>
@@ -38,28 +39,28 @@
<JLabel id='sshLoginLabel'/>
</cell>
<cell>
- <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshLogin)"/>
+ <JTextField id='sshLogin' onKeyReleased="doCheck(VCSConnexionConfigProperty.sshLogin)"/>
</cell>
</row>
<row fill='horizontal'>
<cell>
- <JLabel id='passphraseLabel'/>
+ <JLabel id='sshPassphraseLabel'/>
</cell>
<cell>
<JToolBar opaque='false' borderPainted='false' height="24">
- <JCheckBox id='noPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)"/>
- <JPasswordField id='passphrase' onKeyReleased="doCheck(Element.passphrase)"
- enabled='{!noPassPhrase.isSelected()}'/>
+ <JCheckBox id='sshNoPassphrase' onActionPerformed="doCheck(VCSConnexionConfigProperty.sshNoPassphrase)"/>
+ <JPasswordField id='sshPassphrase' onKeyReleased="doCheck(VCSConnexionConfigProperty.sshPassphrase)"
+ enabled='{!sshNoPassphrase.isSelected()}'/>
</JToolBar>
</cell>
</row>
<row fill='horizontal'>
<cell>
- <JLabel id='privateKeyFileLabel'/>
+ <JLabel id='sshPrivateKeyFileLabel'/>
</cell>
<cell>
<JToolBar opaque='false' borderPainted='false' height="24">
- <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privateKeyFile)"/>
+ <JTextField id='sshPrivateKeyFile' onKeyReleased="doCheck(VCSConnexionConfigProperty.sshPrivateKeyFile)"/>
<JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
onActionPerformed="changePrivateKeyFile()"/>
</JToolBar>
@@ -75,7 +76,8 @@
<cell fill='both'/>
</row>
</Table>
- <JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/>
+ <JButton id='reset' action='{newAction(org.codelutin.ui.config.ResetAction.class,false)}' borderPainted='false'/>
+ <!--JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/-->
<JButton id='testConnection' action='{newAction(TestConnexionAction.class)}' borderPainted='false'/>
<JButton id='help' action='{newAction(HelpAction.class)}' borderPainted='false'/>
</JToolBar>
@@ -124,7 +126,7 @@
<cell columns="2" fill='horizontal'>
<JToolBar opaque='false' height="24">
<JLabel id='workingCopyFileLabel'/>
- <JTextField id='workingCopyFile' onKeyReleased="doCheck(Element.workingCopyFile)"/>
+ <JTextField id='workingCopyFile' onKeyReleased="doCheck(VCSConnexionConfigProperty.workingCopyFile)"/>
<JButton id='changeWorkingCopyFile' icon='{createActionIcon("filechooser")}'
onActionPerformed="changeWorkingCopyFile()"/>
</JToolBar>
@@ -132,10 +134,10 @@
</row>
<row fill='horizontal'>
<cell weightx='1'>
- <JButton id='ok' onActionPerformed="save()"/>
+ <JButton id='ok' action='{newAction(org.codelutin.ui.config.SaveAction.class,true)}'/>
</cell>
<cell weightx='1'>
- <JButton id='cancel' onActionPerformed="dispose()"/>
+ <JButton id='cancel' action='{newAction(org.codelutin.ui.config.CancelAction.class,true)}'/>
</cell>
</row>
</Table>
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-05-14 16:58:23 UTC (rev 668)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-05-14 16:59:17 UTC (rev 669)
@@ -61,15 +61,15 @@
text: "lutinvcs.config.server.password";
}
-#noPassPhraseLabel {
+#sshNoPassPhraseLabel {
text: "lutinvcs.config.server.ssh.no.passphrase";
}
-#passphraseLabel {
+#sshPassphraseLabel {
text: "lutinvcs.config.server.passphrase";
}
-#privateKeyFileLabel {
+#sshPrivateKeyFileLabel {
text: "lutinvcs.config.server.ssh.privateKeyFile";
}
1
0
r668 - trunk/lutinui/src/main/java/org/codelutin/ui/config
by tchemit@users.labs.libre-entreprise.org 14 May '08
by tchemit@users.labs.libre-entreprise.org 14 May '08
14 May '08
Author: tchemit
Date: 2008-05-14 16:58:23 +0000 (Wed, 14 May 2008)
New Revision: 668
Removed:
trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java
Log:
propri?\195?\169t?\195?\169 typ?\195?\169 + r?\195?\169cup?\195?\169ration
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java 2008-05-13 23:16:31 UTC (rev 667)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java 2008-05-14 16:58:23 UTC (rev 668)
@@ -24,7 +24,6 @@
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
-import java.util.Arrays;
/**
* A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
@@ -42,43 +41,53 @@
public abstract AbstractButton getCancel();
public JComponent getElement(E key) {
- return (JComponent) getObjectById(key.name());
+ Object id = getObjectById(key.name());
+ if (id == null) {
+ log.error(new NullPointerException("no widget for key "+key));
+ return null;
+ }
+ if (!(id instanceof JComponent)) {
+ throw new IllegalArgumentException(id + " is not a JComponent");
+ }
+ return (JComponent) id;
}
- public String getElementValue(E key) {
+ public Object getElementValue(E key) {
JComponent o = getElement(key);
if (o instanceof JPasswordField) {
- return Arrays.toString(((JPasswordField) o).getPassword());
+ return new String(((JPasswordField) o).getPassword());
}
if (o instanceof JTextField) {
return ((JTextField) o).getText();
}
if (o instanceof JRadioButton) {
- return String.valueOf(((JRadioButton) o).isSelected());
+ return ((JRadioButton) o).isSelected();
}
if (o instanceof JCheckBox) {
- return String.valueOf(((JCheckBox) o).isSelected());
+ return ((JCheckBox) o).isSelected();
}
if (o instanceof JComboBox) {
- return String.valueOf(((JComboBox) o).getSelectedItem());
+ return ((JComboBox) o).getSelectedItem();
}
return "";
}
public void setElementValue(E key, Object value) {
JComponent o = getElement(key);
+
+ String strValue = value == null ? "" : String.valueOf(value);
if (o instanceof JPasswordField) {
- ((JPasswordField) o).setText(value + "");
+ ((JPasswordField) o).setText(strValue);
}
if (o instanceof JTextField) {
- ((JTextField) o).setText(value + "");
+ ((JTextField) o).setText(strValue);
}
if (o instanceof JRadioButton) {
- ((JRadioButton) o).setSelected(Boolean.valueOf(value + ""));
+ ((JRadioButton) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
}
if (o instanceof JCheckBox) {
- ((JCheckBox) o).setSelected(Boolean.valueOf(value + ""));
+ ((JCheckBox) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
}
if (o instanceof JComboBox) {
((JComboBox) o).setSelectedItem(value);
@@ -93,5 +102,4 @@
getHandler().doCheck(key);
}
-
}
\ No newline at end of file
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java 2008-05-13 23:16:31 UTC (rev 667)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java 2008-05-14 16:58:23 UTC (rev 668)
@@ -15,13 +15,15 @@
package org.codelutin.ui.config;
import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.util.ConverterUtil;
+import org.codelutin.util.config.Config;
+import org.codelutin.util.config.Property;
import javax.swing.JComponent;
import java.awt.Color;
import java.beans.PropertyChangeEvent;
import java.util.EnumMap;
import java.util.EnumSet;
-import java.util.Map;
/**
* DialogUI handler
@@ -30,8 +32,6 @@
*/
public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E, ?>, U extends DialogConfigUI<E, ?>> extends DialogUIHandler<M, U> {
- protected ModifyAction<E, ? extends DialogConfigUIHandler<E, ?, ?>> modifyAction;
-
protected DialogConfigUIHandler(U ui, M model) {
super(ui, model);
}
@@ -46,7 +46,7 @@
// update ui with model values,
populateUI();
// revalidate form
- doCheck(null);
+ doCheckAll();
return;
}
@@ -67,22 +67,75 @@
}
public void doCheck(E key) {
- if (key == null) {
- getModifyAction().doCheckAll();
+ Object uiValue = getUi().getElementValue(key);
+ DialogConfigUIModel<E, ?> model = getModel();
+ Object currentValue = model.getCurrent().getProperty(key);
+ if (currentValue == null) {
+ currentValue = "";
} else {
- getModifyAction().doCheck(key);
+ currentValue = String.valueOf(currentValue);
}
+
+ model.validateProperty(key, uiValue);
+ model.changeModifiedState(key, uiValue, currentValue);
}
+ public void doCheckAll() {
+ DialogConfigUIModel<E, ?> model = getModel();
+ EnumSet<E> unvalids = EnumSet.noneOf(model.klass);
+ for (E e : model.getCheckedKeysSet()) {
+ Object uiValue = getUi().getElementValue(e);
+ if (!model.isValid(e, uiValue)) {
+ unvalids.add(e);
+ }
+ }
+ model.setUnvalids(unvalids);
+ unvalids.clear();
+ }
+
+ protected boolean prepareSave() {
+ DialogConfigUI<E, ?> ui = getUi();
+ DialogConfigUIModel<E, ?> model = getModel();
+
+ Config<E> current = model.getCurrent();
+
+ if (!model.isConfigValid()) {
+ log.warn("do not save a unvalid config : " + model.getUnvalids());
+ return false;
+ }
+
+ if (!model.isModified()) {
+ log.warn("nothing to save");
+ return false;
+ }
+ EnumSet<E> toTreate = model.getCheckedKeysSet();
+ // transfert checkable values from ui to model
+ for (E key : model.getModifieds()) {
+ if (!toTreate.contains(key)) {
+ continue;
+ }
+ Object value = ui.getElementValue(key);
+ Class<?> type = ((Property) key).getType();
+ Object newValue = ConverterUtil.convert(type, value);
+ current.setProperty(key, newValue);
+ }
+
+ return true;
+ }
+
protected void populateUI() {
U ui = getUi();
- M model = getModel();
- EnumMap<E, Object> map = model.getCurrent().getProperties();
- for (Map.Entry<E, Object> entry : map.entrySet()) {
- ui.setElementValue(entry.getKey(), entry.getValue());
+ EnumMap<E, Object> map = getModel().getCurrent().getProperties();
+ for (E e : getModel().getCheckedKeysSet()) {
+ Object value = map.get(e);
+ populateUI(ui, e, value);
}
}
+ protected void populateUI(U ui, E key, Object value) {
+ ui.setElementValue(key, value);
+ }
+
protected void updateUI() {
EnumSet<E> unvalids = getModel().getUnvalids();
for (E key : unvalids) {
@@ -100,12 +153,4 @@
}
}
- protected ModifyAction<E, ? extends DialogConfigUIHandler<E, ?, ?>> getModifyAction() {
- if (modifyAction == null) {
- modifyAction = new ModifyAction<E, DialogConfigUIHandler<E, ?, ?>>(getUi().getHandler().getUi());
- }
- return modifyAction;
- }
-
-
}
\ No newline at end of file
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-13 23:16:31 UTC (rev 667)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-14 16:58:23 UTC (rev 668)
@@ -56,8 +56,15 @@
/** set of unvalid properties */
protected EnumSet<E> unvalids;
+ /** enum class */
protected Class<E> klass;
+ /** set of key not to check */
+ protected EnumSet<E> uncheckedKeys;
+
+ /** set of all keys checkable */
+ protected EnumSet<E> checkedKeysSet;
+
protected DialogConfigUIModel(Class<E> klass) {
this.klass = klass;
this.current = newConfig();
@@ -65,6 +72,17 @@
this.unvalids = EnumSet.noneOf(klass);
}
+ public EnumSet<E> getCheckedKeysSet() {
+ if (checkedKeysSet == null) {
+ if (uncheckedKeys != null) {
+ checkedKeysSet = EnumSet.complementOf(uncheckedKeys);
+ } else {
+ checkedKeysSet = EnumSet.allOf(klass);
+ }
+ }
+ return checkedKeysSet;
+ }
+
public Object getSrc() {
return src;
}
@@ -131,23 +149,23 @@
}
public void removeModified(EnumSet<E> keys) {
- for (E elementname : keys) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
+ for (E key : keys) {
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
}
}
setModified(!modifieds.isEmpty());
}
- public void addUnvalid(EnumSet<E> keys) {
- for (E name : keys) {
- if (!unvalids.contains(name)) {
- unvalids.add(name);
+ public void setUnvalids(EnumSet<E> keys) {
+ for (E key : keys) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
}
}
- for (E name : EnumSet.complementOf(keys)) {
- if (unvalids.contains(name)) {
- unvalids.remove(name);
+ for (E key : EnumSet.complementOf(keys)) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
}
}
setUnvalid(!unvalids.isEmpty());
@@ -174,4 +192,26 @@
// redisplay config
firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
+
+ public void changeModifiedState(E key, Object uiValue, Object currentValue) {
+ if (uiValue.equals(currentValue)) {
+ removeModified(key);
+ } else {
+ addModified(key);
+ }
+ }
+
+ public void clear(E key) {
+ log.info(key);
+ modifieds.remove(key);
+ unvalids.remove(key);
+ }
+
+ protected void validateProperty(E key, Object uiValue) {
+ if (isValid(key, uiValue)) {
+ removeUnvalid(key);
+ } else {
+ addUnvalid(key);
+ }
+ }
}
\ No newline at end of file
Deleted: trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java 2008-05-13 23:16:31 UTC (rev 667)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java 2008-05-14 16:58:23 UTC (rev 668)
@@ -1,109 +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.ui.config;
-
-import org.codelutin.ui.AbstractUIAction;
-
-import java.awt.event.ActionEvent;
-import java.util.EnumSet;
-
-/** @author chemit */
-public class ModifyAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
-
- private static final long serialVersionUID = 1L;
-
- protected transient Boolean checkAll;
-
- protected transient E key;
-
- protected transient String uiValue;
-
- protected transient Object currentValue;
-
- protected transient EnumSet<E> unvalids;
-
- public ModifyAction(DialogConfigUI<E, ? extends H> dialogUI) {
- super(null, null, dialogUI);
- }
-
- public void doCheckAll() {
- if (unvalids == null) {
- unvalids = EnumSet.noneOf(getHandler().getModel().klass);
- }
- checkAll = true;
- try {
- for (E e : getHandler().getModel().getCurrent().getUniverse()) {
- doCheck(e);
- }
- getHandler().getModel().addUnvalid(unvalids);
- } finally {
- unvalids.clear();
- this.key = null;
- this.uiValue = null;
- this.currentValue = null;
- this.checkAll = null;
- }
- }
-
- public void doCheck(E key) {
- this.key = key;
- this.uiValue = getHandler().getUi().getElementValue(key);
- DialogConfigUIModel<E, ?> model = getHandler().getModel();
- Object currentValue = model.getCurrent().getProperty(key);
- if (currentValue == null) {
- currentValue = "";
- }
- this.currentValue = String.valueOf(currentValue);
- if (checkAll!=null && checkAll) {
- if (!model.isValid(key, uiValue)) {
- unvalids.add(key);
- }
- } else {
- actionPerformed(new ActionEvent(getHandler().getUi().getElement(key), 0, "modify-" + key.name()));
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- try {
- DialogConfigUIModel<E, ?> model = getHandler().getModel();
-
- validateProperty(model);
-
- changeModifiedState(model);
-
- } finally {
- this.key = null;
- this.uiValue = null;
- this.currentValue = null;
- this.checkAll = null;
- }
- }
-
- public void changeModifiedState(DialogConfigUIModel<E, ?> model) {
- if (uiValue.equals(currentValue)) {
- model.removeModified(key);
- } else {
- model.addModified(key);
- }
- }
-
- protected void validateProperty(DialogConfigUIModel<E, ?> model) {
- if (model.isValid(key, uiValue)) {
- model.removeUnvalid(key);
- } else {
- model.addUnvalid(key);
- }
- }
-}
\ No newline at end of file
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java 2008-05-13 23:16:31 UTC (rev 667)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java 2008-05-14 16:58:23 UTC (rev 668)
@@ -17,7 +17,6 @@
import org.codelutin.ui.AbstractUIAction;
import org.codelutin.ui.DialogUI;
import org.codelutin.ui.UIHelper;
-import org.codelutin.util.config.Config;
import java.awt.event.ActionEvent;
@@ -35,33 +34,17 @@
}
String libelle = org.codelutin.i18n.I18n._("lutinui.config.save.tooltip");
putValue(SHORT_DESCRIPTION, libelle);
-
}
public void actionPerformed(ActionEvent e) {
- H handler = getHandler();
- DialogConfigUI<E, ?> ui = handler.getUi();
- DialogConfigUIModel<E, ?> model = handler.getModel();
- Config<E> current = model.getCurrent();
- if (!model.isConfigValid()) {
- log.warn("do not save a unvalid config : " + model.getUnvalids());
- return;
- }
+ if (getHandler().prepareSave()) {
- if (!model.isModified()) {
- log.warn("nothing to save");
- return;
- }
- // transfert values from ui to model
- for (E key : model.getModifieds()) {
- String value = ui.getElementValue(key);
- current.setProperty(key, value);
- }
- // save model to src
- model.save();
+ // save model to src
+ getHandler().getModel().save();
- // close ui
- ui.dispose();
+ // close ui
+ getUi().dispose();
+ }
}
}
1
0
r667 - in trunk/lutinvcs/ui/jaxx/src/main/resources/icons: . unused
by tchemit@users.labs.libre-entreprise.org 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
Author: tchemit
Date: 2008-05-13 23:16:31 +0000 (Tue, 13 May 2008)
New Revision: 667
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/locally_mod.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/loop.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified-badge.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/newFile24.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/password_field_32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/paste.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/recent_messages.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/refresh2.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/remove.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save24.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types_disabled.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/server.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/versioning-view.png
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/locally_mod.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/loop.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified-badge.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/newFile24.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/password_field_32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/paste.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/recent_messages.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/refresh2.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/remove.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save24.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types_disabled.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/server.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/versioning-view.png
Log:
unused icons
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/locally_mod.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/loop.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified-badge.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/newFile24.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/password_field_32.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/paste.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/recent_messages.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/refresh2.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/remove.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save24.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types_disabled.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/server.png
===================================================================
(Binary files differ)
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/locally_mod.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/locally_mod.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/locally_mod.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/loop.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/loop.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/loop.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified-badge.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified-badge.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified-badge.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/modified.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/newFile24.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/newFile24.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/newFile24.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/password_field_32.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/password_field_32.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/password_field_32.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/paste.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/paste.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/paste.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/recent_messages.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/recent_messages.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/recent_messages.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/refresh2.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/refresh2.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/refresh2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/remove.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/remove.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/remove.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save24.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/save24.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/save24.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types_disabled.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/search_types_disabled.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/search_types_disabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/server.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/server.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/server.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/versioning-view.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/versioning-view.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/versioning-view.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/versioning-view.png
===================================================================
(Binary files differ)
1
0
r666 - trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
Author: tchemit
Date: 2008-05-13 23:11:58 +0000 (Tue, 13 May 2008)
New Revision: 666
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java
Log:
suppress generic warning
Modified: 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 2008-05-13 23:11:26 UTC (rev 665)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java 2008-05-13 23:11:58 UTC (rev 666)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.vcs.ui;
@@ -32,6 +32,7 @@
import java.awt.event.ActionEvent;
/** @author chemit */
+@SuppressWarnings({"unchecked"})
public class UIActionHelper {
public static void showSynchUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSEntry[] entries, String position) {
1
0
r665 - in trunk/lutinvcs/ui: common/src/main/java/org/codelutin/vcs/ui common/src/main/java/org/codelutin/vcs/ui/handler common/src/main/java/org/codelutin/vcs/ui/model jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
Author: tchemit
Date: 2008-05-13 23:11:26 +0000 (Tue, 13 May 2008)
New Revision: 665
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/IdentityUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/IdentityUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/IdentityUIModel.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx
Log:
use generic config dialog for identity
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/IdentityUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/IdentityUI.java 2008-05-13 23:08:48 UTC (rev 664)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/IdentityUI.java 2008-05-13 23:11:26 UTC (rev 665)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,104 +10,15 @@
* 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.ui.FormElement;
+import org.codelutin.ui.config.DialogConfigUI;
+import org.codelutin.util.config.IdentityConfigProperty;
import org.codelutin.vcs.ui.handler.IdentityUIHandler;
-import javax.swing.AbstractButton;
-import javax.swing.JCheckBox;
-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 IdentityUI extends DialogUI<IdentityUIHandler> {
+public abstract class IdentityUI extends DialogConfigUI<IdentityConfigProperty, IdentityUIHandler> {
- public enum Element implements FormElement<IdentityUI> {
- firstName,
- lastName,
- email;
-
- public Object getValue(IdentityUI ui) {
- return ui.getElementValue(this);
- }
-
- public void setValue(IdentityUI ui, String value) {
- //TODO
- JComponent component = ui.getElement(this);
- }
-
- public JLabel getLabel(IdentityUI ui) {
- return ui.getElementLabel(this);
- }
- }
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
-
- 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 JTextField getFirstName();
-
- public abstract JTextField getLastName();
-
- public abstract JTextField getEmail();
-
- public abstract JLabel getFirstNameLabel();
-
- public abstract JLabel getLastNameLabel();
-
- public abstract JLabel getEmailLabel();
-
- public boolean isConfigValid() {
- return getHandler().isConfigValid();
- }
-
- protected void reset() {
- getHandler().reset();
- }
-
- protected void save() {
- getHandler().save();
- dispose();
- }
-
- protected void doCheck(Element element) {
- getHandler().doCheck(element);
- }
-
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/IdentityUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/IdentityUIHandler.java 2008-05-13 23:08:48 UTC (rev 664)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/IdentityUIHandler.java 2008-05-13 23:11:26 UTC (rev 665)
@@ -14,149 +14,17 @@
*/
package org.codelutin.vcs.ui.handler;
-import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.config.DialogConfigUIHandler;
+import org.codelutin.util.config.IdentityConfigProperty;
import org.codelutin.vcs.ui.IdentityUI;
-import static org.codelutin.vcs.ui.IdentityUI.Element;
-import static org.codelutin.vcs.ui.IdentityUI.Element.email;
-import static org.codelutin.vcs.ui.IdentityUI.Element.firstName;
-import static org.codelutin.vcs.ui.IdentityUI.Element.lastName;
-import static org.codelutin.vcs.ui.IdentityUI.Element.values;
import org.codelutin.vcs.ui.model.IdentityUIModel;
-import javax.swing.JComponent;
-import javax.swing.text.JTextComponent;
-import java.awt.Color;
-import java.beans.PropertyChangeEvent;
-import java.util.ArrayList;
-import java.util.List;
-
/** @author chemit */
-public class IdentityUIHandler extends DialogUIHandler<IdentityUIModel, IdentityUI> {
+public class IdentityUIHandler extends DialogConfigUIHandler<IdentityConfigProperty, IdentityUIModel, IdentityUI> {
- protected List<Element> errors;
-
- public IdentityUIHandler(IdentityUI ui,IdentityUIModel model) {
+ public IdentityUIHandler(IdentityUI ui, IdentityUIModel model) {
super(ui, model);
ui.setHandler(this);
- errors = new ArrayList<Element>();
}
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
-
- if (IdentityUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI((IdentityUIModel) evt.getNewValue());
- doCheck(null);
- return;
- }
-
- if (IdentityUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean modified = newValue != null && newValue;
- getUi().getReset().setEnabled(modified);
- return;
- }
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
-
- public synchronized List<Element> validateModel(Element element) {
- errors.clear();
- IdentityUI ui = getUi();
- if (element != null) {
- // compute modifed
- setModified(element, ui);
- }
- checkData(ui.getFirstName(), firstName);
- checkData(ui.getLastName(), lastName);
- checkData(ui.getEmail(), email);
-
- return errors;
- }
-
- public void setModified(Element element, IdentityUI ui) {
- boolean modify = false;
- IdentityUIModel model = getModel();
-
- String value = ui.getElementValue(element);
-
- switch (element) {
- case email:
- modify = !model.getCurrent().getEmail().equals(value);
- break;
- case firstName:
- modify = !model.getCurrent().getFirstName().equals(value);
- break;
- case lastName:
- modify = !model.getCurrent().getLastName().equals(value);
- break;
- }
- if (modify) {
- model.addModified(element);
- } else if (model.getModifieds().contains(element)) {
- model.removeModified(element);
- }
- }
-
- public void doCheck(Element element) {
- List<Element> errors = validateModel(element);
- updateUI(errors);
- }
-
- public boolean isConfigValid() {
- return errors.isEmpty();
- }
-
- public void reset() {
- getModel().reset();
- }
-
- protected void populateUI(IdentityUIModel model) {
- IdentityUI ui = getUi();
- ui.getFirstName().setText(model.getCurrent().getFirstName());
- ui.getLastName().setText(model.getCurrent().getLastName());
- ui.getEmail().setText(model.getCurrent().getEmail());
- }
-
- protected void updateUI(List<Element> errors) {
- IdentityUI ui = getUi();
- boolean valid = isConfigValid();
- ui.getOk().setEnabled(valid && getModel().isModified());
- for (Element element : values()) {
- setLabelColor(errors, element);
- }
- }
-
- protected void checkData(JTextComponent component, Element errorName) {
- if (component.getText().isEmpty()) {
- errors.add(errorName);
- }
- }
-
- protected void checkData(boolean notValid, Element errorName) {
- if (notValid) {
- errors.add(errorName);
- }
- }
-
- protected void setLabelColor(List<Element> errors, Element element) {
- JComponent component = getUi().getElementLabel(element);
- if (component != null && component.isVisible()) {
- component.setForeground(errors.contains(element) ? Color.red : Color.black);
- }
- }
-
- public void save() {
- if (!getModel().isModified()) {
- log.warn("nothing to save");
- }
- for (Element element : getModel().getModifieds()) {
- String value = getUi().getElementValue(element);
- getModel().save(element, value);
- log.info("save " + element);
- }
- }
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/IdentityUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/IdentityUIModel.java 2008-05-13 23:08:48 UTC (rev 664)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/IdentityUIModel.java 2008-05-13 23:11:26 UTC (rev 665)
@@ -15,104 +15,39 @@
package org.codelutin.vcs.ui.model;
-import org.apache.commons.beanutils.BeanUtils;
-import org.codelutin.ui.DialogUIModel;
+import org.codelutin.ui.config.DialogConfigUIModel;
import org.codelutin.util.config.IdentityConfig;
import org.codelutin.util.config.IdentityConfigProperty;
-import org.codelutin.vcs.VCSConfigFactory;
-import org.codelutin.vcs.ui.IdentityUI.Element;
+import org.codelutin.util.config.SimpleIdentityConfig;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
/**
- * Model of a a confirmation of action on entries (single type of action possible)
+ * Model of Identity configuration edit ui
*
* @author chemit
*/
-public class IdentityUIModel extends DialogUIModel {
+public class IdentityUIModel extends DialogConfigUIModel<IdentityConfigProperty, IdentityConfig> {
- public static final String CONFIG_PROPERTY_CHANGED = "config";
- public static final String MODIFIED_PROPERTY_CHANGED = "modify";
-
- protected Object src;
-
- protected IdentityConfig current;
- protected EnumSet<IdentityConfigProperty> mods;
-
- protected List<Element> modifieds;
-
public IdentityUIModel() {
- mods = EnumSet.noneOf(IdentityConfigProperty.class);
-
- modifieds = new ArrayList<Element>();
- current = VCSConfigFactory.newIdentity(null, null, null);
+ super(IdentityConfigProperty.class);
}
- public void populate(Object src) {
- this.src = src;
- this.current.copyFrom(src);
-
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ protected IdentityConfig newConfig() {
+ return new SimpleIdentityConfig();
}
- public void reset() {
- populate(src);
- }
-
- public IdentityConfig getCurrent() {
- return current;
- }
-
- public boolean isModified() {
- return !modifieds.isEmpty();
- }
-
- public List<Element> getModifieds() {
- return modifieds;
- }
-
- public void addModified(Element elementname) {
- if (!modifieds.contains(elementname)) {
- modifieds.add(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(Element... elementnames) {
- for (Element elementname : elementnames) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
- }
- setModified(!modifieds.isEmpty());
- }
-
- }
-
- public void setModified(boolean modified) {
- if (!modified) {
- modifieds.clear();
- }
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void save(Element element, String value) {
- switch (element) {
+ protected boolean isValid(IdentityConfigProperty key, Object value) {
+ // each propertie can not be null, nor empty
+ boolean result = value != null && !String.valueOf(value).isEmpty();
+ switch (key) {
case email:
+ //TODO Check email validity
+ break;
case firstName:
case lastName:
- try {
- BeanUtils.setProperty(src, element.name(), value);
- } catch (IllegalAccessException e) {
- throw new IllegalStateException(e);
- } catch (InvocationTargetException e) {
- throw new IllegalStateException(e);
- }
+ // nothing more to check
break;
}
+ return result;
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx 2008-05-13 23:08:48 UTC (rev 664)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx 2008-05-13 23:11:26 UTC (rev 665)
@@ -1,4 +1,5 @@
<IdentityUI modal='true' resizable='false'>
+ <script>import org.codelutin.util.config.IdentityConfigProperty;</script>
<style source="config.css"/>
<JToolBar id='identityHead' opaque='false'>
<JLabel text='lutinvcs.identity.message'/>
@@ -7,7 +8,7 @@
<cell fill='both'/>
</row>
</Table>
- <JButton id='reset' icon='{org.codelutin.ui.UIHelper.createActionIcon("revert")}' onActionPerformed="reset()" borderPainted='false'/>
+ <JButton id='reset' action='{newAction(org.codelutin.ui.config.ResetAction.class,false)}' borderPainted='false'/>
<JButton id='help' action='{newAction(org.codelutin.vcs.ui.action.HelpAction.class)}' borderPainted='false'/>
</JToolBar>
<Table fill='both' insets="1,1,1,1">
@@ -20,7 +21,7 @@
<JLabel id='firstNameLabel'/>
</cell>
<cell>
- <JTextField id='firstName' onKeyReleased="doCheck(Element.firstName)"/>
+ <JTextField id='firstName' onKeyReleased="doCheck(IdentityConfigProperty.firstName)"/>
</cell>
</row>
<row fill='horizontal'>
@@ -28,7 +29,7 @@
<JLabel id='lastNameLabel'/>
</cell>
<cell>
- <JTextField id='lastName' onKeyReleased="doCheck(Element.lastName)"/>
+ <JTextField id='lastName' onKeyReleased="doCheck(IdentityConfigProperty.lastName)"/>
</cell>
</row>
<row fill='horizontal'>
@@ -36,7 +37,7 @@
<JLabel id='emailLabel'/>
</cell>
<cell>
- <JTextField id='email' onKeyReleased="doCheck(Element.email)"/>
+ <JTextField id='email' onKeyReleased="doCheck(IdentityConfigProperty.email)"/>
</cell>
</row>
</Table>
@@ -45,10 +46,10 @@
</row>
<row fill='horizontal'>
<cell weightx='1'>
- <JButton id='ok' onActionPerformed="save()"/>
+ <JButton id='ok' action='{newAction(org.codelutin.ui.config.SaveAction.class,true)}'/>
</cell>
<cell weightx='1'>
- <JButton id='cancel' onActionPerformed="dispose()"/>
+ <JButton id='cancel' action='{newAction(org.codelutin.ui.config.CancelAction.class,true)}'/>
</cell>
</row>
</Table>
1
0
r664 - trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused
by tchemit@users.labs.libre-entreprise.org 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
Author: tchemit
Date: 2008-05-13 23:08:48 +0000 (Tue, 13 May 2008)
New Revision: 664
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-cancel-config.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-save-config.png
Log:
unused icons
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-cancel-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-cancel-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-save-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/action-save-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
r663 - trunk/lutinui/src/main/java/org/codelutin/ui/config
by tchemit@users.labs.libre-entreprise.org 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
Author: tchemit
Date: 2008-05-13 23:08:30 +0000 (Tue, 13 May 2008)
New Revision: 663
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
Log:
use EnumSet instead of E... (since generic array creation throw unchecked...)
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-13 23:03:22 UTC (rev 662)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-13 23:08:30 UTC (rev 663)
@@ -122,7 +122,15 @@
setModified(!modifieds.isEmpty());
}
- public void removeModified(E... keys) {
+ public void removeModified(E key) {
+
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(EnumSet<E> keys) {
for (E elementname : keys) {
if (modifieds.contains(elementname)) {
modifieds.remove(elementname);
1
0