Author: tchemit Date: 2008-04-15 08:46:45 +0000 (Tue, 15 Apr 2008) New Revision: 521 Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java Log: mise en place ui de config Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx =================================================================== --- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx (rev 0) +++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JVCSGenerateSshKey.jaxx 2008-04-15 08:46:45 UTC (rev 521) @@ -0,0 +1,148 @@ +<JDialog title='isisfish.server.ssh.generateKey.title' modal='true'> + <script> + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; + + import java.io.File; + import java.io.IOException; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.HashMap; + import java.util.Map; + + static protected final Log log = LogFactory.getLog(JVCSGenerateSshKey.class); + + private static JVCSGenerateSshKey instance; + + public static JVCSGenerateSshKey getInstance(JDialog parent) { + if (instance == null) { + instance = new JVCSGenerateSshKey(parent); + } + return instance; + } + + /*import com.sshtools.j2ssh.transport.publickey.OpenSSHPublicKeyFormat; + import com.sshtools.j2ssh.transport.publickey.SshKeyGenerator; + import org.codelutin.util.FileUtil;*/ + + public boolean cancel; + public boolean noPassPhrase; + public Exception error; + protected boolean invalidPassPhrase; + protected String vcsLogin; + + private JVCSGenerateSshKey(JDialog instance) { + super(instance); + // block close operation + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + } + + public void setData(String vcsLogin, File privateKeyFile) { + this.vcsLogin = vcsLogin ; + serverPrivateKeyFile.setText(privateKeyFile.getAbsolutePath()); + serverPublicKeyFile.setText(privateKeyFile.getAbsolutePath() + ".pub"); + noPassPhrase=true; + error=null; + doCheck(); + } + + protected boolean doGenerate() { + /*File f = new File(getServerPrivateKeyFile().getText()); + try { + SshKeyGenerator sshkeygenerator = new SshKeyGenerator(); + char[] password = getServerPassPhrase().getPassword(); + noPassPhrase=password.length==0; + if (password.length > 0) { + sshkeygenerator.generateKeyPair("dsa", 1024, f.getAbsolutePath(), vcsLogin, Arrays.toString(password)); + Arrays.fill(password, '0'); + } else { + sshkeygenerator.generateKeyPair("dsa", 1024, f.getAbsolutePath(), vcsLogin, ""); + } + // convert to openSSH ? + File publicKeyFile = new File(serverPublicKeyFile.getText()); + log.info("public key before OpenSsh : "+ FileUtil.readAsString(publicKeyFile)); + String openSshPublicKey = SshKeyGenerator.convertPublicKeyFile(publicKeyFile, new + OpenSSHPublicKeyFormat(vcsLogin + "@forIsisFish 1024-bit dsa")); + log.info("public key OpenSsh : "+openSshPublicKey); + FileUtil.writeString(publicKeyFile, openSshPublicKey); + } catch (Exception e) { + error=e; + return true; + }*/ + return false; + } + protected boolean check() { + invalidPassPhrase=!Arrays.equals(serverPassPhrase.getPassword(),serverConfirmPassPhrase.getPassword()); + return !invalidPassPhrase; + } + + protected void doCheck() { + ok.setEnabled(check()); + setColor(invalidPassPhrase, serverPassPhraseLabel); + setColor(invalidPassPhrase, serverConfirmPassPhraseLabel); + } + + protected void setColor(boolean invalid, JComponent component) { + component.setForeground(invalid ? Color.red: Color.black); + } + </script> + <Table> + <row fill='horizontal'> + <cell> + <JToolBar id='top'> + <JLabel id="actionLabel"/> + <Table fill='both' insets='0,0,0,0'> + <row> + <cell fill='both'/> + </row> + </Table> + <!--JSeparator orientation="vertical"/--> + <JButton id='help'/> + <!--JButton id='help' action='{createHelpAction()}'/--> + </JToolBar> + + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel text='lutinvcs.config.server.ssh.privateKeyFile'/> + </cell> + <cell> + <JTextField id='serverPrivateKeyFile' font-size='12' editable='false' columns='28' height='25'/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel text='lutinvcs.config.server.ssh.publicKeyFile'/> + </cell> + <cell> + <JTextField id='serverPublicKeyFile' font-size='12' editable='false' columns='28' height='25'/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverPassPhraseLabel' text='lutinvcs.config.server.ssh.passphrase'/> + </cell> + <cell> + <JPasswordField id='serverPassPhrase' onKeyReleased="doCheck()"/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverConfirmPassPhraseLabel' text='lutinvcs.config.server.ssh.confirm.passphrase'/> + </cell> + <cell> + <JPasswordField id='serverConfirmPassPhrase' onKeyReleased="doCheck()"/> + </cell> + </row> + <row fill='horizontal'> + <cell columns="2"> + <JPanel layout='{new GridLayout(0, 2, 2, 2)}'> + <JButton id='ok' text='lutinvcs.apply' enabled='false' + onActionPerformed="cancel = doGenerate();dispose()"/> + <JButton id='cancelAction' text='lutinvcs.cancel' onActionPerformed="cancel = true;dispose()"/> + </JPanel> + </cell> + </row> + </Table> +</JDialog> Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx =================================================================== --- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx (rev 0) +++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-15 08:46:45 UTC (rev 521) @@ -0,0 +1,120 @@ +<ConfigUI title='lutinvcs.config.title' resizable='false'> + <style source="config.css"/> + <script>import static org.codelutin.vcs.type.VCSConnexionMode.*;</script> + <JToolBar id='top'> + <JLabel text='lutinvcs.config.message'/> + <Table fill='both' insets='0,0,0,0'> + <row> + <cell fill='both'/> + </row> + </Table> + <JButton id='help' action='{createHelpAction()}'/> + </JToolBar> + <Table fill='both' insets="1,1,1,1"> + <row fill='horizontal'> + <cell columns='2'> + <JScrollPane height="60" columnHeaderView='{top}'> + <JEditorPane id="doc"/> + </JScrollPane> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='firstnameLabel'/> + </cell> + <cell> + <JTextField id='firstname' onKeyReleased="doCheck(Element.firstname)"/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='lastnameLabel'/> + </cell> + <cell> + <JTextField id='lastname' onKeyReleased="doCheck(Element.lastname)"/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='emailLabel'/> + </cell> + <cell> + <JTextField id='email' onKeyReleased="doCheck(Element.email)"/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel width='150' height='20' id='serverAuthenticationMethodLabel'/> + </cell> + <cell> + <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> + <JRadioButton id='serverAuthenticationMethodAnonymous' value='anonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/> + <JRadioButton id='serverAuthenticationMethodPassword' value='pass' onActionPerformed="changeAutheticationMode(PASSWORD)"/> + <JRadioButton id='serverAuthenticationMethodSsh' value='ssh' onActionPerformed="changeAutheticationMode(SSH)"/> + </JPanel> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverLoginLabel' visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/> + </cell> + <cell> + <JTextField id='serverLogin' onKeyReleased="doCheck(Element.login)" visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverPasswordLabel' visible='{serverAuthenticationMethodPassword.isSelected()}'/> + </cell> + <cell> + <JPasswordField id='serverPassword' visible='{serverAuthenticationMethodPassword.isSelected()}' onKeyReleased="doCheck(Element.password)"/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverLoginNoPassPhraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/> + </cell> + <cell> + <JCheckBox id='serverNoPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}'/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverPassphraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/> + </cell> + <cell> + <JPasswordField id='serverPassphrase' onKeyReleased="doCheck(Element.passphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JLabel id='serverPrivateKeyFileLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/> + </cell> + <cell> + <JTextField id='serverPrivateKeyFile' onKeyReleased="doCheck(Element.privatekey)" visible='{serverAuthenticationMethodSsh.isSelected()}'/> + </cell> + </row> + <row fill='horizontal'> + <cell columns="2"> + <JToolBar> + <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> + <JButton id='serverPrivateKeyChangeFile' text='lutinvcs.config.server.ssh.key.change' visible='{serverAuthenticationMethodSsh.isSelected()}' onActionPerformed="changePrivateKeyFile()"/> + <JButton id='serverPrivateKeyGenerate' text='lutinvcs.config.server.ssh.key.generate' visible='{serverAuthenticationMethodSsh.isSelected()}'/> + <JButton id='testConnection' text='lutinvcs.config.test'/> + </JPanel> + </JToolBar> + </cell> + </row> + <row fill='horizontal'> + <cell columns="2"> + <JToolBar> + <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> + <JButton id='ok' text='lutinvcs.apply' onActionPerformed="save();"/> + <JButton id='reset' text='lutinvcs.reset' onActionPerformed="reset();"/> + <JButton id='cancelAction' text='lutinvcs.cancel' onActionPerformed="dispose();"/> + </JPanel> + </JToolBar> + </cell> + </row> + </Table> +</ConfigUI> Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx =================================================================== --- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-15 08:46:05 UTC (rev 520) +++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxSynchUI.jaxx 2008-04-15 08:46:45 UTC (rev 521) @@ -36,6 +36,7 @@ <JButton id='addAll' action='{createAction(ADD,false)}'/> <JButton id='deleteAll' action='{createAction(DELETE,false)}'/> <JSeparator orientation="vertical"/> + <JButton id='config' action='{createShowConfigAction()}'/> <JButton id='help' action='{createHelpAction()}'/> </JToolBar> </cell> Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java =================================================================== --- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-15 08:46:05 UTC (rev 520) +++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-15 08:46:45 UTC (rev 521) @@ -18,6 +18,6 @@ public class JaxxVCSUIProvider extends VCSUIProvider { public JaxxVCSUIProvider() { - super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxChangelogUI.class,JaxxConfirmUI.class); + super("jaxx", JaxxSynchUI.class, JaxxDiffUI.class, JaxxChangelogUI.class,JaxxConfirmUI.class,JaxxConfigUI.class); } } \ No newline at end of file Copied: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css (from rev 518, trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css) =================================================================== --- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css (rev 0) +++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-15 08:46:45 UTC (rev 521) @@ -0,0 +1,69 @@ +JToolBar { + floatable: false; + focusable: false; + margin: 0; +} + +JButton { + margin: 0; /*font-size:10;*/ +} + +JTextField { + columns: 30; +} + +#top, #help { + borderPainted: false; + opaque: false; +} + +#serverPrivateKeyFileLabel { + text: "lutinvcs.config.server.ssh.privateKeyFile"; +} + +#serverLoginNoPassPhraseLabel { + text: "lutinvcs.config.server.ssh.no.passphrase"; +} + +#serverLoginLabel { + text: "lutinvcs.config.server.login"; +} + +#firstnameLabel { + text: "lutinvcs.config.firstname"; +} + +#lastnameLabel { + text: "lutinvcs.config.lastname"; +} + +#emailLabel { + text: "lutinvcs.config.email"; +} + +#serverAuthenticationMethodLabel { + text: "lutinvcs.config.server.authenticationMethod"; +} + +#serverPasswordLabel { + text: "lutinvcs.config.server.password"; +} + +#serverPassphraseLabel { + text: "lutinvcs.config.server.passphrase"; +} + +#serverAuthenticationMethodAnonymous { + text: "lutinvcs.config.anonymous"; + buttonGroup: "serverMethod"; +} + +#serverAuthenticationMethodPassword { + text: "lutinvcs.config.pass"; + buttonGroup: "serverMethod"; +} + +#serverAuthenticationMethodSsh { + text: "lutinvcs.config.ssh"; + buttonGroup: "serverMethod"; +}