Buix-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r682 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . util/ui
by tchemit@users.labs.libre-entreprise.org May 26, 2008
by tchemit@users.labs.libre-entreprise.org May 26, 2008
May 26, 2008
Author: tchemit
Date: 2008-05-26 09:43:05 +0000 (Mon, 26 May 2008)
New Revision: 682
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java
Log:
VCSThreadListener must be add when ui is activated (for synchUI),
now in common class AbstractTabUI
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-05-26 07:43:57 UTC (rev 681)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-05-26 09:43:05 UTC (rev 682)
@@ -19,7 +19,6 @@
import javax.swing.AbstractButton;
import javax.swing.JPopupMenu;
-import java.awt.event.WindowEvent;
/** @author chemit */
public abstract class SynchUI extends AbstractTabUI<SynchUIHandler> {
@@ -54,19 +53,24 @@
public abstract JPopupMenu getPopup();
- @Override
+ /*@Override
public void windowOpened(WindowEvent e) {
- if (getHandler().isUseThreadListener()) {
- // add action manager listener
- getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
- }
+ addVCSActionThreadEventListener();
}
@Override
public void windowClosed(WindowEvent e) {
- if (getHandler().isUseThreadListener()) {
- // remove action manager listener
- getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
- }
+ removeVCSActionThreadEventListener();
}
+
+ @Override
+ public synchronized void windowActivated(WindowEvent e) {
+ addVCSActionThreadEventListener();
+ super.windowActivated(e);
+ }
+
+ @Override
+ public synchronized void windowDeactivated(WindowEvent e) {
+ removeVCSActionThreadEventListener();
+ } */
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java 2008-05-26 07:43:57 UTC (rev 681)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java 2008-05-26 09:43:05 UTC (rev 682)
@@ -17,7 +17,6 @@
import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import javax.swing.AbstractButton;
-import java.awt.event.WindowEvent;
/** @author chemit */
public abstract class AbstractTabOneFileUI<H extends AbstractTabOneFileUIHandler<?, ?>> extends AbstractTabUI<H> {
@@ -26,24 +25,4 @@
public abstract AbstractButton getPreviousFile();
- protected boolean hasListener;
-
- @Override
- public synchronized void windowActivated(WindowEvent e) {
- if (!hasListener && getHandler().isUseThreadListener()) {
- // add action manager listener
- getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
- hasListener = true;
- }
- super.windowActivated(e);
- }
-
- @Override
- public synchronized void windowDeactivated(WindowEvent e) {
- if (!isVisible() && getHandler().isUseThreadListener() && hasListener) {
- // remove action manager listener
- getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
- hasListener = false;
- }
- }
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java 2008-05-26 07:43:57 UTC (rev 681)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java 2008-05-26 09:43:05 UTC (rev 682)
@@ -19,10 +19,13 @@
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
+import java.awt.event.WindowEvent;
/** @author chemit */
public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractBasicUI<H> {
+ protected boolean hasListener;
+
public abstract ButtonGroup getTabs();
public abstract AbstractButton getAllTab();
@@ -72,4 +75,33 @@
throw new IllegalStateException("no button found for " + modelName);
}
+ @Override
+ public synchronized void windowActivated(WindowEvent e) {
+ addVCSActionThreadEventListener();
+ super.windowActivated(e);
+ }
+
+ @Override
+ public synchronized void windowDeactivated(WindowEvent e) {
+ removeVCSActionThreadEventListener();
+ super.windowDeactivated(e);
+ }
+
+ public void addVCSActionThreadEventListener() {
+ if (!hasListener && getHandler().isUseThreadListener()) {
+ // add action manager listener
+ getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
+ hasListener = true;
+ }
+ }
+
+ public void removeVCSActionThreadEventListener() {
+ // remove listener only if no more visible and has a preivous listener registered
+ if (!isVisible() && hasListener && getHandler().isUseThreadListener()) {
+ // remove action manager listener
+ getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
+ hasListener = false;
+ }
+ }
+
}
1
0
r681 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . handler
by tchemit@users.labs.libre-entreprise.org May 26, 2008
by tchemit@users.labs.libre-entreprise.org May 26, 2008
May 26, 2008
Author: tchemit
Date: 2008-05-26 07:43:57 +0000 (Mon, 26 May 2008)
New Revision: 681
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/handler/ConnexionConfigUIHandler.java
Log:
improve rootConfig modification state
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-26 07:43:24 UTC (rev 680)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-26 07:43:57 UTC (rev 681)
@@ -139,9 +139,12 @@
}
private void afterRootChanged() {
+ String rootName = (String) getRootConfig().getSelectedItem();
getHandler().getModel().setRoots(VCSConfigFactory.getInstance().getRoots());
VCSConnexionConfig current = getHandler().getModel().getCurrent();
VCSRootConfig root = current.getRootConfig();
+ boolean wasModified = getHandler().getModel().getModifieds().contains(VCSConnexionConfigProperty.rootConfig);
+
if (root!=null) {
// check root always exists
if (!VCSConfigFactory.containsRoot(root.getRootName())) {
@@ -153,7 +156,12 @@
} else {
getHandler().populateRoots(false);
}
-
- doCheck(VCSConnexionConfigProperty.rootConfig);
+ if (rootName!=null) {
+ getRootConfig().setSelectedItem(rootName);
+ }
+ if (!wasModified) {
+ getHandler().getModel().removeModified(VCSConnexionConfigProperty.rootConfig);
+ }
+ //doCheck(VCSConnexionConfigProperty.rootConfig);
}
}
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-26 07:43:24 UTC (rev 680)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-26 07:43:57 UTC (rev 681)
@@ -162,6 +162,7 @@
}
ui.getTestConnection().setEnabled(true);
getUi().getRootsModel().setSelectedItem(config.getRootConfig().getRootName());
+ getModel().removeModified(VCSConnexionConfigProperty.rootConfig);
}
public void populateRoots(boolean addEmpty) {
1
0
r680 - trunk/lutinui/src/main/java/org/codelutin/ui/config
by tchemit@users.labs.libre-entreprise.org May 26, 2008
by tchemit@users.labs.libre-entreprise.org May 26, 2008
May 26, 2008
Author: tchemit
Date: 2008-05-26 07:43:24 +0000 (Mon, 26 May 2008)
New Revision: 680
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
Log:
log
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-25 15:41:34 UTC (rev 679)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-26 07:43:24 UTC (rev 680)
@@ -103,7 +103,6 @@
return unvalids;
}
-
public boolean isModified() {
return !modifieds.isEmpty();
}
@@ -139,6 +138,7 @@
public void addModified(E key) {
if (!modifieds.contains(key)) {
modifieds.add(key);
+ log.debug(key);
}
setModified(!modifieds.isEmpty());
}
1
0
r679 - in trunk/lutinvcs/ui: common/src/main/java/org/codelutin/vcs/ui common/src/main/java/org/codelutin/vcs/ui/action 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 May 25, 2008
by tchemit@users.labs.libre-entreprise.org May 25, 2008
May 25, 2008
Author: tchemit
Date: 2008-05-25 15:41:34 +0000 (Sun, 25 May 2008)
New Revision: 679
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/RootConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.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/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/JaxxRootConfigUI.jaxx
Log:
add RootConfig managment part II
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-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-25 15:41:34 UTC (rev 679)
@@ -19,6 +19,7 @@
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.VCSConfigFactory;
import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
@@ -51,7 +52,7 @@
public abstract AbstractButton getAddRoot();
- public abstract AbstractButton getDeleteRoot();
+ //public abstract AbstractButton getDeleteRoot();
public abstract AbstractButton getEditRoot();
@@ -91,7 +92,7 @@
public abstract JPanel getSshPanel();
- public abstract JComboBox getRootsList();
+ public abstract JComboBox getRootConfig();
protected void changeAutheticationMode(VCSConnexionMode mode) {
getHandler().getModel().setConnexionMode(mode);
@@ -123,19 +124,36 @@
}
protected void editRoot() {
- String rootName = (String) getRootsList().getSelectedItem();
+ String rootName = (String) getRootConfig().getSelectedItem();
VCSRootConfig config = VCSConfigFactory.getRoot(rootName);
UIActionHelper.showRootConfigUI(config, this, "bottom-left");
+ log.info("after edit root ");
+ afterRootChanged();
}
protected void addRoot() {
VCSRootConfig config = VCSConfigFactory.newRoot();
UIActionHelper.showRootConfigUI(config, this, "bottom-left");
- log.info("TODO " + this);
-
+ log.info("after add root ");
+ afterRootChanged();
}
- protected void deleteRoot() {
+ private void afterRootChanged() {
+ getHandler().getModel().setRoots(VCSConfigFactory.getInstance().getRoots());
+ VCSConnexionConfig current = getHandler().getModel().getCurrent();
+ VCSRootConfig root = current.getRootConfig();
+ if (root!=null) {
+ // check root always exists
+ if (!VCSConfigFactory.containsRoot(root.getRootName())) {
+ current.setRootConfig(null);
+ getHandler().populateRoots(true);
+ } else {
+ getHandler().populateRoots(false);
+ }
+ } else {
+ getHandler().populateRoots(false);
+ }
+
+ doCheck(VCSConnexionConfigProperty.rootConfig);
}
-
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java 2008-05-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java 2008-05-25 15:41:34 UTC (rev 679)
@@ -48,15 +48,26 @@
public abstract JComboBox getRootsList();
+ private Boolean noSelect;
+
+ public void setNoSelect(Boolean noSelect) {
+ this.noSelect = noSelect;
+ }
+
protected void addRoot() {
+ noSelect=true;
VCSRootConfig config = VCSConfigFactory.newRoot();
- getHandler().getModel().populate(config);
+ getHandler().getModel().populate(config);
+ noSelect=null;
}
protected void cloneRoot() {
+ noSelect=true;
String rootName = (String) getRootsList().getSelectedItem();
VCSRootConfig config =VCSConfigFactory.cloneRoot(rootName);
+
getHandler().getModel().populate(config);
+ noSelect=null;
}
protected void deleteRoot() {
@@ -65,4 +76,12 @@
getHandler().getModel().populate(null);
}
+ protected void selectRoot() {
+ String rootName = (String) getRootsList().getSelectedItem();
+ if (noSelect==null && rootName!=null && !rootName.trim().isEmpty() && VCSConfigFactory.containsRoot(rootName.trim())) {
+ VCSRootConfig config =VCSConfigFactory.getRoot(rootName);
+ getHandler().getModel().populate(config);
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java 2008-05-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java 2008-05-25 15:41:34 UTC (rev 679)
@@ -46,7 +46,9 @@
@Override
protected RootConfigUI initUI(ActionEvent e) {
RootConfigUI ui = super.initUI(e);
+ ui.setNoSelect(true);
ui.getHandler().getModel().populate(src);
+ ui.setNoSelect(null);
ui.pack();
return ui;
}
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-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-25 15:41:34 UTC (rev 679)
@@ -17,6 +17,7 @@
import org.codelutin.ui.config.DialogConfigUIHandler;
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.VCSConfigFactory;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.connexionMode;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.login;
@@ -130,17 +131,10 @@
}
@Override
- protected void populateUI() {
- // add roots
- DefaultComboBoxModel comboBoxModel = getUi().getRootsModel();
- comboBoxModel.removeAllElements();
- if (getModel().getSrc() == null) {
- // first root is an empty one
- comboBoxModel.addElement(" ");
- }
- for (VCSRootConfig type : getModel().getRoots()) {
- comboBoxModel.addElement(type.getRootName());
- }
+ public void populateUI() {
+
+ populateRoots(false);
+
super.populateUI();
ConnexionConfigUI ui = getUi();
@@ -170,7 +164,20 @@
getUi().getRootsModel().setSelectedItem(config.getRootConfig().getRootName());
}
+ public void populateRoots(boolean addEmpty) {
+ // add roots
+ DefaultComboBoxModel comboBoxModel = getUi().getRootsModel();
+ comboBoxModel.removeAllElements();
+ if (getModel().getSrc() == null || addEmpty) {
+ // first root is an empty one
+ comboBoxModel.addElement(" ");
+ }
+ for (VCSRootConfig type : getModel().getRoots()) {
+ comboBoxModel.addElement(type.getRootName());
+ }
+ }
+
@Override
protected boolean prepareSave() {
boolean b = super.prepareSave();
@@ -180,6 +187,11 @@
if (modifieds.contains(connexionMode)) {
current.setConnexionMode(getModel().getMode());
}
+ if (modifieds.contains(VCSConnexionConfigProperty.rootConfig)) {
+ String value = (String) getUi().getElementValue(VCSConnexionConfigProperty.rootConfig);
+ VCSRootConfig root = VCSConfigFactory.getRoot(value);
+ current.setRootConfig(root);
+ }
if (modifieds.contains(sshNoPassphrase)) {
boolean o = getModel().isNoSshPassPhrase();
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-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java 2008-05-25 15:41:34 UTC (rev 679)
@@ -15,9 +15,9 @@
package org.codelutin.vcs.ui.model;
import org.codelutin.ui.config.DialogConfigUIModel;
-import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.VCSConfigFactory;
import org.codelutin.vcs.VCSFactory;
+import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.type.VCSRootConfigProperty;
import org.codelutin.vcs.util.SimpleVCSRootConfig;
@@ -33,7 +33,7 @@
protected List<VCSRootConfig> roots;
protected List<String> types;
-
+
public RootConfigUIModel() {
super(VCSRootConfigProperty.class);
}
@@ -76,7 +76,10 @@
break;
case port:
- if (result) {
+ if (!result) {
+ // port is optional
+ result = true;
+ } else {
// must be an valid positive integer
try {
int port = Integer.valueOf(value + "");
@@ -95,4 +98,23 @@
}
return result;
}
+
+ @Override
+ public void save() {
+ if (src == null) {
+ // this is a new root config
+ src = newConfig();
+ } else {
+ if (modifieds.contains(VCSRootConfigProperty.rootName)) {
+ log.info("rootName changed " + current.getRootName());
+ }
+ }
+ current.copyTo(src, modifieds);
+ modifieds.clear();
+ if (!VCSConfigFactory.containsRoot(current.getRootName())) {
+ VCSConfigFactory.addRoot((VCSRootConfig) src);
+ setRoots(VCSConfigFactory.getInstance().getRoots());
+ }
+ super.save();
+ }
}
\ 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-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-25 15:41:34 UTC (rev 679)
@@ -103,7 +103,7 @@
</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()"/>
+ <!--JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/-->
</JToolBar>
<Table fill='both' insets="1,1,1,1">
@@ -120,7 +120,7 @@
<Table insets="2,2,2,2" fill='horizontal'>
<row fill='horizontal'>
<cell><JLabel id='rootConfigLabel'/></cell>
- <cell><JComboBox id='rootsList' model="{rootsModel}"/></cell>
+ <cell><JComboBox id='rootConfig' model="{rootsModel}" onActionPerformed="doCheck(VCSConnexionConfigProperty.rootConfig)"/></cell>
</row>
<row fill='horizontal'>
<cell><JLabel id='modulePathLabel'/></cell>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx 2008-05-25 15:41:01 UTC (rev 678)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx 2008-05-25 15:41:34 UTC (rev 679)
@@ -23,12 +23,9 @@
<JScrollPane columnHeaderView='{head}' styleClass='rootconfigScroll'>
<Table fill='horizontal'>
<row fill='horizontal'>
- <cell>
- <JLabel id='rootConfigLabel'/>
+ <cell columns="2" fill="horizontal">
+ <JComboBox id='rootsList' model="{rootsModel}" onActionPerformed="selectRoot()"/>
</cell>
- <cell>
- <JComboBox id='rootsList' model="{rootsModel}"/>
- </cell>
</row>
<row fill='horizontal'>
<cell>
@@ -43,7 +40,7 @@
<JLabel id='typeLabel'/>
</cell>
<cell>
- <JComboBox id='type' onKeyReleased="doCheck(VCSRootConfigProperty.type)" model="{typesModel}"/>
+ <JComboBox id='type' onActionPerformed="doCheck(VCSRootConfigProperty.type)" onKeyReleased="doCheck(VCSRootConfigProperty.type)" model="{typesModel}"/>
</cell>
</row>
<row fill='horizontal'>
1
0
r678 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org May 25, 2008
by tchemit@users.labs.libre-entreprise.org May 25, 2008
May 25, 2008
Author: tchemit
Date: 2008-05-25 15:41:01 +0000 (Sun, 25 May 2008)
New Revision: 678
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java
Log:
use a list of RootConfig and not a Map to simplify managment
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java 2008-05-25 15:40:33 UTC (rev 677)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java 2008-05-25 15:41:01 UTC (rev 678)
@@ -47,7 +47,7 @@
static protected VCSConfigFactory instance;
/** root configs indexed by their name */
- protected final java.util.Map<String, VCSRootConfig> roots;
+ protected final List<VCSRootConfig> roots;
/** connexion configs indexed by their rootConfig name */
protected final List<VCSConnexionConfig> connexions;
@@ -67,7 +67,7 @@
}
public List<VCSRootConfig> getRoots() {
- return new ArrayList<VCSRootConfig>(roots.values());
+ return new ArrayList<VCSRootConfig>(roots);
}
public List<VCSConnexionConfig> getConnexions() {
@@ -75,11 +75,25 @@
}
public static VCSRootConfig getRoot(String rootName) {
- if (!getInstance().roots.containsKey(rootName)) {
- // can not
- throw new IllegalStateException("unfound root " + rootName);
+
+ List<VCSRootConfig> configs = getInstance().roots;
+ for (VCSRootConfig config : configs) {
+ if (config.getRootName().equals(rootName)) {
+ return config;
+ }
+ }
+ // can not
+ throw new IllegalStateException("unfound root " + rootName);
+ }
+
+ public static boolean containsRoot(String rootName) {
+ List<VCSRootConfig> configs = getInstance().roots;
+ for (VCSRootConfig config : configs) {
+ if (config.getRootName().equals(rootName)) {
+ return true;
+ }
}
- return getInstance().roots.get(rootName);
+ return false;
}
public static VCSRootConfig newRoot() {
@@ -90,50 +104,44 @@
return config;
}
- public static VCSRootConfig cloneRoot(String name) {
- if (!getInstance().roots.containsKey(name)) {
- // can not
- throw new IllegalStateException("can not clone root " + name + ", not found");
- }
- VCSRootConfig config = getInstance().roots.get(name);
+ public static VCSRootConfig cloneRoot(String name) {
+ VCSRootConfig config = getRoot(name);
log.info(config);
VCSRootConfig result = newRoot();
result.copyFrom(config);
- result.setRootName(config.getRootName() + "_2");
- getInstance().roots.put(name, config);
+ result.setRootName(config.getRootName() +"_"+ getInstance().roots.size());
+ getInstance().roots.add(result);
return result;
}
public static void addRoot(VCSRootConfig config) {
String name = config.getRootName();
- if (getInstance().roots.containsKey(name)) {
+ List<VCSRootConfig> configs = getInstance().roots;
+ for (VCSRootConfig vcsRootConfig : configs) {
+ if (vcsRootConfig.getRootName().equals(name)) {
// can not
throw new IllegalStateException("can not create roots " + name + ", already existing ");
+ }
}
log.info(config);
- getInstance().roots.put(name, config);
+ getInstance().roots.add(config);
}
public static void removeRoot(String name) {
- if (!getInstance().roots.containsKey(name)) {
- // can not
- throw new IllegalStateException("can not remove roots " + name + ", not found");
- }
+ VCSRootConfig config = getRoot(name);
log.info(name);
- getInstance().roots.remove(name);
+ getInstance().roots.remove(config);
}
public static VCSConnexionConfig newConnexion(String rootName, EnumMap<VCSConnexionConfigProperty, Object> props) {
- if (!getInstance().roots.containsKey(rootName)) {
- // can not
- throw new IllegalStateException("unfound root " + rootName);
- }
+ VCSRootConfig rootConfig = getRoot(rootName);
+
VCSConnexionConfig config = new SimpleVCSConnexionConfig(props);
if (props == null || !props.containsKey(VCSConnexionConfigProperty.rootConfig)) {
// force to add rootConfig
- config.setRootConfig(getInstance().roots.get(rootName));
+ config.setRootConfig(rootConfig);
}
log.info(config);
getInstance().connexions.add(config);
@@ -141,7 +149,7 @@
}
protected VCSConfigFactory() {
- roots = new java.util.HashMap<String, VCSRootConfig>();
+ roots = new ArrayList<VCSRootConfig>();
connexions = new ArrayList<VCSConnexionConfig>();
}
}
\ No newline at end of file
1
0
r677 - trunk/lutinui/src/main/java/org/codelutin/ui/config
by tchemit@users.labs.libre-entreprise.org May 25, 2008
by tchemit@users.labs.libre-entreprise.org May 25, 2008
May 25, 2008
Author: tchemit
Date: 2008-05-25 15:40:33 +0000 (Sun, 25 May 2008)
New Revision: 677
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
Log:
uiValue can be null
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-17 13:51:28 UTC (rev 676)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-25 15:40:33 UTC (rev 677)
@@ -197,7 +197,7 @@
}
public void changeModifiedState(E key, Object uiValue, Object currentValue) {
- if (uiValue.equals(currentValue)) {
+ if (uiValue!=null && uiValue.equals(currentValue)) {
removeModified(key);
} else {
addModified(key);
1
0
r676 - trunk/lutinvcs/ui/jaxx/src/main/resources/icons
by tchemit@users.labs.libre-entreprise.org May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
Author: tchemit
Date: 2008-05-17 13:51:28 +0000 (Sat, 17 May 2008)
New Revision: 676
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootui.png
Log:
introduce rootConfig ui first part...
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootui.png
===================================================================
(Binary files differ)
1
0
r675 - in trunk/lutinvcs: core/src/main/java/org/codelutin/vcs core/src/main/java/org/codelutin/vcs/type core/src/main/java/org/codelutin/vcs/util tools/src/test/java/org/codelutin/vcs ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler ui/common/src/main/java/org/codelutin/vcs/ui/model ui/common/src/main/resources/i18n ui/jaxx/src/main/resources/i18n ui/jaxx/src/main/resources/icons ui/jaxx/src/
by tchemit@users.labs.libre-entreprise.org May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
Author: tchemit
Date: 2008-05-17 13:51:17 +0000 (Sat, 17 May 2008)
New Revision: 675
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/RootConfigUIHandler.java
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-cloneroot.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootconfigui.png
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.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/TestUI.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/VCSUIFactory.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/handler/TestUIHandler.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/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
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/JaxxTestUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
introduce rootConfig ui first part...
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -23,13 +23,13 @@
import org.apache.commons.logging.LogFactory;
import org.codelutin.util.config.IdentityConfig;
import org.codelutin.util.config.SimpleIdentityConfig;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import org.codelutin.vcs.util.SimpleVCSConnexionConfig;
import org.codelutin.vcs.util.SimpleVCSRootConfig;
-import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import java.util.ArrayList;
+import java.util.EnumMap;
import java.util.List;
-import java.util.EnumMap;
/**
* This classes acts as a factory of {@link org.codelutin.vcs.VCSProvider}, and {@link org.codelutin.vcs.VCSConnexion}.
@@ -43,19 +43,13 @@
static protected final Log log = LogFactory.getLog(VCSConfigFactory.class);
- /**
- * shared instance
- */
+ /** shared instance */
static protected VCSConfigFactory instance;
- /**
- * root configs indexed by their name
- */
+ /** root configs indexed by their name */
protected final java.util.Map<String, VCSRootConfig> roots;
- /**
- * connexion configs indexed by their rootConfig name
- */
+ /** connexion configs indexed by their rootConfig name */
protected final List<VCSConnexionConfig> connexions;
@@ -80,17 +74,56 @@
return connexions;
}
- public static VCSRootConfig newRoot(String name, String type, String host, String repository, Integer port) {
+ public static VCSRootConfig getRoot(String rootName) {
+ if (!getInstance().roots.containsKey(rootName)) {
+ // can not
+ throw new IllegalStateException("unfound root " + rootName);
+ }
+ return getInstance().roots.get(rootName);
+ }
+
+ public static VCSRootConfig newRoot() {
+ String name = "newRoot_" + getInstance().roots.size();
+ VCSRootConfig config = new SimpleVCSRootConfig();
+ config.setRootName(name);
+ log.info(config);
+ return config;
+ }
+
+ public static VCSRootConfig cloneRoot(String name) {
+ if (!getInstance().roots.containsKey(name)) {
+ // can not
+ throw new IllegalStateException("can not clone root " + name + ", not found");
+ }
+ VCSRootConfig config = getInstance().roots.get(name);
+ log.info(config);
+ VCSRootConfig result = newRoot();
+ result.copyFrom(config);
+ result.setRootName(config.getRootName() + "_2");
+ getInstance().roots.put(name, config);
+ return result;
+ }
+
+ public static void addRoot(VCSRootConfig config) {
+ String name = config.getRootName();
if (getInstance().roots.containsKey(name)) {
// can not
throw new IllegalStateException("can not create roots " + name + ", already existing ");
}
- VCSRootConfig config = new SimpleVCSRootConfig(name, type, host, repository, port);
log.info(config);
getInstance().roots.put(name, config);
- return config;
}
+ public static void removeRoot(String name) {
+ if (!getInstance().roots.containsKey(name)) {
+ // can not
+ throw new IllegalStateException("can not remove roots " + name + ", not found");
+ }
+ log.info(name);
+ getInstance().roots.remove(name);
+ }
+
+
public static VCSConnexionConfig newConnexion(String rootName, EnumMap<VCSConnexionConfigProperty, Object> props) {
if (!getInstance().roots.containsKey(rootName)) {
// can not
@@ -98,7 +131,7 @@
}
VCSConnexionConfig config = new SimpleVCSConnexionConfig(props);
- if (props==null || !props.containsKey(VCSConnexionConfigProperty.rootConfig)) {
+ if (props == null || !props.containsKey(VCSConnexionConfigProperty.rootConfig)) {
// force to add rootConfig
config.setRootConfig(getInstance().roots.get(rootName));
}
@@ -107,10 +140,8 @@
return config;
}
-
protected VCSConfigFactory() {
roots = new java.util.HashMap<String, VCSRootConfig>();
connexions = new ArrayList<VCSConnexionConfig>();
}
-
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -151,4 +151,12 @@
return providers;
}
+ /** @return the list of the names of known providers */
+ public List<String> getTypes() {
+ List<String> providerNames = new java.util.ArrayList<String>();
+ for (VCSProvider provider : providers) {
+ providerNames.add(provider.getName());
+ }
+ return providerNames;
+ }
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -26,7 +26,7 @@
*/
public interface VCSRootConfig extends Comparable<VCSRootConfig>, Config<VCSRootConfigProperty> {
- String getName();
+ String getRootName();
String getType();
@@ -36,7 +36,7 @@
Integer getPort();
- void setName(String name);
+ void setRootName(String name);
void setType(String type);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -22,21 +22,31 @@
* @author chemit
* @see VCSRootConfig
*/
-public enum VCSRootConfigProperty {
+public enum VCSRootConfigProperty implements org.codelutin.util.config.Property {
/** property <code>name</code>, unique name of the root definition */
- name,
+ rootName(String.class),
/** property <code>type</code>, type of the root (eg, CVS,...), should match the name of a {@link org.codelutin.vcs.VCSProvider} */
- type,
+ type(String.class),
/** property <code>host</code>, host of the root (eg labs.libreentreprise.org) with no protocol information */
- host,
+ host(String.class),
/** property <code>repository</code>, relative path of vcs root on host (eg cvsroot/myModule) */
- repository,
+ repository(String.class),
/** property <code>port</code>, the port used (if null, will use default vcs type port) */
- port
+ port(Integer.class);
+ private Class<?> ype;
+
+ public Class<?> getType() {
+ return ype;
+ }
+
+ VCSRootConfigProperty(Class<?> type) {
+ this.ype = type;
+ }
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -18,7 +18,7 @@
import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.type.VCSRootConfigProperty;
import static org.codelutin.vcs.type.VCSRootConfigProperty.host;
-import static org.codelutin.vcs.type.VCSRootConfigProperty.name;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.rootName;
import static org.codelutin.vcs.type.VCSRootConfigProperty.port;
import static org.codelutin.vcs.type.VCSRootConfigProperty.repository;
import static org.codelutin.vcs.type.VCSRootConfigProperty.type;
@@ -38,15 +38,15 @@
public SimpleVCSRootConfig(String name, String type, String host, String repository, Integer port) {
this();
- setName(name);
+ setRootName(name);
setType(type);
setHost(host);
setRepository(repository);
setPort(port);
}
- public String getName() {
- return (String) properties.get(name);
+ public String getRootName() {
+ return (String) properties.get(rootName);
}
public String getType() {
@@ -65,8 +65,8 @@
return (String) properties.get(repository);
}
- public void setName(String newName) {
- setProperty(name, newName);
+ public void setRootName(String newName) {
+ setProperty(rootName, newName);
}
public void setType(String newType) {
@@ -86,8 +86,8 @@
}
public int compareTo(VCSRootConfig o) {
- String name = getName();
- String oName = o.getName();
+ String name = getRootName();
+ String oName = o.getRootName();
return name == null ? -1 : oName == null ? 1 : name.compareTo(oName);
}
@@ -97,14 +97,14 @@
if (!(o instanceof SimpleConfig)) return false;
SimpleVCSRootConfig that = (SimpleVCSRootConfig) o;
- String name = getName();
- String oName = that.getName();
+ String name = getRootName();
+ String oName = that.getRootName();
return !(name != null ? !name.equals(oName) : oName != null);
}
@Override
public int hashCode() {
- String name = getName();
+ String name = getRootName();
return (name != null ? name.hashCode() : 0);
}
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -108,7 +108,13 @@
generator.generateWorkingRepository(root, i, i1, i2, i3);
}
- VCSRootConfig rootConfig = VCSConfigFactory.newRoot("generatedRoot-" + root.getName(), "MOCK", "labs.libre-entreprise.org", "cvsroot/isis-fish", null);
+ VCSRootConfig rootConfig = VCSConfigFactory.newRoot();
+ rootConfig.setRootName("dummy mock remote");
+ rootConfig.setHost("ynot-home.info");
+ rootConfig.setType("MOCK");
+ rootConfig.setRepository("/svnroot/lutinui");
+ VCSConfigFactory.addRoot(rootConfig);
+ //VCSRootConfig rootConfig = VCSConfigFactory.newRoot("generatedRoot-" + root.getName(), "MOCK", "labs.libre-entreprise.org", "cvsroot/isis-fish", null);
EnumMap<VCSConnexionConfigProperty, Object> props = new EnumMap<VCSConnexionConfigProperty, Object>(VCSConnexionConfigProperty.class);
props.put(sshPrivateKeyFile, new File("/home/tony/.ssh/id_dsa"));
@@ -118,7 +124,7 @@
props.put(connexionMode, org.codelutin.vcs.type.VCSConnexionMode.SSH);
props.put(workingCopyFile, root);
- VCSConnexionConfig config = VCSConfigFactory.newConnexion(rootConfig.getName(), props);
+ VCSConnexionConfig config = VCSConfigFactory.newConnexion(rootConfig.getRootName(), props);
return VCSFactory.newConnexion(config);
}
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -17,12 +17,15 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.ui.config.DialogConfigUI;
import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.VCSConfigFactory;
+import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JEditorPane;
@@ -54,6 +57,8 @@
public abstract JEditorPane getDoc();
+ public abstract DefaultComboBoxModel getRootsModel();
+
public abstract JRadioButton getConnexionModeAnonymous();
public abstract JRadioButton getConnexionModePassword();
@@ -118,15 +123,19 @@
}
protected void editRoot() {
- log.info("TODO " + this);
+ String rootName = (String) getRootsList().getSelectedItem();
+ VCSRootConfig config = VCSConfigFactory.getRoot(rootName);
+ UIActionHelper.showRootConfigUI(config, this, "bottom-left");
}
protected void addRoot() {
+ VCSRootConfig config = VCSConfigFactory.newRoot();
+ UIActionHelper.showRootConfigUI(config, this, "bottom-left");
log.info("TODO " + this);
+
}
protected void deleteRoot() {
- log.info("TODO " + this);
}
}
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/RootConfigUI.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -0,0 +1,68 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui;
+
+import org.codelutin.ui.config.DialogConfigUI;
+import org.codelutin.vcs.VCSConfigFactory;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+import org.codelutin.vcs.ui.handler.RootConfigUIHandler;
+
+import javax.swing.AbstractButton;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+import javax.swing.DefaultComboBoxModel;
+
+/** @author chemit */
+public abstract class RootConfigUI extends DialogConfigUI<VCSRootConfigProperty, RootConfigUIHandler> {
+
+ public abstract DefaultComboBoxModel getTypesModel();
+
+ public abstract DefaultComboBoxModel getRootsModel();
+
+ public abstract AbstractButton getCloneRoot();
+
+ public abstract AbstractButton getAddRoot();
+
+ public abstract AbstractButton getDeleteRoot();
+
+ public abstract JTextField getRootName();
+
+ public abstract JTextField getHost();
+
+ public abstract JTextField getPort();
+
+ public abstract JComboBox getType();
+
+ public abstract JComboBox getRootsList();
+
+ protected void addRoot() {
+ VCSRootConfig config = VCSConfigFactory.newRoot();
+ getHandler().getModel().populate(config);
+ }
+
+ protected void cloneRoot() {
+ String rootName = (String) getRootsList().getSelectedItem();
+ VCSRootConfig config =VCSConfigFactory.cloneRoot(rootName);
+ getHandler().getModel().populate(config);
+ }
+
+ protected void deleteRoot() {
+ String rootName = (String) getRootsList().getSelectedItem();
+ VCSConfigFactory.removeRoot(rootName);
+ getHandler().getModel().populate(null);
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -21,6 +21,8 @@
public abstract javax.swing.AbstractButton getShowFirstLaunch();
+ public abstract javax.swing.AbstractButton getShowRootConfig();
+
public abstract javax.swing.AbstractButton getShowConfig();
public abstract javax.swing.AbstractButton getShowSynch();
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -25,6 +25,7 @@
import org.codelutin.vcs.ui.action.ShowConfirmUIAction;
import org.codelutin.vcs.ui.action.ShowDiffUIAction;
import org.codelutin.vcs.ui.action.ShowIdentityUIAction;
+import org.codelutin.vcs.ui.action.ShowRootConfigAction;
import org.codelutin.vcs.ui.action.ShowSynchUIAction;
import org.codelutin.vcs.ui.action.ShowTestUIAction;
import org.codelutin.vcs.ui.model.TestUIModel;
@@ -51,6 +52,13 @@
fireAction(ui, action);
}
+ public static void showRootConfigUI(Object config, DialogUI ui, String position) {
+ ShowRootConfigAction action = new ShowRootConfigAction(ui, false);
+ action.setSrc(config);
+ action.setPosition(position);
+ fireAction(ui, action);
+ }
+
public static void showConfirmUI(VCSConnexionConfig config, DialogUI ui, VCSEntryLocation location, VCSAction vcsAction, VCSEntry[] entries, String position) {
ShowConfirmUIAction action = new ShowConfirmUIAction(ui, false);
action.setPosition(position);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -33,6 +33,7 @@
import org.codelutin.vcs.ui.handler.IdentityUIHandler;
import org.codelutin.vcs.ui.handler.SynchUIHandler;
import org.codelutin.vcs.ui.handler.TestUIHandler;
+import org.codelutin.vcs.ui.handler.RootConfigUIHandler;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
import org.codelutin.vcs.ui.model.ConfirmUIModel;
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
@@ -41,6 +42,7 @@
import org.codelutin.vcs.ui.model.IdentityUIModel;
import org.codelutin.vcs.ui.model.SynchUIModel;
import org.codelutin.vcs.ui.model.TestUIModel;
+import org.codelutin.vcs.ui.model.RootConfigUIModel;
import java.awt.event.WindowEvent;
@@ -60,12 +62,13 @@
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONNEXION_CONFIG_UI;
+ public static final DialogUIDef<RootConfigUIModel, RootConfigUI, RootConfigUIHandler> ROOT_CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
public static DialogUIDef[] defs() {
- return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI, TEST_UI};
+ return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI,ROOT_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI, TEST_UI};
}
protected static VCSUIFactory instance;
@@ -136,6 +139,10 @@
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
+ ROOT_CONFIG_UI= newDef(RootConfigUIHandler.class, RootConfigUI.class, RootConfigUIModel.class,
+ n_("lutinvcs.action.show.rootconfigui"),
+ n_("lutinvcs.action.show.rootconfigui.tip"),
+ n_("lutinvcs.configui.title"));
GENERATE_SHH_KEY_UI = newDef(GenerateSshKeyUIHandler.class, GenerateSshKeyUI.class, GenerateSshKeyUIModel.class,
n_("lutinvcs.action.show.generatesshkeyui"),
n_("lutinvcs.action.show.generatesshkeyui.tip"),
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowRootConfigAction.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -0,0 +1,53 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.ShowUIAction;
+import org.codelutin.vcs.ui.RootConfigUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.handler.RootConfigUIHandler;
+import org.codelutin.vcs.ui.model.RootConfigUIModel;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowRootConfigAction extends ShowUIAction<RootConfigUIModel, RootConfigUI, RootConfigUIHandler> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected transient Object src;
+
+ public Object getSrc() {
+ return src;
+ }
+
+ public void setSrc(Object src) {
+ this.src = src;
+ }
+
+ public ShowRootConfigAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
+ super(ui, VCSUIFactory.ROOT_CONFIG_UI, VCSUIFactory.getInstance(), showText);
+ }
+
+ @Override
+ protected RootConfigUI initUI(ActionEvent e) {
+ RootConfigUI ui = super.initUI(e);
+ ui.getHandler().getModel().populate(src);
+ ui.pack();
+ return ui;
+ }
+}
\ No newline at end of file
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -16,6 +16,7 @@
import org.codelutin.ui.config.DialogConfigUIHandler;
import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.connexionMode;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.login;
@@ -30,6 +31,7 @@
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
+import javax.swing.DefaultComboBoxModel;
import java.beans.PropertyChangeEvent;
import java.util.EnumSet;
@@ -129,6 +131,16 @@
@Override
protected void populateUI() {
+ // add roots
+ DefaultComboBoxModel comboBoxModel = getUi().getRootsModel();
+ comboBoxModel.removeAllElements();
+ if (getModel().getSrc() == null) {
+ // first root is an empty one
+ comboBoxModel.addElement(" ");
+ }
+ for (VCSRootConfig type : getModel().getRoots()) {
+ comboBoxModel.addElement(type.getRootName());
+ }
super.populateUI();
ConnexionConfigUI ui = getUi();
@@ -155,6 +167,7 @@
break;
}
ui.getTestConnection().setEnabled(true);
+ getUi().getRootsModel().setSelectedItem(config.getRootConfig().getRootName());
}
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/RootConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/RootConfigUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/RootConfigUIHandler.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -0,0 +1,89 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.handler;
+
+import org.codelutin.ui.config.DialogConfigUIHandler;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+import org.codelutin.vcs.ui.RootConfigUI;
+import org.codelutin.vcs.ui.model.RootConfigUIModel;
+
+import javax.swing.DefaultComboBoxModel;
+import java.beans.PropertyChangeEvent;
+
+/** @author chemit */
+public class RootConfigUIHandler extends DialogConfigUIHandler<VCSRootConfigProperty, RootConfigUIModel, RootConfigUI> {
+
+ public RootConfigUIHandler(RootConfigUI ui, RootConfigUIModel model) {
+ super(ui, model);
+ ui.setHandler(this);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+ //RootConfigUI ui = getUi();
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+
+ // try in super class
+ super.propertyChange(evt);
+ }
+
+
+ @Override
+ protected void populateUI() {
+ // add types
+ DefaultComboBoxModel comboBoxModel = getUi().getTypesModel();
+ comboBoxModel.removeAllElements();
+ for (String type : getModel().getTypes()) {
+ comboBoxModel.addElement(type);
+ }
+ // add roots
+ comboBoxModel = getUi().getRootsModel();
+ comboBoxModel.removeAllElements();
+ if (getModel().getSrc() == null) {
+ // first root is an empty one
+ comboBoxModel.addElement(" ");
+ }
+ for (VCSRootConfig type : getModel().getRoots()) {
+ comboBoxModel.addElement(type.getRootName());
+ }
+ super.populateUI();
+ if (getModel().getSrc() != null) {
+ //TODO disable selectionListener on combos before this operation
+ // select type
+ getUi().getTypesModel().setSelectedItem(getModel().getCurrent().getType());
+ // select root
+ getUi().getRootsModel().setSelectedItem(getModel().getCurrent().getRootName());
+ }
+ }
+
+
+ @Override
+ protected boolean prepareSave() {
+ boolean b = super.prepareSave();
+ if (b) {
+ //TODO
+ }
+ return b;
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -27,7 +27,7 @@
/** @author chemit */
public class TestUIHandler extends org.codelutin.ui.DialogUIHandler<TestUIModel, TestUI> {
- public TestUIHandler(TestUI ui,TestUIModel model) {
+ public TestUIHandler(TestUI ui, TestUIModel model) {
super(ui, model);
ui.setHandler(this);
}
@@ -39,6 +39,7 @@
initAction(VCSUIFactory.IDENTITY_UI, getUi().getShowFirstLaunch());
initAction(VCSUIFactory.CONNEXION_CONFIG_UI, getUi().getShowConfig());
initAction(VCSUIFactory.SYNCH_UI, getUi().getShowSynch());
+ initAction(VCSUIFactory.ROOT_CONFIG_UI, getUi().getShowRootConfig());
}
protected void initAction(DialogUIDef uiDef, AbstractButton button) {
@@ -62,6 +63,10 @@
UIActionHelper.showConfigUI(getModel().getConnexion().getConfig(), getUi(), "bottom-left");
return;
}
+ if (uiDef == VCSUIFactory.ROOT_CONFIG_UI) {
+ UIActionHelper.showRootConfigUI(getModel().getRoot(), getUi(), "bottom-left");
+ return;
+ }
if (uiDef == VCSUIFactory.SYNCH_UI) {
UIActionHelper.showSynchUI(getModel().getConnexion().getConfig(), getUi(), VCSEntryLocation.ALL, getModel().getEntries(), "bottom-left");
return;
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -16,12 +16,15 @@
import org.codelutin.ui.config.DialogConfigUIModel;
import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.VCSConfigFactory;
import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.*;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.SimpleVCSConnexionConfig;
import java.util.EnumSet;
+import java.util.List;
/**
* Model of a a confirmation of action on entries (single type of action possible)
@@ -38,6 +41,8 @@
protected VCSConnexionMode mode;
+ protected List<VCSRootConfig> roots;
+
public ConnexionConfigUIModel() {
super(VCSConnexionConfigProperty.class);
uncheckedKeys = EnumSet.noneOf(VCSConnexionConfigProperty.class);
@@ -49,12 +54,21 @@
@Override
public void populate(Object src) {
+ setRoots(VCSConfigFactory.getInstance().getRoots());
current.copyFrom(src, EnumSet.of(sshNoPassphrase));
noSshPassPhrase = current.isSshNoPassphrase();
super.populate(src);
setConnexionMode(current.getConnexionMode());
}
+ public List<VCSRootConfig> getRoots() {
+ return roots;
+ }
+
+ public void setRoots(List<VCSRootConfig> roots) {
+ this.roots = roots;
+ }
+
public void setNoSshPassPhrase(Boolean noSshPassPhrase) {
Boolean old = this.noSshPassPhrase;
this.noSshPassPhrase = noSshPassPhrase;
@@ -110,6 +124,7 @@
result &= !String.valueOf(value).trim().isEmpty();
break;
case rootConfig:
+ result &= !String.valueOf(value).trim().isEmpty();
break;
case sshLogin:
if (mode != VCSConnexionMode.SSH) {
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -14,18 +14,85 @@
*/
package org.codelutin.vcs.ui.model;
-import org.codelutin.vcs.ui.util.model.AbstractUIModel;
+import org.codelutin.ui.config.DialogConfigUIModel;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.VCSConfigFactory;
+import org.codelutin.vcs.VCSFactory;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+import org.codelutin.vcs.util.SimpleVCSRootConfig;
+import java.util.List;
+
/**
* Model of a a confirmation of action on entries (single type of action possible)
*
* @author chemit
*/
-public class RootConfigUIModel extends AbstractUIModel {
+public class RootConfigUIModel extends DialogConfigUIModel<VCSRootConfigProperty, VCSRootConfig> {
+ protected List<VCSRootConfig> roots;
+ protected List<String> types;
+
public RootConfigUIModel() {
+ super(VCSRootConfigProperty.class);
+ }
+ protected VCSRootConfig newConfig() {
+ return new SimpleVCSRootConfig();
}
+ @Override
+ public void populate(Object src) {
+ setRoots(VCSConfigFactory.getInstance().getRoots());
+ setTypes(VCSFactory.getInstance().getTypes());
+ super.populate(src);
+ }
+
+ public List<VCSRootConfig> getRoots() {
+ return roots;
+ }
+
+ public List<String> getTypes() {
+ return types;
+ }
+
+ protected void setRoots(List<VCSRootConfig> roots) {
+ this.roots = roots;
+ }
+
+ public void setTypes(List<String> types) {
+ this.types = types;
+ }
+
+ protected boolean isValid(VCSRootConfigProperty key, Object value) {
+ // each propertie can not be null, nor empty
+ boolean result = value != null && !String.valueOf(value).isEmpty();
+ switch (key) {
+ case host:
+ break;
+ case rootName:
+ //TODO Nameshould be unique
+
+ break;
+ case port:
+ if (result) {
+ // must be an valid positive integer
+ try {
+ int port = Integer.valueOf(value + "");
+ if (port < 1) {
+ result = false;
+ }
+ } catch (NumberFormatException e) {
+ result = false;
+ }
+ }
+ break;
+ case repository:
+ break;
+ case type:
+ break;
+ }
+ return result;
+ }
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -34,6 +34,8 @@
protected Object identity;
+ protected Object root;
+
private VCSEntry[] entries;
public void setUIDef(DialogUIDef uiDef) {
@@ -52,6 +54,10 @@
return identity;
}
+ public Object getRoot() {
+ return root;
+ }
+
public VCSEntry[] getEntries() {
return entries;
}
@@ -68,10 +74,15 @@
this.identity = identity;
}
+ public void setRoot(Object root) {
+ this.root = root;
+ }
+
public void init(TestUIModel model, boolean firstTime) {
connexion = model.getConnexion();
entries = model.getEntries();
identity = model.getIdentity();
+ root = model.getRoot();
if (firstTime) {
// propagate incoming model listeners to ui model
for (PropertyChangeListener listener : model.getPropertyChangeListeners()) {
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-05-17 13:51:17 UTC (rev 675)
@@ -24,6 +24,8 @@
lutinvcs.action.show.generatesshkeyui.tip=
lutinvcs.action.show.identityui=
lutinvcs.action.show.identityui.tip=
+lutinvcs.action.show.rootconfigui=
+lutinvcs.action.show.rootconfigui.tip=
lutinvcs.action.show.synchui=
lutinvcs.action.show.synchui.tip=
lutinvcs.action.show.testui=
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-05-17 13:51:17 UTC (rev 675)
@@ -24,6 +24,8 @@
lutinvcs.action.show.generatesshkeyui.tip=G\u00E9n\u00E9rer la paire de clefs ssh
lutinvcs.action.show.identityui=Identit\u00E9
lutinvcs.action.show.identityui.tip=Voir l'ui de saisie de l'identit\u00E9
+lutinvcs.action.show.rootconfigui=Serveurs vcs
+lutinvcs.action.show.rootconfigui.tip=Configurer les serveurs vcs distant
lutinvcs.action.show.synchui=Synchroniser
lutinvcs.action.show.synchui.tip=Voir la fen\u00EAtre de synchronisation
lutinvcs.action.show.testui=UI de test
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-05-17 13:51:17 UTC (rev 675)
@@ -6,13 +6,17 @@
lutinvcs.config.email=
lutinvcs.config.firstName=
lutinvcs.config.generate=Generate
+lutinvcs.config.host=
lutinvcs.config.lastName=
lutinvcs.config.message=
lutinvcs.config.modulePath=
lutinvcs.config.pass=
+lutinvcs.config.port=
lutinvcs.config.remoteURL=
+lutinvcs.config.repository=
lutinvcs.config.rootConfig=
lutinvcs.config.rootConfigHead=
+lutinvcs.config.rootName=
lutinvcs.config.server.authenticationMethod=
lutinvcs.config.server.login=
lutinvcs.config.server.passphrase=
@@ -24,9 +28,11 @@
lutinvcs.config.server.ssh.privateKeyFile=
lutinvcs.config.server.ssh.publicKeyFile=
lutinvcs.config.ssh=
+lutinvcs.config.type=
lutinvcs.config.workingCopyFile=
lutinvcs.config.workingCopyFile.change=
lutinvcs.generateSshKey.message=Generate
lutinvcs.identity.message=
lutinvcs.no.config=
lutinvcs.reset=
+lutinvcs.rootConfig.message=
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-05-17 13:51:17 UTC (rev 675)
@@ -6,13 +6,17 @@
lutinvcs.config.email=Courriel
lutinvcs.config.firstName=Pr\u00E9nom
lutinvcs.config.generate=G\u00E9n\u00E9rer
+lutinvcs.config.host=H\u00F4te
lutinvcs.config.lastName=Nom
lutinvcs.config.message=Configuration de la connexion
lutinvcs.config.modulePath=Module path
lutinvcs.config.pass=password
+lutinvcs.config.port=Port
lutinvcs.config.remoteURL=URL
+lutinvcs.config.repository=Repository
lutinvcs.config.rootConfig=Repository
lutinvcs.config.rootConfigHead=Serveur distant
+lutinvcs.config.rootName=Nom
lutinvcs.config.server.authenticationMethod=Authentification
lutinvcs.config.server.login=Login
lutinvcs.config.server.passphrase=passe-phrase
@@ -24,9 +28,11 @@
lutinvcs.config.server.ssh.privateKeyFile=clef priv\u00E9e
lutinvcs.config.server.ssh.publicKeyFile=clef publique
lutinvcs.config.ssh=ssh
+lutinvcs.config.type=Type de serveur
lutinvcs.config.workingCopyFile=Base locale
lutinvcs.config.workingCopyFile.change=Changer de base locale
lutinvcs.generateSshKey.message=G\u00E9n\u00E9rer
lutinvcs.identity.message=Configuration de votre identit\u00E9
lutinvcs.no.config=<Pas de configuration>
lutinvcs.reset=R\u00E9initialiser
+lutinvcs.rootConfig.message=Configuration des serveurs distants
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-cloneroot.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-cloneroot.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootconfigui.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootui.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-rootconfigui.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-17 13:51:17 UTC (rev 675)
@@ -6,7 +6,7 @@
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.action.*;
</script>
-
+ <DefaultComboBoxModel id="rootsModel"/>
<java.awt.CardLayout id='connexionPanelLayout'>
<Table id='anonymousPanel' insets='2,2,2,2'>
<row>
@@ -120,7 +120,7 @@
<Table insets="2,2,2,2" fill='horizontal'>
<row fill='horizontal'>
<cell><JLabel id='rootConfigLabel'/></cell>
- <cell><JComboBox id='rootsList'/></cell>
+ <cell><JComboBox id='rootsList' model="{rootsModel}"/></cell>
</row>
<row fill='horizontal'>
<cell><JLabel id='modulePathLabel'/></cell>
Added: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxRootConfigUI.jaxx 2008-05-17 13:51:17 UTC (rev 675)
@@ -0,0 +1,87 @@
+<RootConfigUI modal='true' resizable='false'>
+ <script>import org.codelutin.vcs.type.VCSRootConfigProperty;</script>
+ <style source="config.css"/>
+ <JToolBar id='head' opaque='false'>
+ <JLabel text='lutinvcs.rootConfig.message'/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='addRoot' icon='{createActionIcon("addroot")}' borderPainted='false' onActionPerformed="addRoot()"/>
+ <JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/>
+ <JButton id='cloneRoot' icon='{createActionIcon("cloneroot")}' borderPainted='false' onActionPerformed="cloneRoot()"/>
+ <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>
+ <DefaultComboBoxModel id="typesModel"/>
+ <DefaultComboBoxModel id="rootsModel"/>
+
+ <Table fill='both' insets="1,1,1,1">
+ <row fill='horizontal'>
+ <cell columns="2" fill='both'>
+ <JScrollPane columnHeaderView='{head}' styleClass='rootconfigScroll'>
+ <Table fill='horizontal'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='rootConfigLabel'/>
+ </cell>
+ <cell>
+ <JComboBox id='rootsList' model="{rootsModel}"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='rootNameLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='rootName' onKeyReleased="doCheck(VCSRootConfigProperty.rootName)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='typeLabel'/>
+ </cell>
+ <cell>
+ <JComboBox id='type' onKeyReleased="doCheck(VCSRootConfigProperty.type)" model="{typesModel}"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='hostLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='host' onKeyReleased="doCheck(VCSRootConfigProperty.host)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='repositoryLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='repository' onKeyReleased="doCheck(VCSRootConfigProperty.repository)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='portLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='port' onKeyReleased="doCheck(VCSRootConfigProperty.port)"/>
+ </cell>
+ </row>
+ </Table>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell weightx='1'>
+ <JButton id='ok' action='{newAction(org.codelutin.ui.config.SaveAction.class,true)}'/>
+ </cell>
+ <cell weightx='1'>
+ <JButton id='cancel' action='{newAction(org.codelutin.ui.config.CancelAction.class,true)}'/>
+ </cell>
+ </row>
+ </Table>
+
+</RootConfigUI>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-05-17 13:51:17 UTC (rev 675)
@@ -3,6 +3,7 @@
<script>import static org.codelutin.vcs.ui.VCSUIFactory.*;</script>
<JToolBar>
<JButton id='showFirstLaunch' onActionPerformed="showUI(IDENTITY_UI)"/>
+ <JButton id='showRootConfig' onActionPerformed="showUI(ROOT_CONFIG_UI)" />
<JButton id='showConfig' onActionPerformed="showUI(CONNEXION_CONFIG_UI)" />
<JButton id='showSynch' onActionPerformed="showUI(SYNCH_UI)"/>
<Table fill='both' insets='0,0,0,0'>
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-05-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-05-17 13:51:17 UTC (rev 675)
@@ -24,6 +24,7 @@
JaxxChangelogUI.class,
JaxxConfirmUI.class,
JaxxConnexionConfigUI.class,
+ JaxxRootConfigUI.class,
JaxxGenerateSshKeyUI.class,
JaxxIdentityUI.class,
JaxxTestUI.class);
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-17 13:50:22 UTC (rev 674)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-05-17 13:51:17 UTC (rev 675)
@@ -90,6 +90,26 @@
text: "lutinvcs.config.remoteURL";
}
+#rootNameLabel {
+ text: "lutinvcs.config.rootName";
+}
+
+#hostLabel {
+ text: "lutinvcs.config.host";
+}
+
+#portLabel {
+ text: "lutinvcs.config.port";
+}
+
+#typeLabel {
+ text: "lutinvcs.config.type";
+}
+
+#repositoryLabel {
+ text: "lutinvcs.config.repository";
+}
+
#changePrivateKeyFile {
toolTipText: "lutinvcs.config.server.ssh.key.change";
opaque:false;
@@ -140,4 +160,9 @@
horizontalScrollBarPolicy: 31;
height:110;
width:400;
+}
+
+.rootconfigScroll{
+ verticalScrollBarPolicy: 21;
+ horizontalScrollBarPolicy: 31;
}
\ No newline at end of file
1
0
r674 - trunk/lutinui/src/main/java/org/codelutin/ui/config
by tchemit@users.labs.libre-entreprise.org May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
Author: tchemit
Date: 2008-05-17 13:50:22 +0000 (Sat, 17 May 2008)
New Revision: 674
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java
Log:
can populate with src null
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-17 11:32:35 UTC (rev 673)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-17 13:50:22 UTC (rev 674)
@@ -114,7 +114,10 @@
public void populate(Object src) {
this.src = src;
- this.current.copyFrom(src);
+ this.current = newConfig();
+ if (src != null) {
+ this.current.copyFrom(src);
+ }
this.modifieds.clear();
this.unvalids.clear();
setModified(false);
1
0
r673 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . handler model
by tchemit@users.labs.libre-entreprise.org May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
Author: tchemit
Date: 2008-05-17 11:32:35 +0000 (Sat, 17 May 2008)
New Revision: 673
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/handler/ConnexionConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java
Log:
ajout modulePath dans la config
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-17 11:32:26 UTC (rev 672)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-17 11:32:35 UTC (rev 673)
@@ -24,11 +24,13 @@
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
import javax.swing.JEditorPane;
-import javax.swing.JLabel;
+import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
+import java.awt.CardLayout;
import java.io.File;
/** @author chemit */
@@ -72,33 +74,20 @@
public abstract JTextField getWorkingCopyFile();
- public abstract JLabel getLoginLabel();
+ public abstract JTextField getModulePath();
- public abstract JLabel getSshLoginLabel();
+ public abstract JPanel getConnexionPanel();
- public abstract JLabel getPasswordLabel();
+ public abstract CardLayout getConnexionPanelLayout();
- public abstract JLabel getSshPassphraseLabel();
+ public abstract JPanel getAnonymousPanel();
- //public abstract JLabel getSshNoPassphraseLabel();
+ public abstract JPanel getPasswordPanel();
- public abstract JLabel getSshPrivateKeyFileLabel();
+ public abstract JPanel getSshPanel();
- public abstract JLabel getWorkingCopyFileLabel();
+ public abstract JComboBox getRootsList();
- public abstract javax.swing.JPanel getConnexionPanel();
-
- public abstract java.awt.CardLayout getConnexionPanelLayout();
-
- public abstract javax.swing.JPanel getAnonymousPanel();
-
- public abstract javax.swing.JPanel getPasswordPanel();
-
- public abstract javax.swing.JPanel getSshPanel();
-
- public abstract javax.swing.JComboBox getRootsList();
-
-
protected void changeAutheticationMode(VCSConnexionMode mode) {
getHandler().getModel().setConnexionMode(mode);
doCheck(VCSConnexionConfigProperty.connexionMode);
@@ -125,19 +114,19 @@
}
protected void generateKey() {
- //TODO
+ log.info("TODO " + this);
}
protected void editRoot() {
- //TODO
+ log.info("TODO " + this);
}
protected void addRoot() {
- //TODO
+ log.info("TODO " + this);
}
protected void deleteRoot() {
- //TODO
+ log.info("TODO " + this);
}
}
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-17 11:32:26 UTC (rev 672)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-17 11:32:35 UTC (rev 673)
@@ -86,11 +86,10 @@
public void doCheck(VCSConnexionConfigProperty key) {
switch (key) {
-
case connexionMode:
// special case (not checkable property)
doCheck(getModel().getMode());
- break;
+ return;
case sshNoPassphrase:
Boolean noPass = (Boolean) getUi().getElementValue(key);
getModel().setNoSshPassPhrase(noPass);
@@ -98,22 +97,13 @@
if (noPass) {
getModel().clear(sshPassphrase);
} //else {
- super.doCheck(sshPassphrase);
+ super.doCheck(sshPassphrase);
//}
- break;
- case login:
- case password:
- case rootConfig:
- case sshLogin:
- case sshPassphrase:
- case sshPrivateKeyFile:
- case workingCopyFile:
- super.doCheck(key);
- break;
- case typeRepo:
- case typeRepoValue:
- break;
- }
+ return;
+ }
+ // other properties use default behaviour
+ super.doCheck(key);
+
}
protected boolean doCheck(VCSConnexionMode value) {
@@ -137,13 +127,7 @@
return result;
}
-
@Override
- public void doCheckAll() {
- super.doCheckAll();
- }
-
- @Override
protected void populateUI() {
super.populateUI();
@@ -193,7 +177,6 @@
modifieds.add(VCSConnexionConfigProperty.sshPassphrase);
}
}
-
}
return b;
}
@@ -210,7 +193,6 @@
ui.getConnexionModePassword().setSelected(true);
break;
case SSH:
-
doCheck(sshLogin);
doCheck(sshNoPassphrase);
doCheck(sshPassphrase);
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-17 11:32:26 UTC (rev 672)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-05-17 11:32:35 UTC (rev 673)
@@ -51,10 +51,7 @@
public void populate(Object src) {
current.copyFrom(src, EnumSet.of(sshNoPassphrase));
noSshPassPhrase = current.isSshNoPassphrase();
- super.populate(src);
- /*if (noSshPassPhrase) {
- clear(sshPassphrase);
- }*/
+ super.populate(src);
setConnexionMode(current.getConnexionMode());
}
@@ -87,7 +84,6 @@
}
}
changeModifiedState(connexionMode, mode, getCurrent().getConnexionMode());
-
firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
setConnexionState(null);
}
@@ -145,6 +141,9 @@
result = !f.isEmpty() && new java.io.File(f).exists();
}
break;
+ case modulePath:
+ result &= !String.valueOf(value).trim().isEmpty();
+ break;
case sshNoPassphrase:
// always valid :)
result = true;
1
0
r672 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . type util
by tchemit@users.labs.libre-entreprise.org May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
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 May 17, 2008
by tchemit@users.labs.libre-entreprise.org May 17, 2008
May 17, 2008
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 May 15, 2008
by tchemit@users.labs.libre-entreprise.org May 15, 2008
May 15, 2008
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
r669 - in trunk/lutinvcs: core/src/main/java/org/codelutin/vcs core/src/main/java/org/codelutin/vcs/type core/src/main/java/org/codelutin/vcs/util provider/svn/src/main/java/org/codelutin/vcs/provider/svn tools/src/test/java/org/codelutin/vcs ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler ui/common/src/main/java/org/codelutin/vcs/ui/model ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org May 14, 2008
by tchemit@users.labs.libre-entreprise.org May 14, 2008
May 14, 2008
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 May 14, 2008
by tchemit@users.labs.libre-entreprise.org May 14, 2008
May 14, 2008
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 May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
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 May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
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 May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
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 May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
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 May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
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
Author: tchemit
Date: 2008-05-13 23:03:22 +0000 (Tue, 13 May 2008)
New Revision: 662
Modified:
trunk/lutinui/pom.xml
Log:
lutinui use i18n
Modified: trunk/lutinui/pom.xml
===================================================================
--- trunk/lutinui/pom.xml 2008-05-13 23:02:55 UTC (rev 661)
+++ trunk/lutinui/pom.xml 2008-05-13 23:03:22 UTC (rev 662)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -22,7 +23,7 @@
<version>0.31-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
-
+
</dependencies>
<!-- ************************************************************* -->
@@ -53,6 +54,34 @@
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>lutinplugin</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <configuration>
+ <bundles>
+ <param>fr_FR</param>
+ <param>en_GB</param>
+ </bundles>
+ <src>${maven.src.dir}/main/resources/i18n</src>
+ <defaultBasedir>${maven.src.dir}/main/java</defaultBasedir>
+ <keysModifier>false</keysModifier>
+ <keepBackup>false</keepBackup>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
<profiles>
<profile>
<id>project</id>
@@ -73,10 +102,12 @@
<!--maven.scm.url>https://${labs.host}/plugins/scmsvn/viewcvs.php/trunk/${pom.artifactId}?root=${labs.project}</maven.scm.url-->
<!-- maven will suffix with /${pom.artifactId} -->
- <maven.scm.developerConnection>scm:svn:svn+ssh://tchemit@${labs.host}/svnroot/${labs.project}/trunk</maven.scm.developerConnection>
+ <maven.scm.developerConnection>scm:svn:svn+ssh://tchemit@${labs.host}/svnroot/${labs.project}/trunk
+ </maven.scm.developerConnection>
<!-- maven will suffix with /${pom.artifactId} -->
- <maven.scm.connection>scm:svn:svn:anonymous@${labs.host}/svnroot/${labs.project}/trunk</maven.scm.connection>
+ <maven.scm.connection>scm:svn:svn:anonymous@${labs.host}/svnroot/${labs.project}/trunk
+ </maven.scm.connection>
<!--Main class in JAR -->
<!--maven.jar.main.class></maven.jar.main.class-->
1
0
r661 - in trunk/lutinui/src/main: java/org/codelutin/ui/config resources resources/i18n resources/icons
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 23:02:55 +0000 (Tue, 13 May 2008)
New Revision: 661
Added:
trunk/lutinui/src/main/java/org/codelutin/ui/config/CancelAction.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/ResetAction.java
trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java
trunk/lutinui/src/main/resources/i18n/
trunk/lutinui/src/main/resources/i18n/lutinui-en_GB.properties
trunk/lutinui/src/main/resources/i18n/lutinui-fr_FR.properties
trunk/lutinui/src/main/resources/icons/
trunk/lutinui/src/main/resources/icons/action-cancel-config.png
trunk/lutinui/src/main/resources/icons/action-reset-config.png
trunk/lutinui/src/main/resources/icons/action-save-config.png
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
Log:
generic dialog config with actions cancel, reset and save
Added: trunk/lutinui/src/main/java/org/codelutin/ui/config/CancelAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/CancelAction.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/CancelAction.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,43 @@
+/**
+ * ##% 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 org.codelutin.ui.DialogUI;
+import org.codelutin.ui.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class CancelAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.cancel");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.codelutin.i18n.I18n._("lutinui.config.cancel.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getUi().dispose();
+ }
+}
\ No newline at end of file
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 22:30:23 UTC (rev 660)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -16,7 +16,14 @@
import org.codelutin.ui.DialogUI;
-import javax.swing.*;
+import javax.swing.AbstractButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
import java.util.Arrays;
/**
@@ -33,13 +40,13 @@
public abstract AbstractButton getReset();
public abstract AbstractButton getCancel();
-
- public JComponent getElement(E element) {
- return (JComponent) getObjectById(element.name());
+
+ public JComponent getElement(E key) {
+ return (JComponent) getObjectById(key.name());
}
- public String getElementValue(E element) {
- JComponent o = getElement(element);
+ public String getElementValue(E key) {
+ JComponent o = getElement(key);
if (o instanceof JPasswordField) {
return Arrays.toString(((JPasswordField) o).getPassword());
}
@@ -52,6 +59,10 @@
if (o instanceof JCheckBox) {
return String.valueOf(((JCheckBox) o).isSelected());
}
+
+ if (o instanceof JComboBox) {
+ return String.valueOf(((JComboBox) o).getSelectedItem());
+ }
return "";
}
@@ -69,28 +80,18 @@
if (o instanceof JCheckBox) {
((JCheckBox) o).setSelected(Boolean.valueOf(value + ""));
}
+ if (o instanceof JComboBox) {
+ ((JComboBox) o).setSelectedItem(value);
+ }
}
- public JLabel getElementLabel(E element) {
- return (JLabel) getObjectById(element.name() + "Label");
+ public JLabel getElementLabel(E key) {
+ return (JLabel) getObjectById(key.name() + "Label");
}
- public boolean isConfigValid() {
- return getHandler().isConfigValid();
+ public void doCheck(E key) {
+ getHandler().doCheck(key);
}
- protected void reset() {
- getHandler().reset();
- }
- protected void save() {
- getHandler().save();
- dispose();
- }
-
- protected void doCheck(E element) {
- getHandler().doCheck(element);
- }
-
-
}
\ 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 22:30:23 UTC (rev 660)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -16,30 +16,26 @@
import org.codelutin.ui.DialogUIHandler;
-import javax.swing.text.JTextComponent;
-import javax.swing.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.EnumMap;
+import javax.swing.JComponent;
+import java.awt.Color;
import java.beans.PropertyChangeEvent;
-import java.awt.*;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Map;
/**
* DialogUI handler
*
* @author chemit
*/
-public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E,?>, U extends DialogConfigUI<E,? extends DialogConfigUIHandler<E,M,U>>> extends DialogUIHandler<M, U> {
+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);
- errors = new ArrayList<E>();
}
-
- protected List<E> errors;
-
public void propertyChange(PropertyChangeEvent evt) {
if (log.isDebugEnabled()) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
@@ -49,6 +45,7 @@
if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
populateUI();
+ // revalidate form
doCheck(null);
return;
}
@@ -57,101 +54,58 @@
Boolean newValue = (Boolean) evt.getNewValue();
boolean modified = newValue != null && newValue;
getUi().getReset().setEnabled(modified);
+ getUi().getOk().setEnabled(modified && getModel().isConfigValid());
return;
}
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
- public synchronized List<E> validateModel(E element) {
- errors.clear();
- U ui = getUi();
- if (element != null) {
- // compute modifed
- setModified(element, ui);
+ if (DialogConfigUIModel.UNVALID_PROPERTY_CHANGED.equals(action)) {
+ updateUI();
+ return;
}
- //checkData(ui.getFirstName(), firstName);
- //checkData(ui.getLastName(), lastName);
- //checkData(ui.getEmail(), email);
-
- return errors;
+ throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
}
- public void setModified(E element, U ui) {
- boolean modify = false;
- M model = getModel();
-
- String value = ui.getElementValue(element);
- //TODO
- if (modify) {
- model.addModified(element);
- } else if (model.getModifieds().contains(element)) {
- model.removeModified(element);
+ public void doCheck(E key) {
+ if (key == null) {
+ getModifyAction().doCheckAll();
+ } else {
+ getModifyAction().doCheck(key);
}
}
- public void doCheck(E element) {
- List<E> errors = validateModel(element);
- updateUI(errors);
- }
-
- public boolean isConfigValid() {
- return errors.isEmpty();
- }
-
- public void reset() {
- getModel().reset();
- }
-
protected void populateUI() {
U ui = getUi();
M model = getModel();
- EnumMap<E,Object> map = model.getCurrent().getProperties();
- for (Map.Entry<E, Object> entry : map.entrySet()) {
+ EnumMap<E, Object> map = model.getCurrent().getProperties();
+ for (Map.Entry<E, Object> entry : map.entrySet()) {
ui.setElementValue(entry.getKey(), entry.getValue());
}
- //ui.getFirstName().setText(model.getCurrent().getFirstName());
- //ui.getLastName().setText(model.getCurrent().getLastName());
- //ui.getEmail().setText(model.getCurrent().getEmail());
}
- protected void updateUI(List<E> errors) {
- U ui = getUi();
- boolean valid = isConfigValid();
- ui.getOk().setEnabled(valid && getModel().isModified());
- for (E element : errors) {
- setLabelColor(errors, element);
+ protected void updateUI() {
+ EnumSet<E> unvalids = getModel().getUnvalids();
+ for (E key : unvalids) {
+ setLabelColor(key, false);
}
- }
-
- protected void checkData(JTextComponent component, E errorName) {
- if (component.getText().isEmpty()) {
- errors.add(errorName);
+ for (E key : EnumSet.complementOf(unvalids)) {
+ setLabelColor(key, true);
}
}
- protected void checkData(boolean notValid, E errorName) {
- if (notValid) {
- errors.add(errorName);
- }
- }
-
- protected void setLabelColor(List<E> errors, E element) {
- JComponent component = getUi().getElementLabel(element);
+ protected void setLabelColor(E key, boolean valid) {
+ JComponent component = getUi().getElementLabel(key);
if (component != null && component.isVisible()) {
- component.setForeground(errors.contains(element) ? Color.red : Color.black);
+ component.setForeground(valid ? Color.black : Color.red);
}
}
- public void save() {
- if (!getModel().isModified()) {
- log.warn("nothing to save");
+ protected ModifyAction<E, ? extends DialogConfigUIHandler<E, ?, ?>> getModifyAction() {
+ if (modifyAction == null) {
+ modifyAction = new ModifyAction<E, DialogConfigUIHandler<E, ?, ?>>(getUi().getHandler().getUi());
}
- for (E element : getModel().getModifieds()) {
- String value = getUi().getElementValue(element);
- //TODO
- //getModel().save(element, value);
- log.info("save " + element);
- }
+ 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 22:30:23 UTC (rev 660)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -14,11 +14,10 @@
*/
package org.codelutin.ui.config;
+import org.codelutin.ui.DialogUIModel;
import org.codelutin.util.config.Config;
-import org.codelutin.ui.DialogUIModel;
import java.util.EnumSet;
-import java.util.Set;
/**
* Abstract config ui model.
@@ -31,32 +30,41 @@
public static final String MODIFIED_PROPERTY_CHANGED = "modify";
public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
+ /** @return a empty config */
+ protected abstract C newConfig();
+
/**
- * @return a empty config
+ * @param key property key
+ * @param value value to validate
+ * @return <code>true</code> if given value is valid for property, <code>false>/code> otherwise
*/
- protected abstract C newConfig();
+ protected abstract boolean isValid(E key, Object value);
/**
- * object used to init model and save model
+ * object used to init model and save model, this is an external object.
+ * <p/>
+ * The object must have bean read-write properties for each value of E
*/
protected Object src;
- /**
- * current config used in model
- */
+ /** current config used in model */
protected C current;
- /**
- * set of modified properties
- */
+ /** set of modified properties */
protected EnumSet<E> modifieds;
-
- /**
- * set of unvalid properties
- */
+ /** set of unvalid properties */
protected EnumSet<E> unvalids;
+ protected Class<E> klass;
+
+ protected DialogConfigUIModel(Class<E> klass) {
+ this.klass = klass;
+ this.current = newConfig();
+ this.modifieds = EnumSet.noneOf(klass);
+ this.unvalids = EnumSet.noneOf(klass);
+ }
+
public Object getSrc() {
return src;
}
@@ -65,6 +73,10 @@
return current;
}
+ public EnumSet<E> getUnivserse() {
+ return getCurrent().getUniverse();
+ }
+
public EnumSet<E> getModifieds() {
return modifieds;
}
@@ -73,14 +85,14 @@
return unvalids;
}
- public Set<E> getUnivserse() {
- return getCurrent().getUniverse();
- }
public boolean isModified() {
return !modifieds.isEmpty();
}
+ public boolean isConfigValid() {
+ return unvalids.isEmpty();
+ }
public void populate(Object src) {
this.src = src;
@@ -91,10 +103,11 @@
firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
+ public void reset() {
+ populate(src);
+ }
+
public void setModified(boolean modified) {
- if (!modified) {
- modifieds.clear();
- }
firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
}
@@ -102,19 +115,15 @@
firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
}
- public void reset() {
- populate(src);
- }
-
- public void addModified(E names) {
- if (!modifieds.contains(names)) {
- modifieds.add(names);
+ public void addModified(E key) {
+ if (!modifieds.contains(key)) {
+ modifieds.add(key);
}
setModified(!modifieds.isEmpty());
}
- public void removeModified(E... names) {
- for (E elementname : names) {
+ public void removeModified(E... keys) {
+ for (E elementname : keys) {
if (modifieds.contains(elementname)) {
modifieds.remove(elementname);
}
@@ -122,30 +131,39 @@
setModified(!modifieds.isEmpty());
}
- public void addUnvalid(E names) {
- if (!unvalids.contains(names)) {
- unvalids.add(names);
+ public void addUnvalid(EnumSet<E> keys) {
+ for (E name : keys) {
+ if (!unvalids.contains(name)) {
+ unvalids.add(name);
+ }
}
+ for (E name : EnumSet.complementOf(keys)) {
+ if (unvalids.contains(name)) {
+ unvalids.remove(name);
+ }
+ }
setUnvalid(!unvalids.isEmpty());
}
- public void removeUnvalid(E... names) {
- for (E elementname : names) {
- if (unvalids.contains(elementname)) {
- unvalids.remove(elementname);
- }
+
+ public void addUnvalid(E key) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
}
setUnvalid(!unvalids.isEmpty());
}
+ public void removeUnvalid(E key) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
- protected DialogConfigUIModel(Class<E> klass) {
-
- current = newConfig();
-
- modifieds = EnumSet.noneOf(klass);
-
- unvalids = EnumSet.noneOf(klass);
+ public void save() {
+ current.copyTo(src, modifieds);
+ modifieds.clear();
+ // redisplay config
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
-
}
\ No newline at end of file
Added: trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/ModifyAction.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,109 @@
+/**
+ * ##% 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
Added: trunk/lutinui/src/main/java/org/codelutin/ui/config/ResetAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/ResetAction.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/ResetAction.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,43 @@
+/**
+ * ##% 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 org.codelutin.ui.DialogUI;
+import org.codelutin.ui.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ResetAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.reset");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.codelutin.i18n.I18n._("lutinui.config.reset.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getHandler().getModel().reset();
+ }
+}
\ No newline at end of file
Added: trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/SaveAction.java 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,67 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.ui.config;
+
+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;
+
+/** @author chemit */
+public class SaveAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("save-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.save");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ 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 (!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();
+
+ // close ui
+ ui.dispose();
+ }
+}
Added: trunk/lutinui/src/main/resources/i18n/lutinui-en_GB.properties
===================================================================
--- trunk/lutinui/src/main/resources/i18n/lutinui-en_GB.properties (rev 0)
+++ trunk/lutinui/src/main/resources/i18n/lutinui-en_GB.properties 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,6 @@
+lutinui.config.cancel=Cancel
+lutinui.config.cancel.tooltip=Cancel and quit
+lutinui.config.reset=Reset
+lutinui.config.reset.tooltip=Reset configuration
+lutinui.config.save=Save
+lutinui.config.save.tooltip=Save configuration and quit
Added: trunk/lutinui/src/main/resources/i18n/lutinui-fr_FR.properties
===================================================================
--- trunk/lutinui/src/main/resources/i18n/lutinui-fr_FR.properties (rev 0)
+++ trunk/lutinui/src/main/resources/i18n/lutinui-fr_FR.properties 2008-05-13 23:02:55 UTC (rev 661)
@@ -0,0 +1,6 @@
+lutinui.config.cancel=Annuler
+lutinui.config.cancel.tooltip=Annuler les modification et quitter
+lutinui.config.reset=R\u00E9initialiser
+lutinui.config.reset.tooltip=R\u00E9initialiser la configuration
+lutinui.config.save=Sauver
+lutinui.config.save.tooltip=Sauver la configuration et quitter
Added: trunk/lutinui/src/main/resources/icons/action-cancel-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinui/src/main/resources/icons/action-cancel-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinui/src/main/resources/icons/action-reset-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinui/src/main/resources/icons/action-reset-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinui/src/main/resources/icons/action-save-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinui/src/main/resources/icons/action-save-config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
r660 - in trunk/lutinvcs/ui/jaxx/src/main/resources/icons: . unused
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 22:30:23 +0000 (Tue, 13 May 2008)
New Revision: 660
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/AddRemove_C32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/BUTTON32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/COPY.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/actionSelect.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/autorefresh-icon.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/both_mod.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/clearFilter.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/compileSingle.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/conflicts-badge.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/connection_mode.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/cut.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/delete.gif
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/diff_file_16.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/envelope_small.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/export.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/filter.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_next.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_previous.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_selection.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/generalOptions.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/import-elements.png
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/AddRemove_C32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/BUTTON32.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/actionSelect.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/autorefresh-icon.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/both_mod.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/clearFilter.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/compileSingle.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/conflicts-badge.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/cut.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/delete.gif
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/diff_file_16.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/envelope_small.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/export.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/filter.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_next.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_previous.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_selection.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/generalOptions.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/import-elements.png
Log:
unsued (for the moment icons)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/AddRemove_C32.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/BUTTON32.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/actionSelect.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/autorefresh-icon.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/both_mod.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/clearFilter.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/compileSingle.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/conflicts-badge.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/cut.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/delete.gif
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/diff_file_16.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/envelope_small.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/export.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/filter.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_next.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_previous.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_selection.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/generalOptions.png
===================================================================
(Binary files differ)
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/import-elements.png
===================================================================
(Binary files differ)
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/AddRemove_C32.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/AddRemove_C32.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/AddRemove_C32.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/BUTTON32.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/BUTTON32.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/BUTTON32.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/COPY.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/COPY.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/actionSelect.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/actionSelect.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/actionSelect.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/autorefresh-icon.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/autorefresh-icon.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/autorefresh-icon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/both_mod.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/both_mod.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/both_mod.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/clearFilter.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/clearFilter.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/clearFilter.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/compileSingle.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/compileSingle.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/compileSingle.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/conflicts-badge.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/conflicts-badge.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/conflicts-badge.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/connection_mode.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/connection_mode.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/cut.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/cut.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/cut.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/delete.gif (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/delete.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/delete.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/diff_file_16.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/diff_file_16.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/diff_file_16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/envelope_small.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/envelope_small.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/envelope_small.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/export.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/export.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/export.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/filter.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/filter.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/filter.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_next.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_next.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_next.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_previous.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_previous.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_previous.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_selection.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/find_selection.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/find_selection.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/generalOptions.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/generalOptions.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/generalOptions.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/import-elements.png (from rev 657, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/import-elements.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/unused/import-elements.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
r659 - in trunk/lutinui/src/main/java/org/codelutin/ui: . config
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 15:48:42 +0000 (Tue, 13 May 2008)
New Revision: 659
Added:
trunk/lutinui/src/main/java/org/codelutin/ui/config/
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
Removed:
trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUI.java
trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java
trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIModel.java
Log:
create config package
Deleted: trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUI.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUI.java 2008-05-13 14:24:27 UTC (rev 658)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUI.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -1,94 +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;
-
-import javax.swing.*;
-import java.util.Arrays;
-
-/**
- * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
- * <p/>
- * TODO : make jaxx authorized implementing interface for root tag :)
- *
- * @author chemit
- */
-public abstract class DialogConfigUI<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends DialogUI<H> {
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
- public JComponent getElement(E element) {
- return (JComponent) getObjectById(element.name());
- }
-
- public String getElementValue(E 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 void setElementValue(E key, Object value) {
- JComponent o = getElement(key);
- if (o instanceof JPasswordField) {
- ((JPasswordField) o).setText(value + "");
- }
- if (o instanceof JTextField) {
- ((JTextField) o).setText(value + "");
- }
- if (o instanceof JRadioButton) {
- ((JRadioButton) o).setSelected(Boolean.valueOf(value + ""));
- }
- if (o instanceof JCheckBox) {
- ((JCheckBox) o).setSelected(Boolean.valueOf(value + ""));
- }
- }
-
- public JLabel getElementLabel(E element) {
- return (JLabel) getObjectById(element.name() + "Label");
- }
-
- public boolean isConfigValid() {
- return getHandler().isConfigValid();
- }
-
- protected void reset() {
- getHandler().reset();
- }
-
- protected void save() {
- getHandler().save();
- dispose();
- }
-
- protected void doCheck(E element) {
- getHandler().doCheck(element);
- }
-
-
-}
\ No newline at end of file
Deleted: trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java 2008-05-13 14:24:27 UTC (rev 658)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -1,155 +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;
-
-import javax.swing.text.JTextComponent;
-import javax.swing.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.EnumMap;
-import java.beans.PropertyChangeEvent;
-import java.awt.*;
-
-/**
- * DialogUI handler
- *
- * @author chemit
- */
-public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E,?>, U extends DialogConfigUI<E,? extends DialogConfigUIHandler<E,M,U>>> extends DialogUIHandler<M, U> {
-
- protected DialogConfigUIHandler(U ui, M model) {
- super(ui, model);
- errors = new ArrayList<E>();
- }
-
-
- protected List<E> errors;
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
-
- if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI();
- doCheck(null);
- return;
- }
-
- if (DialogConfigUIModel.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<E> validateModel(E element) {
- errors.clear();
- U 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(E element, U ui) {
- boolean modify = false;
- M model = getModel();
-
- String value = ui.getElementValue(element);
- //TODO
- if (modify) {
- model.addModified(element);
- } else if (model.getModifieds().contains(element)) {
- model.removeModified(element);
- }
- }
-
- public void doCheck(E element) {
- List<E> errors = validateModel(element);
- updateUI(errors);
- }
-
- public boolean isConfigValid() {
- return errors.isEmpty();
- }
-
- public void reset() {
- getModel().reset();
- }
-
- 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());
- }
- //ui.getFirstName().setText(model.getCurrent().getFirstName());
- //ui.getLastName().setText(model.getCurrent().getLastName());
- //ui.getEmail().setText(model.getCurrent().getEmail());
- }
-
- protected void updateUI(List<E> errors) {
- U ui = getUi();
- boolean valid = isConfigValid();
- ui.getOk().setEnabled(valid && getModel().isModified());
- for (E element : errors) {
- setLabelColor(errors, element);
- }
- }
-
- protected void checkData(JTextComponent component, E errorName) {
- if (component.getText().isEmpty()) {
- errors.add(errorName);
- }
- }
-
- protected void checkData(boolean notValid, E errorName) {
- if (notValid) {
- errors.add(errorName);
- }
- }
-
- protected void setLabelColor(List<E> errors, E 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 (E element : getModel().getModifieds()) {
- String value = getUi().getElementValue(element);
- //TODO
- //getModel().save(element, value);
- log.info("save " + element);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIModel.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIModel.java 2008-05-13 14:24:27 UTC (rev 658)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIModel.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -1,150 +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;
-
-import org.codelutin.util.config.Config;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * Abstract config ui model.
- *
- * @author chemit
- */
-public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
-
- public static final String CONFIG_PROPERTY_CHANGED = "config";
- public static final String MODIFIED_PROPERTY_CHANGED = "modify";
- public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
-
- /**
- * @return a empty config
- */
- protected abstract C newConfig();
-
- /**
- * object used to init model and save model
- */
- protected Object src;
-
- /**
- * current config used in model
- */
- protected C current;
-
- /**
- * set of modified properties
- */
- protected EnumSet<E> modifieds;
-
-
- /**
- * set of unvalid properties
- */
- protected EnumSet<E> unvalids;
-
- public Object getSrc() {
- return src;
- }
-
- public C getCurrent() {
- return current;
- }
-
- public EnumSet<E> getModifieds() {
- return modifieds;
- }
-
- public EnumSet<E> getUnvalids() {
- return unvalids;
- }
-
- public Set<E> getUnivserse() {
- return getCurrent().getUniverse();
- }
-
- public boolean isModified() {
- return !modifieds.isEmpty();
- }
-
-
- public void populate(Object src) {
- this.src = src;
- this.current.copyFrom(src);
- this.modifieds.clear();
- this.unvalids.clear();
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
- }
-
- public void setModified(boolean modified) {
- if (!modified) {
- modifieds.clear();
- }
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void setUnvalid(boolean unvalid) {
- firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
- }
-
- public void reset() {
- populate(src);
- }
-
- public void addModified(E names) {
- if (!modifieds.contains(names)) {
- modifieds.add(names);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(E... names) {
- for (E elementname : names) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
- }
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void addUnvalid(E names) {
- if (!unvalids.contains(names)) {
- unvalids.add(names);
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
- public void removeUnvalid(E... names) {
- for (E elementname : names) {
- if (unvalids.contains(elementname)) {
- unvalids.remove(elementname);
- }
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
-
- protected DialogConfigUIModel(Class<E> klass) {
-
- current = newConfig();
-
- modifieds = EnumSet.noneOf(klass);
-
- unvalids = EnumSet.noneOf(klass);
- }
-
-}
\ No newline at end of file
Copied: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java (from rev 657, trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUI.java)
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUI.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -0,0 +1,96 @@
+/**
+ * ##% 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.DialogUI;
+
+import javax.swing.*;
+import java.util.Arrays;
+
+/**
+ * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUI<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends DialogUI<H> {
+
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancel();
+
+ public JComponent getElement(E element) {
+ return (JComponent) getObjectById(element.name());
+ }
+
+ public String getElementValue(E 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 void setElementValue(E key, Object value) {
+ JComponent o = getElement(key);
+ if (o instanceof JPasswordField) {
+ ((JPasswordField) o).setText(value + "");
+ }
+ if (o instanceof JTextField) {
+ ((JTextField) o).setText(value + "");
+ }
+ if (o instanceof JRadioButton) {
+ ((JRadioButton) o).setSelected(Boolean.valueOf(value + ""));
+ }
+ if (o instanceof JCheckBox) {
+ ((JCheckBox) o).setSelected(Boolean.valueOf(value + ""));
+ }
+ }
+
+ public JLabel getElementLabel(E element) {
+ return (JLabel) getObjectById(element.name() + "Label");
+ }
+
+ public boolean isConfigValid() {
+ return getHandler().isConfigValid();
+ }
+
+ protected void reset() {
+ getHandler().reset();
+ }
+
+ protected void save() {
+ getHandler().save();
+ dispose();
+ }
+
+ protected void doCheck(E element) {
+ getHandler().doCheck(element);
+ }
+
+
+}
\ No newline at end of file
Copied: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java (from rev 657, trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java)
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIHandler.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -0,0 +1,157 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.ui.config;
+
+import org.codelutin.ui.DialogUIHandler;
+
+import javax.swing.text.JTextComponent;
+import javax.swing.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.EnumMap;
+import java.beans.PropertyChangeEvent;
+import java.awt.*;
+
+/**
+ * DialogUI handler
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E,?>, U extends DialogConfigUI<E,? extends DialogConfigUIHandler<E,M,U>>> extends DialogUIHandler<M, U> {
+
+ protected DialogConfigUIHandler(U ui, M model) {
+ super(ui, model);
+ errors = new ArrayList<E>();
+ }
+
+
+ protected List<E> errors;
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+
+ if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ // update ui with model values,
+ populateUI();
+ doCheck(null);
+ return;
+ }
+
+ if (DialogConfigUIModel.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<E> validateModel(E element) {
+ errors.clear();
+ U 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(E element, U ui) {
+ boolean modify = false;
+ M model = getModel();
+
+ String value = ui.getElementValue(element);
+ //TODO
+ if (modify) {
+ model.addModified(element);
+ } else if (model.getModifieds().contains(element)) {
+ model.removeModified(element);
+ }
+ }
+
+ public void doCheck(E element) {
+ List<E> errors = validateModel(element);
+ updateUI(errors);
+ }
+
+ public boolean isConfigValid() {
+ return errors.isEmpty();
+ }
+
+ public void reset() {
+ getModel().reset();
+ }
+
+ 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());
+ }
+ //ui.getFirstName().setText(model.getCurrent().getFirstName());
+ //ui.getLastName().setText(model.getCurrent().getLastName());
+ //ui.getEmail().setText(model.getCurrent().getEmail());
+ }
+
+ protected void updateUI(List<E> errors) {
+ U ui = getUi();
+ boolean valid = isConfigValid();
+ ui.getOk().setEnabled(valid && getModel().isModified());
+ for (E element : errors) {
+ setLabelColor(errors, element);
+ }
+ }
+
+ protected void checkData(JTextComponent component, E errorName) {
+ if (component.getText().isEmpty()) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void checkData(boolean notValid, E errorName) {
+ if (notValid) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void setLabelColor(List<E> errors, E 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 (E element : getModel().getModifieds()) {
+ String value = getUi().getElementValue(element);
+ //TODO
+ //getModel().save(element, value);
+ log.info("save " + element);
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java (from rev 657, trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIModel.java)
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java (rev 0)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/config/DialogConfigUIModel.java 2008-05-13 15:48:42 UTC (rev 659)
@@ -0,0 +1,151 @@
+/**
+ * ##% 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.util.config.Config;
+import org.codelutin.ui.DialogUIModel;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * Abstract config ui model.
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
+
+ public static final String CONFIG_PROPERTY_CHANGED = "config";
+ public static final String MODIFIED_PROPERTY_CHANGED = "modify";
+ public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
+
+ /**
+ * @return a empty config
+ */
+ protected abstract C newConfig();
+
+ /**
+ * object used to init model and save model
+ */
+ protected Object src;
+
+ /**
+ * current config used in model
+ */
+ protected C current;
+
+ /**
+ * set of modified properties
+ */
+ protected EnumSet<E> modifieds;
+
+
+ /**
+ * set of unvalid properties
+ */
+ protected EnumSet<E> unvalids;
+
+ public Object getSrc() {
+ return src;
+ }
+
+ public C getCurrent() {
+ return current;
+ }
+
+ public EnumSet<E> getModifieds() {
+ return modifieds;
+ }
+
+ public EnumSet<E> getUnvalids() {
+ return unvalids;
+ }
+
+ public Set<E> getUnivserse() {
+ return getCurrent().getUniverse();
+ }
+
+ public boolean isModified() {
+ return !modifieds.isEmpty();
+ }
+
+
+ public void populate(Object src) {
+ this.src = src;
+ this.current.copyFrom(src);
+ this.modifieds.clear();
+ this.unvalids.clear();
+ setModified(false);
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void setModified(boolean modified) {
+ if (!modified) {
+ modifieds.clear();
+ }
+ firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
+ }
+
+ public void setUnvalid(boolean unvalid) {
+ firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
+ }
+
+ public void reset() {
+ populate(src);
+ }
+
+ public void addModified(E names) {
+ if (!modifieds.contains(names)) {
+ modifieds.add(names);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(E... names) {
+ for (E elementname : names) {
+ if (modifieds.contains(elementname)) {
+ modifieds.remove(elementname);
+ }
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void addUnvalid(E names) {
+ if (!unvalids.contains(names)) {
+ unvalids.add(names);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+ public void removeUnvalid(E... names) {
+ for (E elementname : names) {
+ if (unvalids.contains(elementname)) {
+ unvalids.remove(elementname);
+ }
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+
+ protected DialogConfigUIModel(Class<E> klass) {
+
+ current = newConfig();
+
+ modifieds = EnumSet.noneOf(klass);
+
+ unvalids = EnumSet.noneOf(klass);
+ }
+
+}
\ No newline at end of file
1
0
r658 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:24:27 +0000 (Tue, 13 May 2008)
New Revision: 658
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
Log:
refactor config + introduction factory de 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-13 14:16:07 UTC (rev 657)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-05-13 14:24:27 UTC (rev 658)
@@ -1,23 +1,21 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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.
-* ##% */
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
package org.codelutin.vcs;
+import org.codelutin.util.config.Config;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.type.VCSTypeRepo;
@@ -25,71 +23,51 @@
/**
* Contract to be realized by a VCSConnexion configuration.
- * <p/>
- * This class has no logic, ans is a <code>POJO</code>.
*
* @author chemit
*/
-public interface VCSConnexionConfig {
+public interface VCSConnexionConfig extends Config<VCSConnexionConfigProperty> {
- /** @return the type of vcs used */
- String getType();
+ VCSRootConfig getRootConfig();
- VCSConnexionMode getMode();
+ VCSTypeRepo getTypeRepo();
- /** @return <code>true</code> if ssh connexion is used */
- boolean isUseSshConnexion();
+ String getTypeRepoValue();
- /** @return the url of hostname */
- String getHostName();
+ File getWorkingCopyFile();
- /** @return location of the private ssh2 key file */
- File getKeyFile();
+ VCSConnexionMode getConnexionMode();
- /** @return the user connexion login */
- String getUserName();
+ String getLogin();
- /** @return <code>true</code> if user ssh2 pair keys use a passphrase */
- boolean isNoPassPhrase();
+ String getPassword();
- String getPassphrase();
+ String getSshLogin();
- /** @return the full location path of the remote container of module */
- String getRemotePath();
+ String getSshPassphrase();
- /** @return the name of remote module */
- String getRemoteDatabase();
+ File getSshPrivateKeyFile();
- /** @return the full url path to the remote repository (with module name include) */
- String getRemoteDatabasePath();
+ void setRootConfig(VCSRootConfig rootConfig);
- File getLocalDatabasePath();
+ void setTypeRepo(VCSTypeRepo typeRepo);
- /** @return the type of reposotory used (head,tags,branches,...) */
- VCSTypeRepo getTypeRepo();
+ void setTypeRepoValue(String typeRepoValue);
+ void setWorkingCopyFile(File newWorkingCopyFile);
- void setHostName(String hostName);
+ void setConnexionMode(VCSConnexionMode connexionMode);
- void setKeyFile(File keyFile);
+ void setLogin(String login);
- void setLocalDatabasePath(File localDatabasePath);
+ void setPassword(String password);
- void setNoPassPhrase(boolean noPassPhrase);
+ void setSshLogin(String sshLogin);
- void setPassPhrase(String passPhrase);
+ void setSshPassphrase(String sshPassphrase);
- void setRemoteDatabase(String remoteDatabase);
+ void setSshPrivateKeyFile(File sshPrivateKeyFile);
- void setRemotePath(String remotePath);
+ boolean isNoPassPhrase();
- void setType(String type);
-
- void setTypeRepo(VCSTypeRepo typeRepo);
-
- void setUserName(String userName);
-
- void setUseSshConnexion(boolean newValue);
-
- void setConnexionMode(VCSConnexionMode mode);
-}
\ No newline at end of file
+}
1
0
r657 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action handler model util util/ui
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:16:07 +0000 (Tue, 13 May 2008)
New Revision: 657
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java
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/IdentityUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.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/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowIdentityUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java
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/ShowTestUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.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/handler/DiffUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.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/handler/SynchUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.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/IdentityUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSShowUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java
Log:
refactor config + introduction factory de config
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-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -43,7 +43,8 @@
password,
passphrase,
nopassphrase,
- privateKeyFile;
+ privateKeyFile,
+ workingCopyFile;
public Object getValue(ConnexionConfigUI ui) {
return ui.getElementValue(this);
@@ -63,6 +64,8 @@
public abstract AbstractButton getChangePrivateKeyFile();
+ public abstract AbstractButton getChangeWorkingCopyFile();
+
public abstract AbstractButton getGenerateKey();
public abstract AbstractButton getOk();
@@ -74,7 +77,7 @@
public abstract AbstractButton getTestConnection();
public abstract AbstractButton getAddRoot();
-
+
public abstract AbstractButton getDeleteRoot();
public abstract AbstractButton getEditRoot();
@@ -125,6 +128,8 @@
public abstract JTextField getPrivateKeyFile();
+ public abstract JTextField getWorkingCopyFile();
+
public abstract JLabel getLoginLabel();
public abstract JLabel getSshLoginLabel();
@@ -135,6 +140,8 @@
public abstract JLabel getPrivateKeyFileLabel();
+ public abstract JLabel getWorkingCopyFileLabel();
+
public abstract javax.swing.JPanel getConnexionPanel();
public abstract java.awt.CardLayout getConnexionPanelLayout();
@@ -180,6 +187,16 @@
}
}
+ protected void changeWorkingCopyFile() {
+ //TODO add title in lutinutil :)
+ String file = FileUtil.getDirectory(_("lutinvcs.config.workingCopyFile.change"), _("lutinvcs.accept"));
+ if (file != null) {
+ String path = new File(file).getAbsolutePath();
+ getWorkingCopyFile().setText(path);
+ doCheck(Element.workingCopyFile);
+ }
+ }
+
protected void generateKey() {
//TODO
}
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 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/IdentityUI.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -31,8 +31,8 @@
public abstract class IdentityUI extends DialogUI<IdentityUIHandler> {
public enum Element implements FormElement<IdentityUI> {
- firstname,
- lastname,
+ firstName,
+ lastName,
email;
public Object getValue(IdentityUI ui) {
@@ -55,6 +55,7 @@
public abstract AbstractButton getCancel();
+
public String getElementValue(Element element) {
JComponent o = getElement(element);
if (o instanceof JPasswordField) {
@@ -80,15 +81,15 @@
return (JComponent) getObjectById(element.name());
}
- public abstract JTextField getFirstname();
+ public abstract JTextField getFirstName();
- public abstract JTextField getLastname();
+ public abstract JTextField getLastName();
public abstract JTextField getEmail();
- public abstract JLabel getFirstnameLabel();
+ public abstract JLabel getFirstNameLabel();
- public abstract JLabel getLastnameLabel();
+ public abstract JLabel getLastNameLabel();
public abstract JLabel getEmailLabel();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -24,8 +24,8 @@
/** @author chemit */
public abstract class SynchUI extends AbstractTabUI<SynchUIHandler> {
- public abstract AbstractButton getConfig() ;
-
+ public abstract AbstractButton getConfig();
+
public abstract AbstractButton getRefreshAll();
public abstract AbstractButton getDiffAll();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/TestUI.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -26,7 +26,7 @@
public abstract javax.swing.AbstractButton getShowSynch();
public void showUI(DialogUIDef uiDef) {
- getHandler().getModel().setUIDef(uiDef);
+ getHandler().getModel().setUIDef(uiDef);
}
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 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/UIActionHelper.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -43,7 +43,7 @@
fireAction(ui, action);
}
- public static void showConfigUI(VCSConnexionConfig config, DialogUI<?> ui, String position) {
+ public static void showConfigUI(VCSConnexionConfig config, DialogUI ui, String position) {
ShowConfigAction action = new ShowConfigAction(ui, false);
action.setConfig(config);
action.setPosition(position);
@@ -78,20 +78,20 @@
fireAction(ui, action);
}
- public static void showIdentityUI(java.io.Serializable src, DialogUI<?> ui, String position) {
+ public static void showIdentityUI(Object src, DialogUI ui, String position) {
ShowIdentityUIAction action = new ShowIdentityUIAction(ui, false);
action.setSrc(src);
action.setPosition(position);
fireAction(ui, action);
}
- public static void showTestUI(TestUIModel model, DialogUI<?> ui) {
+ public static void showTestUI(TestUIModel model, DialogUI ui) {
ShowTestUIAction action = new ShowTestUIAction(ui, false);
action.setModel(model, true);
fireAction(ui, action);
}
- protected static void fireAction(DialogUI<?> ui, ShowUIAction action) {
+ protected static void fireAction(DialogUI ui, ShowUIAction action) {
action.actionPerformed(new ActionEvent(ui == null ? action : ui, 0, "" + action.getValue(javax.swing.AbstractAction.NAME)));
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -26,19 +26,19 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSFactory;
import org.codelutin.vcs.ui.handler.ChangelogUIHandler;
+import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
-import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
import org.codelutin.vcs.ui.handler.DiffUIHandler;
+import org.codelutin.vcs.ui.handler.GenerateSshKeyUIHandler;
import org.codelutin.vcs.ui.handler.IdentityUIHandler;
-import org.codelutin.vcs.ui.handler.GenerateSshKeyUIHandler;
import org.codelutin.vcs.ui.handler.SynchUIHandler;
import org.codelutin.vcs.ui.handler.TestUIHandler;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
+import org.codelutin.vcs.ui.model.ConfirmUIModel;
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
-import org.codelutin.vcs.ui.model.ConfirmUIModel;
import org.codelutin.vcs.ui.model.DiffUIModel;
+import org.codelutin.vcs.ui.model.GenerateSshKeyUIModel;
import org.codelutin.vcs.ui.model.IdentityUIModel;
-import org.codelutin.vcs.ui.model.GenerateSshKeyUIModel;
import org.codelutin.vcs.ui.model.SynchUIModel;
import org.codelutin.vcs.ui.model.TestUIModel;
@@ -65,7 +65,7 @@
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
public static DialogUIDef[] defs() {
- return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI,TEST_UI};
+ return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI, TEST_UI};
}
protected static VCSUIFactory instance;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -16,6 +16,7 @@
import org.codelutin.ui.AbstractUIAction;
import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI;
/** @author chemit */
public class ChangeFileAction extends AbstractUIAction<AbstractTabOneFileUIHandler<?, ?>> {
@@ -24,7 +25,7 @@
private static final long serialVersionUID = 1L;
- public ChangeFileAction(org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI<?> ui, boolean location) {
+ public ChangeFileAction(AbstractTabOneFileUI<AbstractTabOneFileUIHandler<?, ?>> ui, boolean location) {
super(null, org.codelutin.ui.UIHelper.createActionIcon("file-" + (location ? "prev" : "next")), ui);
this.goPrevious = location;
//putValue(SHORT_DESCRIPTION, location.getTip());
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -26,7 +26,7 @@
private static final long serialVersionUID = 1L;
- public ChangeLocationAction(AbstractTabUI<?> ui, VCSEntryLocation location) {
+ public ChangeLocationAction(AbstractTabUI<AbstractTabUIHandler<?, ?>> ui, VCSEntryLocation location) {
super(location.getLibelle(), org.codelutin.vcs.ui.util.UIHelper.createLocationIcon(location), ui);
this.location = location;
putValue(SHORT_DESCRIPTION, location.getTip());
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ConfirmAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -15,15 +15,17 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.ui.ConfirmUI;
+import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
/** @author chemit */
-public class ConfirmAction extends org.codelutin.ui.AbstractUIAction<org.codelutin.vcs.ui.handler.ConfirmUIHandler> {
+public class ConfirmAction extends org.codelutin.ui.AbstractUIAction<ConfirmUIHandler> {
protected VCSAction action;
private static final long serialVersionUID = 1L;
- public ConfirmAction(org.codelutin.vcs.ui.ConfirmUI ui, VCSAction action) {
+ public ConfirmAction(ConfirmUI ui, VCSAction action) {
super(null, org.codelutin.vcs.ui.util.UIHelper.createActionIcon(action), ui);
this.action = action;
//putValue(SHORT_DESCRIPTION, action.getTip());
@@ -48,7 +50,7 @@
case DELETE:
case REVERT:
case UPDATE:
- org.codelutin.vcs.ui.handler.ConfirmUIHandler uiHandler = getHandler();
+ ConfirmUIHandler uiHandler = getHandler();
uiHandler.doAction(uiHandler.getUi().getCommitMessage().getText(), uiHandler.getModel().getEntriesModel());
return;
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/DiffAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,14 +14,17 @@
*/
package org.codelutin.vcs.ui.action;
+import org.codelutin.vcs.ui.DiffUI;
+import org.codelutin.vcs.ui.handler.DiffUIHandler;
+
/** @author chemit */
-public class DiffAction extends org.codelutin.ui.AbstractUIAction<org.codelutin.vcs.ui.handler.DiffUIHandler> {
+public class DiffAction extends org.codelutin.ui.AbstractUIAction<DiffUIHandler> {
protected boolean goUp;
private static final long serialVersionUID = 1L;
- public DiffAction(org.codelutin.vcs.ui.DiffUI ui, boolean goUp) {
+ public DiffAction(DiffUI ui, boolean goUp) {
super(null, org.codelutin.ui.UIHelper.createActionIcon("diff-" + (goUp ? "prev" : "next")), ui);
this.goUp = goUp;
//putValue(SHORT_DESCRIPTION, action.getTip());
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -17,13 +17,14 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.ui.AbstractUIAction;
import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.DialogUIHandler;
/** @author chemit */
public class HelpAction extends AbstractUIAction<org.codelutin.ui.DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
- public HelpAction(DialogUI<? extends org.codelutin.ui.DialogUIHandler<?, ?>> ui) {
+ public HelpAction(DialogUI<DialogUIHandler<?, ?>> ui) {
super(_("lutinvcs.action.help.libelle"), org.codelutin.ui.UIHelper.createActionIcon("help"), ui);
String name = (String) getValue(NAME);
putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
@@ -34,7 +35,7 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
checkInit();
- log.info("//TODO : " + this + ", " + ui);
+ log.info("//TODO : " + this + ", " + getUi());
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowChangelogUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -27,14 +27,14 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowChangelogUIAction extends AbstractVCSShowUIAction<ChangelogUIModel, ChangelogUI, ChangelogUIHandler, DialogUIHandler<?, ?>> {
+public class ShowChangelogUIAction extends AbstractVCSShowUIAction<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> {
private static final long serialVersionUID = 1L;
private VCSEntryLocation location;
private VCSEntry[] entries;
- public ShowChangelogUIAction(DialogUI ui, boolean showText) {
+ public ShowChangelogUIAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
super(ui, VCSUIFactory.CHANGELOG_UI, showText);
}
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-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,6 +14,7 @@
*/
package org.codelutin.vcs.ui.action;
+import org.codelutin.ui.DialogUI;
import org.codelutin.ui.DialogUIHandler;
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
@@ -24,11 +25,11 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> {
private static final long serialVersionUID = 1L;
- public ShowConfigAction(org.codelutin.ui.DialogUI ui, boolean showText) {
+ public ShowConfigAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
super(ui, VCSUIFactory.CONNEXION_CONFIG_UI, showText);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfirmUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -28,7 +28,7 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfirmUIAction extends AbstractVCSShowUIAction<ConfirmUIModel, ConfirmUI, ConfirmUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfirmUIAction extends AbstractVCSShowUIAction<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> {
private static final long serialVersionUID = 1L;
@@ -36,7 +36,7 @@
private VCSEntryLocation location;
private VCSEntry[] entries;
- public ShowConfirmUIAction(DialogUI ui, boolean showText) {
+ public ShowConfirmUIAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
super(ui, VCSUIFactory.CONFIRM_UI, showText);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowDiffUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -27,14 +27,14 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowDiffUIAction extends AbstractVCSShowUIAction<DiffUIModel, DiffUI, DiffUIHandler, DialogUIHandler<?, ?>> {
+public class ShowDiffUIAction extends AbstractVCSShowUIAction<DiffUIModel, DiffUI, DiffUIHandler> {
private static final long serialVersionUID = 1L;
private VCSEntryLocation location;
private VCSEntry[] entries;
- public ShowDiffUIAction(DialogUI ui, boolean showText) {
+ public ShowDiffUIAction(DialogUI<DialogUIHandler<?, ?>> ui, boolean showText) {
super(ui, VCSUIFactory.DIFF_UI, showText);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowIdentityUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowIdentityUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowIdentityUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,7 +14,7 @@
*/
package org.codelutin.vcs.ui.action;
-import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.DialogUI;
import org.codelutin.ui.ShowUIAction;
import org.codelutin.vcs.ui.IdentityUI;
import org.codelutin.vcs.ui.VCSUIFactory;
@@ -22,30 +22,29 @@
import org.codelutin.vcs.ui.model.IdentityUIModel;
import java.awt.event.ActionEvent;
-import java.io.Serializable;
/** @author chemit */
-public class ShowIdentityUIAction extends ShowUIAction<IdentityUIModel, IdentityUI, IdentityUIHandler, DialogUIHandler<?, ?>> {
+public class ShowIdentityUIAction extends ShowUIAction<IdentityUIModel, IdentityUI, IdentityUIHandler> {
private static final long serialVersionUID = 1L;
- protected Serializable src;
+ protected transient Object src;
- public Serializable getSrc() {
+ public Object getSrc() {
return src;
}
- public void setSrc(Serializable src) {
+ public void setSrc(Object src) {
this.src = src;
}
- public ShowIdentityUIAction(org.codelutin.ui.DialogUI ui, boolean showText) {
+ public ShowIdentityUIAction(DialogUI<?> ui, boolean showText) {
super(ui, VCSUIFactory.IDENTITY_UI, VCSUIFactory.getInstance(), showText);
}
@Override
protected IdentityUI initUI(ActionEvent e) {
- IdentityUI ui = getFactory().getUI(uiDef);
+ IdentityUI ui = super.initUI(e);
ui.getHandler().getModel().populate(src);
ui.pack();
return ui;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowMessagesAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,6 +14,7 @@
*/
package org.codelutin.vcs.ui.action;
+import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
/** @author chemit */
@@ -21,7 +22,7 @@
private static final long serialVersionUID = 1L;
- public ShowMessagesAction(org.codelutin.vcs.ui.ConfirmUI ui) {
+ public ShowMessagesAction(ConfirmUI ui) {
super(null, org.codelutin.ui.UIHelper.createActionIcon("showmessages"), ui);
putValue(SHORT_DESCRIPTION, org.codelutin.i18n.I18n._("lutinvcs.action.showmessages.tip"));
setEnabled(false);
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-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowSynchUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -27,7 +27,7 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowSynchUIAction extends AbstractVCSShowUIAction<SynchUIModel, SynchUI, SynchUIHandler, DialogUIHandler<?, ?>> {
+public class ShowSynchUIAction extends AbstractVCSShowUIAction<SynchUIModel, SynchUI, SynchUIHandler> {
private static final long serialVersionUID = 1L;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowTestUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowTestUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowTestUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,17 +14,17 @@
*/
package org.codelutin.vcs.ui.action;
-import org.codelutin.ui.DialogUIHandler;
+import org.codelutin.ui.DialogUI;
+import org.codelutin.ui.ShowUIAction;
import org.codelutin.vcs.ui.TestUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.TestUIHandler;
import org.codelutin.vcs.ui.model.TestUIModel;
-import org.codelutin.vcs.ui.util.AbstractShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowTestUIAction extends AbstractShowUIAction<TestUIModel, TestUI, TestUIHandler, DialogUIHandler<?, ?>> {
+public class ShowTestUIAction extends ShowUIAction<TestUIModel, TestUI, TestUIHandler> {
private static final long serialVersionUID = 1L;
@@ -32,8 +32,8 @@
protected boolean firstTime;
- public ShowTestUIAction(org.codelutin.ui.DialogUI ui, boolean showText) {
- super(ui, VCSUIFactory.TEST_UI, showText);
+ public ShowTestUIAction(DialogUI<?> ui, boolean showText) {
+ super(ui, VCSUIFactory.TEST_UI, VCSUIFactory.getInstance(), showText);
}
public void setModel(TestUIModel model, boolean firstTime) {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -35,7 +35,7 @@
private static final long serialVersionUID = 1L;
- public TabUIAction(AbstractTabUI<?> ui, VCSAction action, boolean useSelection) {
+ public TabUIAction(AbstractTabUI<AbstractTabUIHandler<?, ?>> ui, VCSAction action, boolean useSelection) {
super(null, org.codelutin.vcs.ui.util.UIHelper.createActionIcon(action), ui);
this.useSelection = useSelection;
this.action = action;
@@ -60,14 +60,14 @@
// take all entries
entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
}
- UIActionHelper.showChangelogUI(config, ui, location, entries.toArray(new VCSEntry[entries.size()]),null);
+ UIActionHelper.showChangelogUI(config, getUi(), location, entries.toArray(new VCSEntry[entries.size()]), null);
return;
case DIFF:
if (!useSelection) {
// take all entries
entries = model.filter(VCSAction.DIFF, model.getEntries());
}
- UIActionHelper.showDiffUI(config, ui, location, entries.toArray(new VCSEntry[entries.size()]),null);
+ UIActionHelper.showDiffUI(config, getUi(), location, entries.toArray(new VCSEntry[entries.size()]), null);
return;
case REFRESH:
handler.doRefresh(model, entries, handler.getSelectionModel());
@@ -79,7 +79,7 @@
case DELETE:
case REVERT:
case UPDATE:
- UIActionHelper.showConfirmUI(config, ui, location, action, entries.toArray(new VCSEntry[entries.size()]),null);
+ UIActionHelper.showConfirmUI(config, getUi(), location, action, entries.toArray(new VCSEntry[entries.size()]), null);
return;
}
throw new IllegalStateException("could not perform action for action " + action + " (" + this + ')');
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -33,8 +33,8 @@
/** @author chemit */
public class ChangelogUIHandler extends AbstractTabOneFileUIHandler<ChangelogUIModel, ChangelogUI> {
- public ChangelogUIHandler(ChangelogUI ui, VCSConnexionConfig config) {
- super(ui, new ChangelogUIModel(),config, true);
+ public ChangelogUIHandler(ChangelogUI ui,ChangelogUIModel model, VCSConnexionConfig config) {
+ super(ui,model,config, true);
ui.setHandler(this);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -42,8 +42,8 @@
public class ConfirmUIHandler extends AbstractBasicUIHandler<ConfirmUIModel, ConfirmUI> {
- public ConfirmUIHandler(ConfirmUI ui, VCSConnexionConfig config) {
- super(ui, new ConfirmUIModel(),config, false);
+ public ConfirmUIHandler(ConfirmUI ui,ConfirmUIModel model, VCSConnexionConfig config) {
+ super(ui, model,config, false);
ui.setHandler(this);
}
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-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -45,8 +45,8 @@
protected List<Element> errors;
- public ConnexionConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
- super(ui, new ConnexionConfigUIModel(), config);
+ public ConnexionConfigUIHandler(ConnexionConfigUI ui,ConnexionConfigUIModel model, VCSConnexionConfig config) {
+ super(ui, model, config);
ui.setHandler(this);
errors = new ArrayList<Element>();
}
@@ -57,7 +57,7 @@
JPanel connexionPanel = ui.getConnexionPanel();
connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
- connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
+ connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
}
public void propertyChange(PropertyChangeEvent evt) {
@@ -137,40 +137,44 @@
switch (element) {
case connexion:
- modify = model.getMode() != model.getConfig().getMode();
+ modify = model.getMode() != model.getConfig().getConnexionMode();
break;
case login:
- modify = !model.getConfig().getUserName().equals(value);
+ modify = !value.equals(model.getConfig().getLogin());
break;
case sshLogin:
- modify = !model.getConfig().getUserName().equals(value);
+ modify = !value.equals(model.getConfig().getSshLogin());
break;
+ case password:
+ modify = !Arrays.toString(ui.getPassword().getPassword()).equals(model.getConfig().getPassword());
+ break;
case nopassphrase:
boolean b = ui.getNoPassPhrase().isSelected();
- modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
+ 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().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
+ if (model.getConfig().getSshPassphrase() == null || model.getConfig().getSshPassphrase().isEmpty()) {
modify2 = password.length == 0;
} else {
- modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
+ modify2 = model.getConfig().getSshPassphrase().equals(Arrays.toString(password));
}
if (modify2) {
model.addModified(passphrase);
}
}
break;
- case password:
- modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
+ case passphrase:
+ modify = !value.equals(model.getConfig().getSshPassphrase());
break;
case privateKeyFile:
- modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
+ modify = !value.equals(model.getConfig().getSshPrivateKeyFile() + "");
break;
- case passphrase:
- modify = !model.getConfig().getPassphrase().equals(value);
+
+ case workingCopyFile:
+ modify = !value.equals(model.getConfig().getWorkingCopyFile() + "");
break;
}
if (modify) {
@@ -200,18 +204,18 @@
protected void populateUI(ConnexionConfigUIModel model) {
ConnexionConfigUI ui = getUi();
VCSConnexionConfig config = model.getConfig();
- switch (config.getMode()) {
+ switch (config.getConnexionMode()) {
case ANONYMOUS:
break;
case PASSWORD:
- ui.getLogin().setText(config.getUserName());
- ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ ui.getLogin().setText(config.getLogin());
+ ui.getPassword().setText(config.getPassword() == null ? "" : config.getPassword());
break;
case SSH:
- ui.getSshLogin().setText(config.getUserName());
+ ui.getSshLogin().setText(config.getSshLogin());
ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
- ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
- ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ ui.getPrivateKeyFile().setText(config.getSshPrivateKeyFile() == null ? "" : config.getSshPrivateKeyFile().getAbsolutePath());
+ ui.getPassphrase().setText(config.getSshPassphrase() == null ? "" : config.getSshPassphrase());
break;
}
ui.getTestConnection().setEnabled(true);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -36,8 +36,8 @@
/** @author chemit */
public class DiffUIHandler extends AbstractTabOneFileUIHandler<DiffUIModel, DiffUI> {
- public DiffUIHandler(DiffUI ui, VCSConnexionConfig config) {
- super(ui, new DiffUIModel(), config,true);
+ public DiffUIHandler(DiffUI ui,DiffUIModel model, VCSConnexionConfig config) {
+ super(ui, model, config,true);
ui.setHandler(this);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -14,7 +14,6 @@
*/
package org.codelutin.vcs.ui.handler;
-import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.ui.GenerateSshKeyUI;
import org.codelutin.vcs.ui.GenerateSshKeyUI.Element;
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.dir;
@@ -26,6 +25,7 @@
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.model.GenerateSshKeyUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+import org.codelutin.vcs.VCSConnexionConfig;
import javax.swing.JComponent;
import javax.swing.text.JTextComponent;
@@ -42,8 +42,8 @@
protected List<Element> errors;
- public GenerateSshKeyUIHandler(GenerateSshKeyUI ui, VCSConnexionConfig config) {
- super(ui, new GenerateSshKeyUIModel(), config);
+ public GenerateSshKeyUIHandler(GenerateSshKeyUI ui,GenerateSshKeyUIModel model, VCSConnexionConfig config) {
+ super(ui, model, config);
ui.setHandler(this);
errors = new ArrayList<Element>();
}
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 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/IdentityUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -18,8 +18,8 @@
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.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;
@@ -35,9 +35,8 @@
protected List<Element> errors;
-
- public IdentityUIHandler(IdentityUI ui) {
- super(ui, new IdentityUIModel());
+ public IdentityUIHandler(IdentityUI ui,IdentityUIModel model) {
+ super(ui, model);
ui.setHandler(this);
errors = new ArrayList<Element>();
}
@@ -71,8 +70,8 @@
// compute modifed
setModified(element, ui);
}
- checkData(ui.getFirstname(), firstname);
- checkData(ui.getLastname(), lastname);
+ checkData(ui.getFirstName(), firstName);
+ checkData(ui.getLastName(), lastName);
checkData(ui.getEmail(), email);
return errors;
@@ -86,13 +85,13 @@
switch (element) {
case email:
- modify = !model.getEmail().equals(value);
+ modify = !model.getCurrent().getEmail().equals(value);
break;
- case firstname:
- modify = !model.getFirstname().equals(value);
+ case firstName:
+ modify = !model.getCurrent().getFirstName().equals(value);
break;
- case lastname:
- modify = !model.getLastname().equals(value);
+ case lastName:
+ modify = !model.getCurrent().getLastName().equals(value);
break;
}
if (modify) {
@@ -117,9 +116,9 @@
protected void populateUI(IdentityUIModel model) {
IdentityUI ui = getUi();
- ui.getFirstname().setText(model.getFirstname());
- ui.getLastname().setText(model.getLastname());
- ui.getEmail().setText(model.getEmail());
+ ui.getFirstName().setText(model.getCurrent().getFirstName());
+ ui.getLastName().setText(model.getCurrent().getLastName());
+ ui.getEmail().setText(model.getCurrent().getEmail());
}
protected void updateUI(List<Element> errors) {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -24,8 +24,8 @@
/** @author chemit */
public class SynchUIHandler extends AbstractTabUIHandler<SynchUIModel, SynchUI> {
- public SynchUIHandler(SynchUI ui, VCSConnexionConfig config) {
- super(ui, new SynchUIModel(), config, true);
+ public SynchUIHandler(SynchUI ui,SynchUIModel model, VCSConnexionConfig config) {
+ super(ui, model, config, true);
ui.setHandler(this);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -27,8 +27,8 @@
/** @author chemit */
public class TestUIHandler extends org.codelutin.ui.DialogUIHandler<TestUIModel, TestUI> {
- public TestUIHandler(TestUI ui) {
- super(ui, new TestUIModel());
+ public TestUIHandler(TestUI ui,TestUIModel model) {
+ super(ui, model);
ui.setHandler(this);
}
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-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -53,7 +53,7 @@
public void populate(VCSConnexionConfig config) {
this.config = config;
- setConnexionMode(config.getMode());
+ setConnexionMode(config.getConnexionMode());
setModified(false);
firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
@@ -79,7 +79,7 @@
break;
}
}
- if (mode == getConfig().getMode()) {
+ if (mode == getConfig().getConnexionMode()) {
removeModified(connexion);
} else {
addModified(connexion);
@@ -141,29 +141,37 @@
config.setConnexionMode(mode);
break;
case login:
- if (mode != VCSConnexionMode.ANONYMOUS) {
- config.setUserName(value);
+ if (mode == VCSConnexionMode.PASSWORD) {
+ config.setLogin(value);
}
break;
case nopassphrase:
if (mode == VCSConnexionMode.SSH) {
- config.setNoPassPhrase(Boolean.valueOf(value));
+ config.setSshPassphrase(null);
}
break;
case password:
if (mode == VCSConnexionMode.PASSWORD) {
- config.setPassPhrase(value);
+ config.setPassword(value);
}
case passphrase:
if (mode == VCSConnexionMode.SSH) {
- config.setPassPhrase(value);
+ config.setSshPassphrase(value);
}
break;
case privateKeyFile:
if (mode == VCSConnexionMode.SSH) {
- config.setKeyFile(new File(value));
+ config.setSshPrivateKeyFile(new File(value));
}
break;
+ case sshLogin:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setSshLogin(value);
+ }
+ break;
+ case workingCopyFile:
+ config.setWorkingCopyFile(new File(value));
+ break;
}
}
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 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/IdentityUIModel.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -17,10 +17,14 @@
import org.apache.commons.beanutils.BeanUtils;
import org.codelutin.ui.DialogUIModel;
+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 java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.List;
/**
@@ -34,31 +38,23 @@
public static final String MODIFIED_PROPERTY_CHANGED = "modify";
protected Object src;
- protected String firstname;
- protected String lastname;
- protected String email;
+ 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);
}
public void populate(Object src) {
this.src = src;
+ this.current.copyFrom(src);
- for (Element o : Element.values()) {
- try {
- String value = BeanUtils.getProperty(src, o.name());
- BeanUtils.setProperty(this, o.name(), value);
- } catch (IllegalAccessException e) {
- throw new IllegalStateException(e);
- } catch (InvocationTargetException e) {
- throw new IllegalStateException(e);
- } catch (NoSuchMethodException e) {
- throw new IllegalStateException(e);
- }
- }
setModified(false);
firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
}
@@ -67,30 +63,10 @@
populate(src);
}
- public String getEmail() {
- return email;
+ public IdentityConfig getCurrent() {
+ return current;
}
- public String getFirstname() {
- return firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
public boolean isModified() {
return !modifieds.isEmpty();
}
@@ -126,8 +102,8 @@
public void save(Element element, String value) {
switch (element) {
case email:
- case firstname:
- case lastname:
+ case firstName:
+ case lastName:
try {
BeanUtils.setProperty(src, element.name(), value);
} catch (IllegalAccessException e) {
Added: 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 (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -0,0 +1,192 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.model;
+
+import org.codelutin.vcs.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)
+ *
+ * @author chemit
+ */
+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
Property changes on: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/RootConfigUIModel.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/TestUIModel.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -19,7 +19,6 @@
import org.codelutin.vcs.VCSEntry;
import java.beans.PropertyChangeListener;
-import java.io.Serializable;
/**
* Model of a repository
@@ -32,7 +31,9 @@
public static final String SHOW_UI_PROPERTY_CHANGED = "showui";
protected VCSConnexion connexion;
- protected Serializable identity;
+
+ protected Object identity;
+
private VCSEntry[] entries;
public void setUIDef(DialogUIDef uiDef) {
@@ -47,7 +48,7 @@
return connexion;
}
- public Serializable getIdentity() {
+ public Object getIdentity() {
return identity;
}
@@ -63,7 +64,7 @@
this.entries = entries;
}
- public void setIdentity(Serializable identity) {
+ public void setIdentity(Object identity) {
this.identity = identity;
}
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractShowUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -1,39 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.vcs.ui.util;
-
-import org.codelutin.ui.DialogUI;
-import org.codelutin.ui.DialogUIDef;
-import org.codelutin.ui.DialogUIHandler;
-import org.codelutin.ui.DialogUIModel;
-import org.codelutin.ui.ShowUIAction;
-import org.codelutin.vcs.ui.VCSUIFactory;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public abstract class AbstractShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>, HH extends DialogUIHandler<?, ?>> extends ShowUIAction<M, U, H, HH> {
-
- private static final long serialVersionUID = 1L;
-
- public <UU extends DialogUI<HH>> AbstractShowUIAction(UU ui, DialogUIDef<M, U, H> uiDef, boolean showText) {
- super(ui, uiDef, VCSUIFactory.getInstance(), showText);
- }
-
- protected U initUI(ActionEvent e) {
- return getFactory().getUI(uiDef);
- }
-
-}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSShowUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSShowUIAction.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSShowUIAction.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -25,13 +25,13 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public abstract class AbstractVCSShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>, HH extends DialogUIHandler<?, ?>> extends ShowUIAction<M, U, H, HH> {
+public abstract class AbstractVCSShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends ShowUIAction<M, U, H> {
protected transient VCSConnexionConfig config;
private static final long serialVersionUID = 1L;
- public <UU extends DialogUI<HH>> AbstractVCSShowUIAction(UU ui, DialogUIDef<M, U, H> uiDef, boolean showText) {
+ public AbstractVCSShowUIAction(DialogUI<?> ui, DialogUIDef<M, U, H> uiDef, boolean showText) {
super(ui, uiDef, VCSUIFactory.getInstance(), showText);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java 2008-05-13 14:15:59 UTC (rev 656)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractFormUI.java 2008-05-13 14:16:07 UTC (rev 657)
@@ -23,8 +23,7 @@
*/
public abstract class AbstractFormUI<H extends AbstractUIHandler> extends org.codelutin.ui.DialogUI<H> {
- /*protected javax.swing.AbstractAction createHelpAction() {
- return org.codelutin.vcs.ui.action.HelpAction.createAction(this);
- }*/
-
+ public AbstractFormUI() {
+ super();
+ }
}
\ No newline at end of file
1
0
r656 - trunk/lutinvcs/ui/common/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:15:59 +0000 (Tue, 13 May 2008)
New Revision: 656
Modified:
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
Log:
refactor config + introduction factory de config
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-05-13 14:15:51 UTC (rev 655)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-05-13 14:15:59 UTC (rev 656)
@@ -1,3 +1,4 @@
+lutinvcs.accept=
lutinvcs.action.action.noselection=Action ''{0}'' (empty selection)
lutinvcs.action.confirm.all.tip=Perform action ''{0}'' on the signle matching file amoung {1} file(s)
lutinvcs.action.confirm.alls.tip=Perform action ''{0}'' on the {1} matching files amoung {2} files
@@ -36,6 +37,7 @@
lutinvcs.config.find.public.key=Public ssh key (*.pub) associated with the required private key
lutinvcs.config.find.ssh.dir=Change container dir of shh keys
lutinvcs.config.test.tip=Test connexion
+lutinvcs.config.workingCopyFile.change=
lutinvcs.configui.title=
lutinvcs.confirmui.title=
lutinvcs.diffui.title=
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-05-13 14:15:51 UTC (rev 655)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-05-13 14:15:59 UTC (rev 656)
@@ -1,3 +1,4 @@
+lutinvcs.accept=Accepter
lutinvcs.action.action.noselection=Action ''{0}'' (aucune s\u00E9lection)
lutinvcs.action.confirm.all.tip=Ex\u00E9cuter l''action ''{0}'' sur le seul fichier correspondant (parmis les {1} fichier(s)).
lutinvcs.action.confirm.alls.tip=Ex\u00E9cuter l''action ''{0}'' sur les {1} fichiers correspondants (parmis les {2} fichiers).
@@ -36,6 +37,7 @@
lutinvcs.config.find.public.key=Clef publique ssh (*.pub) associ\u00E9e \u00E0 la clef priv\u00E9e
lutinvcs.config.find.ssh.dir=Changer le r\u00E9pertoire contenant la paire de clef ssh g\u00E9n\u00E9r\u00E9
lutinvcs.config.test.tip=Tester la connexion
+lutinvcs.config.workingCopyFile.change=
lutinvcs.configui.title=Config UI
lutinvcs.confirmui.title=Confirm UI
lutinvcs.diffui.title=Diff UI
1
0
r655 - trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:15:51 +0000 (Tue, 13 May 2008)
New Revision: 655
Modified:
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHandler.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHelper.java
Log:
refactor config + introduction factory de config
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-05-13 14:15:42 UTC (rev 654)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-05-13 14:15:51 UTC (rev 655)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.VCSRootConfig;
import org.codelutin.vcs.type.VCSConnectionState;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.netbeans.lib.cvsclient.CVSRoot;
@@ -56,7 +57,8 @@
public String getRemoteUrl() {
checkInit();
- return (config.isUseSshConnexion() ? ":ext:" : ":pserver:") + config.getUserName() + "@" + config.getHostName() + config.getRemotePath();
+ return getURIResolver().resolv(config).toString();
+ //return (config.isUseSshConnexion() ? ":ext:" : ":pserver:") + config.getUserName() + "@" + config.getHostName() + config.getRemotePath();
}
protected Client getClient() {
@@ -70,30 +72,58 @@
// That will disable this message.
// d'ou l'initialisation syst�matique de la connexion.
+ VCSRootConfig rootConfig = getConfig().getRootConfig();
+ String hostName = rootConfig.getHost();
- String hostName = getConfig().getHostName();
-
// R�pertoire distant du CVS
- String repository = getConfig().getRemotePath();
+ String repository = rootConfig.getRepository();
- String userName = getConfig().getUserName();
+ String userName = getConfig().getLogin();
- Connection connection;
- if (getConfig().isUseSshConnexion()) {
- throw new RuntimeException(CVSHelper.class + " you can not used a ssh connexion with CVS, use instead SVN configuration");
- // connexion ssh2
- //TODO Make this works
- // Localisation de la clef priv�e (pour la connexion ssh2).
- //File keyFile = new File(config.getKeyFile());
- // Stockage des cl�s publics pour les hosts ou il y a eu connexion en ssh2
- //String host = config.getHost();
- // Localisation de la clef priv�e (pour la connexion ssh2).
- //File keyFile = new File(IsisConfig.getProperties().getProperty(
- // IsisConfig.CVS_KEY_FILE));
- // Stockage des cl�s publics pour les hosts ou il y a eu connexion en ssh2
- //String host = IsisConfig.getProperties().getProperty(
- // IsisConfig.CVS_HOST);
+ String cvsrootString;
+ PServerConnection PServerConnection;
+ Connection connection = null;
+ CVSRoot cvsroot;
+ switch (getConnexionMode()) {
+
+ case ANONYMOUS:
+ cvsrootString = ":pserver:" + userName + "@" + hostName + repository;
+ cvsroot = CVSRoot.parse(cvsrootString);
+ // connexion pserver
+ PServerConnection = new PServerConnection(cvsroot);
+ // PServerConnection.setUserName(userName);
+ // // PServerConnection.setEncodedPassword(encodedPassword);
+ // PServerConnection.setHostName(hostName);
+ // PServerConnection.setRepository(repository);
+ connection = PServerConnection;
+ break;
+ case PASSWORD:
+ cvsrootString = ":pserver:" + userName + "@" + hostName + repository;
+ cvsroot = CVSRoot.parse(cvsrootString);
+ // connexion pserver
+ PServerConnection = new PServerConnection(cvsroot);
+ // PServerConnection.setUserName(userName);
+ // // PServerConnection.setEncodedPassword(encodedPassword);
+ // PServerConnection.setHostName(hostName);
+ // PServerConnection.setRepository(repository);
+ connection = PServerConnection;
+ break;
+ case SSH:
+ throw new RuntimeException(CVSHelper.class + " you can not used a ssh connexion with CVS, use instead SVN configuration");
+ // connexion ssh2
+ //TODO Make this works
+ // Localisation de la clef priv�e (pour la connexion ssh2).
+ //File keyFile = new File(config.getKeyFile());
+ // Stockage des cl�s publics pour les hosts ou il y a eu connexion en ssh2
+ //String host = config.getHost();
+ // Localisation de la clef priv�e (pour la connexion ssh2).
+ //File keyFile = new File(IsisConfig.getProperties().getProperty(
+ // IsisConfig.CVS_KEY_FILE));
+ // Stockage des cl�s publics pour les hosts ou il y a eu connexion en ssh2
+ //String host = IsisConfig.getProperties().getProperty(
+ // IsisConfig.CVS_HOST);
+
// Ssh2Connexion ssh2Connection = new Ssh2Connexion();
// ssh2Connection.setUserName(userName);
// ssh2Connection.setHostName(hostName);
@@ -101,17 +131,7 @@
// ssh2Connection.setHost(host);
// ssh2Connection.setRepository(repository);
// connection = ssh2Connection;
- } else {
- String cvsrootString = ":pserver:" + userName + "@" + hostName + repository;
- CVSRoot cvsroot = CVSRoot.parse(cvsrootString);
- // connexion pserver
- PServerConnection PServerConnection;
- PServerConnection = new PServerConnection(cvsroot);
-// PServerConnection.setUserName(userName);
-// // PServerConnection.setEncodedPassword(encodedPassword);
-// PServerConnection.setHostName(hostName);
-// PServerConnection.setRepository(repository);
- connection = PServerConnection;
+// break;
}
// Le connexion est ouverte automatiquement � l'�x�cution de la
@@ -125,7 +145,8 @@
public GlobalOptions getGlobalOptions() {
checkInit();
GlobalOptions result = new GlobalOptions();
- String repository = getConfig().getRemotePath();
+ //String repository = getConfig().getRemotePath();
+ String repository = getConfig().getRootConfig().getRepository();
result.setCVSRoot(repository);
return result;
}
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHandler.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHandler.java 2008-05-13 14:15:42 UTC (rev 654)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHandler.java 2008-05-13 14:15:51 UTC (rev 655)
@@ -2,8 +2,8 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSConnexionConfig;
-import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.util.AbstractVCSHandler;
import org.netbeans.lib.cvsclient.command.FileInfoContainer;
@@ -31,9 +31,9 @@
public void initWorkingCopy() throws VCSException {
VCSConnexionConfig config = connexion.getConfig();
- File root = config.getLocalDatabasePath();
+ File root = config.getWorkingCopyFile();
- if (!root.exists()) config.getLocalDatabasePath().mkdirs();
+ if (!root.exists()) config.getWorkingCopyFile().mkdirs();
//TODO Should checkout root remote directory unrecurse ?
//TODO to have vcs configuration file present in local database directory
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHelper.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHelper.java 2008-05-13 14:15:42 UTC (rev 654)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSHelper.java 2008-05-13 14:15:51 UTC (rev 655)
@@ -89,7 +89,8 @@
* @throws VCSException TODO
*/
static public CVSCommandResult checkout(CVSConnexion connexion, File destdir, String module) throws VCSException {
- String data = connexion.getConfig().getRemoteDatabase();
+ String data = connexion.getConfig().getRootConfig().getRepository();
+ //String data = connexion.getConfig().getRemoteDatabase();
//TODO Fix bug when module is a multi path one, check there is no
//TODO File.separator
String sep = File.separator;
1
0
r654 - trunk/lutinvcs/ui/jaxx/src/main/resources/icons
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:15:42 +0000 (Tue, 13 May 2008)
New Revision: 654
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-connexionconfigui.png
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-configui.png
Log:
refactor config + introduction factory de config
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-configui.png
===================================================================
(Binary files differ)
Copied: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-connexionconfigui.png (from rev 630, trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-configui.png)
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-show-connexionconfigui.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0
r653 - trunk/lutinvcs/ui/jaxx/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:15:36 +0000 (Tue, 13 May 2008)
New Revision: 653
Modified:
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
Log:
refactor config + introduction factory de 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-13 14:15:29 UTC (rev 652)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-05-13 14:15:36 UTC (rev 653)
@@ -4,9 +4,9 @@
lutinvcs.config.anonymous=
lutinvcs.config.change.dir=Change dir
lutinvcs.config.email=
-lutinvcs.config.firstname=
+lutinvcs.config.firstName=
lutinvcs.config.generate=Generate
-lutinvcs.config.lastname=
+lutinvcs.config.lastName=
lutinvcs.config.message=
lutinvcs.config.pass=
lutinvcs.config.server.authenticationMethod=
@@ -20,6 +20,8 @@
lutinvcs.config.server.ssh.privateKeyFile=
lutinvcs.config.server.ssh.publicKeyFile=
lutinvcs.config.ssh=
+lutinvcs.config.workingCopyFile=
+lutinvcs.config.workingCopyFile.change=
lutinvcs.generateSshKey.message=Generate
lutinvcs.identity.message=
lutinvcs.no.config=
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-13 14:15:29 UTC (rev 652)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-05-13 14:15:36 UTC (rev 653)
@@ -4,9 +4,9 @@
lutinvcs.config.anonymous=anonyme
lutinvcs.config.change.dir=Changer le r\u00E9pertoire contenant les clef ssh g\u00E9n\u00E9r\u00E9es
lutinvcs.config.email=Courriel
-lutinvcs.config.firstname=Pr\u00E9nom
+lutinvcs.config.firstName=Pr\u00E9nom
lutinvcs.config.generate=G\u00E9n\u00E9rer
-lutinvcs.config.lastname=Nom
+lutinvcs.config.lastName=Nom
lutinvcs.config.message=Configuration de la connexion
lutinvcs.config.pass=password
lutinvcs.config.server.authenticationMethod=Connexion
@@ -20,6 +20,8 @@
lutinvcs.config.server.ssh.privateKeyFile=clef priv\u00E9e
lutinvcs.config.server.ssh.publicKeyFile=clef publique
lutinvcs.config.ssh=ssh
+lutinvcs.config.workingCopyFile=Base locale
+lutinvcs.config.workingCopyFile.change=Changer de base locale
lutinvcs.generateSshKey.message=G\u00E9n\u00E9rer
lutinvcs.identity.message=Configuration de votre identit\u00E9
lutinvcs.no.config=<Pas de configuration>
1
0
r652 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:15:29 +0000 (Tue, 13 May 2008)
New Revision: 652
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/JaxxIdentityUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
refactor config + introduction factory de config
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-13 14:14:17 UTC (rev 651)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-05-13 14:15:29 UTC (rev 652)
@@ -105,7 +105,7 @@
<row fill='horizontal'>
<cell columns="2" fill='both'>
<JToolBar id='rootHead' opaque='false' height='26'>
- <JComboBox id='rootsList' />
+ <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()"/>
@@ -121,6 +121,16 @@
</cell>
</row>
<row fill='horizontal'>
+ <cell columns="2" fill='horizontal'>
+ <JToolBar opaque='false' height="24">
+ <JLabel id='workingCopyFileLabel'/>
+ <JTextField id='workingCopyFile' onKeyReleased="doCheck(Element.workingCopyFile)"/>
+ <JButton id='changeWorkingCopyFile' icon='{createActionIcon("filechooser")}'
+ onActionPerformed="changeWorkingCopyFile()"/>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
<cell weightx='1'>
<JButton id='ok' onActionPerformed="save()"/>
</cell>
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 14:14:17 UTC (rev 651)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxIdentityUI.jaxx 2008-05-13 14:15:29 UTC (rev 652)
@@ -17,18 +17,18 @@
<Table>
<row fill='horizontal'>
<cell>
- <JLabel id='firstnameLabel'/>
+ <JLabel id='firstNameLabel'/>
</cell>
<cell>
- <JTextField id='firstname' onKeyReleased="doCheck(Element.firstname)"/>
+ <JTextField id='firstName' onKeyReleased="doCheck(Element.firstName)"/>
</cell>
</row>
<row fill='horizontal'>
<cell>
- <JLabel id='lastnameLabel'/>
+ <JLabel id='lastNameLabel'/>
</cell>
<cell>
- <JTextField id='lastname' onKeyReleased="doCheck(Element.lastname)"/>
+ <JTextField id='lastName' onKeyReleased="doCheck(Element.lastName)"/>
</cell>
</row>
<row fill='horizontal'>
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-13 14:14:17 UTC (rev 651)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-05-13 14:15:29 UTC (rev 652)
@@ -20,12 +20,12 @@
#identityLabel {
text: "lutinvcs.config.identiy";
}
-#firstnameLabel {
- text: "lutinvcs.config.firstname";
+#firstNameLabel {
+ text: "lutinvcs.config.firstName";
}
-#lastnameLabel {
- text: "lutinvcs.config.lastname";
+#lastNameLabel {
+ text: "lutinvcs.config.lastName";
}
#emailLabel {
@@ -73,6 +73,10 @@
text: "lutinvcs.config.server.ssh.privateKeyFile";
}
+#workingCopyFileLabel {
+ text: "lutinvcs.config.workingCopyFile";
+}
+
#changePrivateKeyFile {
toolTipText: "lutinvcs.config.server.ssh.key.change";
opaque:false;
@@ -80,6 +84,13 @@
margin:0;
}
+#changeWorkingCopyFile {
+ toolTipText: "lutinvcs.config.workingCopyFile.change";
+ opaque:false;
+ borderPainted:false;
+ margin:0;
+}
+
#changeDir {
toolTipText: "lutinvcs.config.change.dir";
opaque:false;
1
0
r651 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:14:17 +0000 (Tue, 13 May 2008)
New Revision: 651
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
Log:
refactor config + introduction factory de config
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-13 14:14:17 UTC (rev 651)
@@ -0,0 +1,121 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.util;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.*;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.type.VCSTypeRepo;
+
+import java.io.File;
+import java.util.EnumMap;
+
+/** @author chemit */
+public class SimpleVCSConnexionConfig extends org.codelutin.util.config.SimpleConfig<VCSConnexionConfigProperty> implements VCSConnexionConfig {
+
+ public SimpleVCSConnexionConfig() {
+ super(VCSConnexionConfigProperty.class);
+ }
+
+ public SimpleVCSConnexionConfig(EnumMap<VCSConnexionConfigProperty, Object> properties) {
+ super(VCSConnexionConfigProperty.class, properties);
+ }
+
+ public VCSRootConfig getRootConfig() {
+ return (VCSRootConfig) properties.get(rootConfig);
+ }
+
+ public VCSTypeRepo getTypeRepo() {
+ return (VCSTypeRepo) properties.get(typeRepo);
+ }
+
+ public String getTypeRepoValue() {
+ return (String) properties.get(typeRepoValue);
+ }
+
+ public File getWorkingCopyFile() {
+ return (File) properties.get(workingCopyFile);
+ }
+
+ public VCSConnexionMode getConnexionMode() {
+ return (VCSConnexionMode) properties.get(connexionMode);
+ }
+
+ public String getLogin() {
+ return (String) properties.get(login);
+ }
+
+ public String getPassword() {
+ return (String) properties.get(password);
+ }
+
+ public String getSshLogin() {
+ return (String) properties.get(sshLogin);
+ }
+
+ public String getSshPassphrase() {
+ return (String) properties.get(sshPassphrase);
+ }
+
+ public File getSshPrivateKeyFile() {
+ return (File) properties.get(sshPrivateKeyFile);
+ }
+
+ public void setRootConfig(VCSRootConfig newRootConfig) {
+ setProperty(rootConfig, newRootConfig);
+ }
+
+ public void setTypeRepo(VCSTypeRepo newTypeRepo) {
+ setProperty(typeRepo, newTypeRepo);
+ }
+
+ public void setTypeRepoValue(String newTypeRepoValue) {
+ setProperty(typeRepoValue, newTypeRepoValue);
+ }
+
+ public void setWorkingCopyFile(File newLocalDatabasePath) {
+ setProperty(workingCopyFile, newLocalDatabasePath);
+ }
+
+ public void setConnexionMode(VCSConnexionMode newConnexionMode) {
+ setProperty(connexionMode, newConnexionMode);
+ }
+
+ public void setLogin(String newLogin) {
+ setProperty(login, newLogin);
+ }
+
+ public void setPassword(String newPassword) {
+ setProperty(password, newPassword);
+ }
+
+ public void setSshLogin(String newSshLogin) {
+ setProperty(sshLogin, newSshLogin);
+ }
+
+ public void setSshPassphrase(String newSshPassphrase) {
+ setProperty(sshPassphrase, newSshPassphrase);
+ }
+
+ public void setSshPrivateKeyFile(File newSshPrivateKeyFile) {
+ setProperty(sshPrivateKeyFile, newSshPrivateKeyFile);
+ }
+
+ public boolean isNoPassPhrase() {
+ return getSshPassphrase() == null;
+ }
+}
1
0
r650 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:14:09 +0000 (Tue, 13 May 2008)
New Revision: 650
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java
Log:
refactor config + introduction factory de config
Copied: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java (from rev 630, trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java)
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConfigFactory.java 2008-05-13 14:14:09 UTC (rev 650)
@@ -0,0 +1,116 @@
+/* *##%
+* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
+* Benjamin Poussin, Tony Chemit
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*##%*/
+package org.codelutin.vcs;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.util.config.IdentityConfig;
+import org.codelutin.util.config.SimpleIdentityConfig;
+import org.codelutin.vcs.util.SimpleVCSConnexionConfig;
+import org.codelutin.vcs.util.SimpleVCSRootConfig;
+import org.codelutin.vcs.type.VCSConnexionConfigProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.EnumMap;
+
+/**
+ * This classes acts as a factory of {@link org.codelutin.vcs.VCSProvider}, and {@link org.codelutin.vcs.VCSConnexion}.
+ *
+ * @author chemit
+ * @see VCSConnexionConfig
+ * @see VCSRootConfig
+ */
+(a)org.codelutin.i18n.I18nable
+public class VCSConfigFactory {
+
+ static protected final Log log = LogFactory.getLog(VCSConfigFactory.class);
+
+ /**
+ * shared instance
+ */
+ static protected VCSConfigFactory instance;
+
+ /**
+ * root configs indexed by their name
+ */
+ protected final java.util.Map<String, VCSRootConfig> roots;
+
+ /**
+ * connexion configs indexed by their rootConfig name
+ */
+ protected final List<VCSConnexionConfig> connexions;
+
+
+ public static VCSConfigFactory getInstance() {
+ if (instance == null) {
+ instance = new VCSConfigFactory();
+ }
+ return instance;
+ }
+
+ public static IdentityConfig newIdentity(String firstName, String lastName, String email) {
+ IdentityConfig config = new SimpleIdentityConfig(firstName, lastName, email);
+ log.info(config);
+ return config;
+ }
+
+ public List<VCSRootConfig> getRoots() {
+ return new ArrayList<VCSRootConfig>(roots.values());
+ }
+
+ public List<VCSConnexionConfig> getConnexions() {
+ return connexions;
+ }
+
+ public static VCSRootConfig newRoot(String name, String type, String host, String repository, Integer port) {
+ if (getInstance().roots.containsKey(name)) {
+ // can not
+ throw new IllegalStateException("can not create roots " + name + ", already existing ");
+ }
+ VCSRootConfig config = new SimpleVCSRootConfig(name, type, host, repository, port);
+ log.info(config);
+ getInstance().roots.put(name, config);
+ return config;
+ }
+
+ public static VCSConnexionConfig newConnexion(String rootName, EnumMap<VCSConnexionConfigProperty, Object> props) {
+ if (!getInstance().roots.containsKey(rootName)) {
+ // can not
+ throw new IllegalStateException("unfound root " + rootName);
+ }
+
+ VCSConnexionConfig config = new SimpleVCSConnexionConfig(props);
+ if (props==null || !props.containsKey(VCSConnexionConfigProperty.rootConfig)) {
+ // force to add rootConfig
+ config.setRootConfig(getInstance().roots.get(rootName));
+ }
+ log.info(config);
+ getInstance().connexions.add(config);
+ return config;
+ }
+
+
+ protected VCSConfigFactory() {
+ roots = new java.util.HashMap<String, VCSRootConfig>();
+ connexions = new ArrayList<VCSConnexionConfig>();
+ }
+
+}
\ No newline at end of file
1
0
r649 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . util
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:14:01 +0000 (Tue, 13 May 2008)
New Revision: 649
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
Log:
refactor config + introduction factory de config
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-05-13 14:11:42 UTC (rev 648)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-05-13 14:14:01 UTC (rev 649)
@@ -61,7 +61,7 @@
* @return the mode of this connexion
* @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before.
*/
- VCSConnexionMode getMode() throws IllegalStateException;
+ VCSConnexionMode getConnexionMode() throws IllegalStateException;
/**
* @return the config of the connexion
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-05-13 14:11:42 UTC (rev 648)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-05-13 14:14:01 UTC (rev 649)
@@ -80,7 +80,7 @@
VCSFactory factory = getInstance();
// obtain matching provider
- VCSProvider<?, ?> provider = factory.getProvider(config.getType().toUpperCase());
+ VCSProvider<?, ?> provider = factory.getProvider(config.getRootConfig().getType().toUpperCase());
// delegate instanciation of connexion to provider
VCSConnexion connexion = provider.newConnection(config);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-05-13 14:11:42 UTC (rev 648)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-05-13 14:14:01 UTC (rev 649)
@@ -43,8 +43,11 @@
static protected final Log log = LogFactory.getLog(AbstractVCSConnexion.class);
protected File localRoot;
+
protected URI remoteRoot;
+
protected VCSConnectionState state;
+
protected VCSConnexionConfig config;
protected H handler;
@@ -65,19 +68,22 @@
public File getWorkingCopy() throws IllegalStateException {
checkInit();
if (localRoot == null) {
- localRoot = getConfig().getLocalDatabasePath();
+ localRoot = getConfig().getWorkingCopyFile();
}
return localRoot;
}
public URI getRemoteURI() throws IllegalStateException {
checkInit();
+ if (remoteRoot == null) {
+ remoteRoot = getURIResolver().resolv(config);
+ }
return remoteRoot;
}
- public VCSConnexionMode getMode() throws IllegalStateException {
+ public VCSConnexionMode getConnexionMode() throws IllegalStateException {
checkInit();
- return getConfig().getMode();
+ return getConfig().getConnexionMode();
}
public VCSConnexionConfig getConfig() throws IllegalStateException {
@@ -108,7 +114,7 @@
}
public boolean hasWriteAccess() {
- return !getConfig().isUseSshConnexion() && getMode() != VCSConnexionMode.ANONYMOUS;
+ return getConnexionMode() != VCSConnexionMode.ANONYMOUS;
}
public void addVCSHandlerEventListener(VCSConnexionEventListener l) {
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-05-13 14:11:42 UTC (rev 648)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-05-13 14:14:01 UTC (rev 649)
@@ -107,9 +107,9 @@
}
public void deleteWorkingCopy() {
- if (connexion.getConfig().getLocalDatabasePath().exists()) {
- FileUtil.deleteRecursively(connexion.getConfig().getLocalDatabasePath());
- connexion.getConfig().getLocalDatabasePath().delete();
+ if (connexion.getConfig().getWorkingCopyFile().exists()) {
+ FileUtil.deleteRecursively(connexion.getConfig().getWorkingCopyFile());
+ connexion.getConfig().getWorkingCopyFile().delete();
}
}
@@ -192,7 +192,7 @@
public boolean isFileInWorkingCopy(File file, boolean underVCS) {
if (file == null)
throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInWorkingCopy can not be invoked with some null parameter but was. [" + file + "," + this + "]");
- String rootPath = connexion.getConfig().getLocalDatabasePath().getAbsolutePath();
+ String rootPath = connexion.getConfig().getWorkingCopyFile().getAbsolutePath();
String localPath = file.getAbsolutePath();
if (localPath.startsWith(rootPath) && !underVCS) {
return true;
@@ -211,13 +211,13 @@
public void assertFileInWC(File file) {
if (!isFileInWorkingCopy(file, false))
- throw new VCSRuntimeException("the file [" + file + "] is not in the working copy [" + connexion.getConfig().getLocalDatabasePath() + "]");
+ throw new VCSRuntimeException("the file [" + file + "] is not in the working copy [" + connexion.getConfig().getWorkingCopyFile() + "]");
}
public String getRemoteRelativePath(File f) {
if (!isFileInWorkingCopy(f, false)) return null;
//System.out.println("file on vcs working copy : "+f);
- String rootPath = connexion.getConfig().getLocalDatabasePath().getAbsolutePath();
+ String rootPath = connexion.getConfig().getWorkingCopyFile().getAbsolutePath();
String localPath = f.getAbsolutePath();
if (!localPath.startsWith(rootPath)) return null;
localPath = localPath.substring(rootPath.length() + 1);
@@ -226,7 +226,7 @@
public String getLocalRelativePath(String remoteRelativePath) {
String localPath = convertToLocalName(remoteRelativePath);
- final File file = new File(connexion.getConfig().getLocalDatabasePath(), localPath);
+ final File file = new File(connexion.getConfig().getWorkingCopyFile(), localPath);
if (!isFileInWorkingCopy(file, false)) return null;
return localPath;
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-05-13 14:11:42 UTC (rev 648)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-05-13 14:14:01 UTC (rev 649)
@@ -15,13 +15,17 @@
package org.codelutin.vcs.util;
import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.type.VCSTypeRepo;
-import org.codelutin.vcs.type.VCSConnexionMode;
import java.io.File;
-/** @author chemit */
-public class VCSConnexionConfigImpl implements VCSConnexionConfig {
+/**
+ * POJO implementation of {@link VCSConnexionConfig}
+ *
+ * @author chemit
+ */
+public class VCSConnexionConfigImpl {
protected String type;
protected boolean useSshConnexion;
@@ -65,8 +69,8 @@
}
public String getPassphrase() {
- if (passPhrase==null) {
- passPhrase="";
+ if (passPhrase == null) {
+ passPhrase = "";
}
return passPhrase;
}
@@ -136,6 +140,6 @@
}
public void setConnexionMode(VCSConnexionMode mode) {
- this.mode=mode;
+ this.mode = mode;
}
}
1
0
r648 - trunk/lutinui/src/main/java/org/codelutin/ui
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 14:11:42 +0000 (Tue, 13 May 2008)
New Revision: 648
Modified:
trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java
Log:
refactor config
Modified: trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java
===================================================================
--- trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java 2008-05-13 13:24:16 UTC (rev 647)
+++ trunk/lutinui/src/main/java/org/codelutin/ui/DialogConfigUIHandler.java 2008-05-13 14:11:42 UTC (rev 648)
@@ -46,7 +46,7 @@
if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
- populateUI((M) evt.getNewValue());
+ populateUI();
doCheck(null);
return;
}
@@ -80,18 +80,7 @@
M 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;
- }
+ //TODO
if (modify) {
model.addModified(element);
} else if (model.getModifieds().contains(element)) {
@@ -158,7 +147,8 @@
}
for (E element : getModel().getModifieds()) {
String value = getUi().getElementValue(element);
- getModel().save(element, value);
+ //TODO
+ //getModel().save(element, value);
log.info("save " + element);
}
}
1
0
r647 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type
by tchemit@users.labs.libre-entreprise.org May 13, 2008
by tchemit@users.labs.libre-entreprise.org May 13, 2008
May 13, 2008
Author: tchemit
Date: 2008-05-13 13:24:16 +0000 (Tue, 13 May 2008)
New Revision: 647
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
Log:
refactor config
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-13 12:47:51 UTC (rev 646)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-05-13 13:24:16 UTC (rev 647)
@@ -9,33 +9,34 @@
* 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.
+ * - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
package org.codelutin.vcs.type;
-import org.codelutin.vcs.VCSConnexionConfig;
-
/**
- * Enumaration of properties useable in a {@link VCSConnexionConfig}
+ * Enumaration of properties useable in a {@link org.codelutin.vcs.VCSConnexionConfig}
*
* @author chemit
- * @see VCSConnexionConfig
+ * @see org.codelutin.vcs.VCSConnexionConfig
*/
public enum VCSConnexionConfigProperty {
/** property <code>rootConfig</code>, as a {@link org.codelutin.vcs.VCSRootConfig} */
rootConfig,
- /** property <code>connexionMode</code>, as a {@link org.codelutin.vcs.type.VCSConnexionMode} */
- connexionMode,
-
/** property <code>typeRepo</code>, type of repo to use, as a {@link VCSTypeRepo} */
typeRepo,
/** property <code>typeRepoValue</code>, the value associated to typeRepo (eg, branch or tag name, null for a head connexion) */
typeRepoValue,
+ /** property <code>workingCopyFile</code>, the location of local working copy, it null (no working copy declared) */
+ workingCopyFile,
+
+ /** property <code>connexionMode</code>, as a {@link org.codelutin.vcs.type.VCSConnexionMode} */
+ connexionMode,
+
/** property <code>login</code>, login for a password connexion */
login,
@@ -49,8 +50,5 @@
sshPassphrase,
/** property <code>sshPrivateKey</code>, path of the ssh private key file for a ssh connexion */
- sshPrivateKeyFile,
-
- /** property <code>localDatabasePath</code>, path of the local working copy */
- localDatabasePath
+ sshPrivateKeyFile
}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-05-13 12:47:51 UTC (rev 646)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-05-13 13:24:16 UTC (rev 647)
@@ -9,20 +9,19 @@
* 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.
+ * - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
package org.codelutin.vcs.type;
-import org.codelutin.vcs.VCSConnexionConfig;
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.sshPassphrase;
import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPrivateKeyFile;
-import java.util.EnumSet;
import java.util.Arrays;
+import java.util.EnumSet;
/**
* Enumaration of connexion mode.
@@ -31,7 +30,7 @@
*
* @author chemit
* @see VCSConnexionConfigProperty
- * @see VCSConnexionConfig
+ * @see org.codelutin.vcs.VCSConnexionConfig
*/
public enum VCSConnexionMode {
ANONYMOUS,
@@ -42,10 +41,10 @@
private final EnumSet<VCSConnexionConfigProperty> authenticationProperties;
VCSConnexionMode(VCSConnexionConfigProperty... authenticationProperties) {
- this.authenticationProperties = EnumSet.copyOf(Arrays.asList(authenticationProperties));
+ this.authenticationProperties = authenticationProperties.length == 0 ? EnumSet.noneOf(VCSConnexionConfigProperty.class) : EnumSet.copyOf(Arrays.asList(authenticationProperties));
}
public EnumSet<VCSConnexionConfigProperty> getAuthenticationProperties() {
return authenticationProperties;
}
-}
+}
\ No newline at end of file
1
0
r643 - in trunk/lutinvcs: core/src/main/java/org/codelutin/vcs core/src/main/java/org/codelutin/vcs/type core/src/main/java/org/codelutin/vcs/util provider/cvs/src/main/java/org/codelutin/vcs/provider provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs provider/mock/src/main/java/org/codelutin/vcs/provider provider/mock/src/main/java/org/codelutin/vcs/provider/mock provider/svn/src/main/java/org/codelutin/vcs/provider provider/svn/src/main/java/org/codelutin/vcs/provider/svn
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 14:15:39 +0000 (Sun, 27 Apr 2008)
New Revision: 643
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java
Log:
introduc VCSURIResolver contract, to resolv remote URI from a VCSConnnexionConfg.
Each provider acts as a VCSURIResolver factory via newURIResolver method.
Handler has his own resolver.
remove mode field from VCSConnexion, used the VCSConnexionConfig one instead.
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -36,6 +36,10 @@
public interface VCSCommon {
+ VCSURIResolver getURIResolver();
+
+ void setURIResolver(VCSURIResolver uriResolver);
+
/**
* init working copy, says if it is the first we use it it, we will checkout
* the databaseDirectory directory
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -26,7 +26,7 @@
* The method {@link #init(VCSConnexionConfig)} must be invoked before using the connexion.
* <p/>
* Note: you should not instanciate directly this class but use
- * {@link org.codelutin.vcs.VCSProvider#newConnection(org.codelutin.vcs.type.VCSConnexionMode , VCSConnexionConfig)} instead.
+ * {@link VCSProvider#newConnection(VCSConnexionConfig)} instead.
*
* @author chemit
*/
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -83,7 +83,7 @@
VCSProvider<?, ?> provider = factory.getProvider(config.getType().toUpperCase());
// delegate instanciation of connexion to provider
- VCSConnexion connexion = provider.newConnection(config.getMode(), config);
+ VCSConnexion connexion = provider.newConnection(config);
// init connexion
connexion.init(config);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -17,11 +17,12 @@
/**
* The contract to be realized to provide vcs communication.
* <p/>
- * The provider acts as a factory of {@link VCSConnexion}.
- *
+ * The provider acts as a factory of {@link VCSConnexion} and {@link VCSURIResolver}.
+ *
* @author chemit
- * @see org.codelutin.vcs.VCSHandler
- * @see org.codelutin.vcs.VCSConnexion
+ * @see VCSHandler
+ * @see VCSConnexion
+ * @see VCSURIResolver
*/
public interface VCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> {
@@ -34,15 +35,17 @@
/** @return the imclass of implementation of connexion to use for this provider */
Class<C> getConnexionImpl();
+ /** @return a new instance of {@link VCSURIResolver} */
+ VCSURIResolver newURIResolver();
+
/**
* Instanciate an new connexion for a given config, and init it.
* <p/>
* Note : <b>After this method connexion is init, but not opened.</b>
*
- * @param mode the mode required
* @param config the config to be used
* @return the new connexion initialized <b>but not opened</b>.
*/
- C newConnection(org.codelutin.vcs.type.VCSConnexionMode mode, VCSConnexionConfig config);
+ C newConnection(VCSConnexionConfig config);
}
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,26 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs;
+
+/**
+ * URI resolver from a config to build the remote vcs server uri to vcs root
+ *
+ * @author chemit
+ */
+public interface VCSURIResolver {
+
+ java.net.URI resolv(VCSConnexionConfig config);
+
+}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -33,7 +33,7 @@
UNDEFINED,
/**
* connexion was init, but not opened (default state after instanciate a new connexion from
- * {@link VCSProvider#newConnection(VCSConnexionMode, VCSConnexionConfig)}
+ * {@link VCSProvider#newConnection(VCSConnexionConfig)}
*/
INIT,
/** connexion was successfull opened, via {@link VCSConnexion#open()} */
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,56 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.type;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+/**
+ * Enumaration of properties useable in a {@link VCSConnexionConfig}
+ *
+ * @author chemit
+ * @see VCSConnexionConfig
+ */
+public enum VCSConnexionConfigProperty {
+
+ /** property <code>rootConfig</code>, as a {@link org.codelutin.vcs.VCSRootConfig} */
+ rootConfig,
+
+ /** property <code>connexionMode</code>, as a {@link org.codelutin.vcs.type.VCSConnexionMode} */
+ connexionMode,
+
+ /** property <code>typeRepo</code>, type of repo to use, as a {@link VCSTypeRepo} */
+ typeRepo,
+
+ /** property <code>typeRepoValue</code>, the value associated to typeRepo (eg, branch or tag name, null for a head connexion) */
+ typeRepoValue,
+
+ /** property <code>login</code>, login for a password connexion */
+ login,
+
+ /** property <code>password</code>, password for a password connexion */
+ password,
+
+ /** property <code>sshLogin</code>, login for a ssh connexion */
+ sshLogin,
+
+ /** property <code>sshPassphrase</code>, passphrase for a ssh connexion */
+ sshPassphrase,
+
+ /** property <code>sshPrivateKey</code>, path of the ssh private key file for a ssh connexion */
+ sshPrivateKeyFile,
+
+ /** property <code>localDatabasePath</code>, path of the local working copy */
+ localDatabasePath
+}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -14,33 +14,38 @@
*/
package org.codelutin.vcs.type;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_LOGIN;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_PASSWORD;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_LOGIN;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PASSPHRASE;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PRIVATE_KEY_FILE;
+import org.codelutin.vcs.VCSConnexionConfig;
+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.sshPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPrivateKeyFile;
+import java.util.EnumSet;
+import java.util.Arrays;
+
/**
* Enumaration of connexion mode.
* <p/>
* Each mode known the list of authentication properties required for a connexion.
*
* @author chemit
- * @see org.codelutin.vcs.VCSConnexionConfig
+ * @see VCSConnexionConfigProperty
+ * @see VCSConnexionConfig
*/
public enum VCSConnexionMode {
ANONYMOUS,
- PASSWORD(PROPERTY_LOGIN, PROPERTY_PASSWORD),
- SSH(PROPERTY_SSH_LOGIN, PROPERTY_SSH_PASSPHRASE, PROPERTY_SSH_PRIVATE_KEY_FILE);
+ PASSWORD(login, password),
+ SSH(sshLogin, sshPassphrase, sshPrivateKeyFile);
/** array of authentication properties required for this connexion mode. */
- private final String[] authenticationProperties;
+ private final EnumSet<VCSConnexionConfigProperty> authenticationProperties;
- VCSConnexionMode(String... authenticationProperties) {
- this.authenticationProperties = authenticationProperties;
+ VCSConnexionMode(VCSConnexionConfigProperty... authenticationProperties) {
+ this.authenticationProperties = EnumSet.copyOf(Arrays.asList(authenticationProperties));
}
- public String[] getAuthenticationProperties() {
+ public EnumSet<VCSConnexionConfigProperty> getAuthenticationProperties() {
return authenticationProperties;
}
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -22,6 +22,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSHandler;
+import org.codelutin.vcs.VCSURIResolver;
import org.codelutin.vcs.event.VCSConnexionEvent;
import org.codelutin.vcs.event.VCSConnexionEventListener;
import org.codelutin.vcs.type.VCSConnectionState;
@@ -43,7 +44,6 @@
protected File localRoot;
protected URI remoteRoot;
- protected VCSConnexionMode mode;
protected VCSConnectionState state;
protected VCSConnexionConfig config;
protected H handler;
@@ -51,8 +51,7 @@
protected ListenerSet<VCSConnexionEventListener> listeners = new ListenerSet<VCSConnexionEventListener>();
@SuppressWarnings({"unchecked"})
- protected AbstractVCSConnexion(VCSConnexionMode mode, H handler) {
- this.mode = mode;
+ protected AbstractVCSConnexion(H handler) {
this.handler = handler;
this.handler.setConnexion(this);
// by default, state is undefined before init
@@ -78,7 +77,7 @@
public VCSConnexionMode getMode() throws IllegalStateException {
checkInit();
- return mode;
+ return getConfig().getMode();
}
public VCSConnexionConfig getConfig() throws IllegalStateException {
@@ -252,6 +251,14 @@
return handler.hasProtocoleChanged();
}
+ public VCSURIResolver getURIResolver() {
+ return handler.getURIResolver();
+ }
+
+ public void setURIResolver(VCSURIResolver uriResolver) {
+ handler.setURIResolver(uriResolver);
+ }
+
protected void fireOpened() {
VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.OPEN);
for (VCSConnexionEventListener l : listeners) {
@@ -270,6 +277,7 @@
if (state == VCSConnectionState.UNDEFINED) {
throw new IllegalStateException(_("lutinvcs.error.connexion.noinit", this));
}
+ //TODO Should check config exists
}
protected void checkOpen() throws IllegalStateException {
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -26,6 +26,7 @@
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSHandler;
import org.codelutin.vcs.VCSRuntimeException;
+import org.codelutin.vcs.VCSURIResolver;
import org.codelutin.vcs.type.VCSTypeRepo;
import java.io.File;
@@ -55,6 +56,7 @@
protected final String confLocalDirName;
protected final String confLocalEntriesFilename;
protected C connexion;
+ protected VCSURIResolver uriResolver;
protected AbstractVCSHandler(final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
this.confLocalDirName = vCSConfLocalDirName;
@@ -71,6 +73,14 @@
};
}
+ public VCSURIResolver getURIResolver() {
+ return uriResolver;
+ }
+
+ public void setURIResolver(VCSURIResolver uriResolver) {
+ this.uriResolver = uriResolver;
+ }
+
public void setConnexion(C connexion) {
this.connexion = connexion;
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -14,14 +14,14 @@
*/
package org.codelutin.vcs.util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSHandler;
import org.codelutin.vcs.VCSProvider;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.VCSURIResolver;
/**
* base implementation of provider.
@@ -41,10 +41,15 @@
/** implementation of connexion to use */
private final Class<C> connexionImpl;
- protected AbstractVCSProvider(String name, Class<H> handlerImpl, Class<C> connexionImpl) {
+ /** implementation of {@link VCSURIResolver} to use */
+ private final Class<? extends VCSURIResolver> resolverImpl;
+
+
+ protected AbstractVCSProvider(String name, Class<H> handlerImpl, Class<C> connexionImpl, Class<? extends VCSURIResolver> resolverImpl) {
this.name = name;
this.handlerImpl = handlerImpl;
this.connexionImpl = connexionImpl;
+ this.resolverImpl = resolverImpl;
}
public final String getName() {
@@ -59,18 +64,19 @@
return handlerImpl;
}
- public C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) {
+ public C newConnection(VCSConnexionConfig config) {
H handler;
C connexion;
try {
handler = handlerImpl.newInstance();
+ handler.setURIResolver(newURIResolver());
} catch (Exception e) {
throw new RuntimeException(_("lutinvcs.error.provider.init.handler", handlerImpl, this, e.getCause()));
}
try {
- connexion = connexionImpl.getConstructor(VCSConnexionMode.class, handlerImpl).newInstance(mode, handler);
+ connexion = connexionImpl.getConstructor(handlerImpl).newInstance(handler);
// always init connexion from his config
connexion.init(config);
@@ -81,4 +87,13 @@
}
}
+ public VCSURIResolver newURIResolver() {
+ try {
+ return resolverImpl.newInstance();
+ } catch (InstantiationException e) {
+ throw new IllegalStateException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(e);
+ }
+ }
}
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,13 +16,14 @@
import org.codelutin.vcs.provider.cvs.CVSConnexion;
import org.codelutin.vcs.provider.cvs.CVSHandler;
+import org.codelutin.vcs.provider.cvs.CVSURIResolver;
import org.codelutin.vcs.util.AbstractVCSProvider;
/** @author chemit */
public class CVSProvider extends AbstractVCSProvider<CVSConnexion, CVSHandler> {
public CVSProvider() {
- super("CVS", CVSHandler.class, CVSConnexion.class);
+ super("CVS", CVSHandler.class, CVSConnexion.class, CVSURIResolver.class);
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -9,7 +9,7 @@
* 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.
+ * - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
package org.codelutin.vcs.provider.cvs;
@@ -17,7 +17,6 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
@@ -29,8 +28,8 @@
/** @author chemit */
public class CVSConnexion extends AbstractVCSConnexion<CVSHandler> {
- public CVSConnexion(VCSConnexionMode mode, CVSHandler handler) {
- super(mode, handler);
+ public CVSConnexion(CVSHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Added: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,27 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.provider.cvs;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+import java.net.URI;
+
+/** @author chemit */
+public class CVSURIResolver implements org.codelutin.vcs.VCSURIResolver {
+ public URI resolv(VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,13 +16,14 @@
import org.codelutin.vcs.provider.mock.MockConnexion;
import org.codelutin.vcs.provider.mock.MockHandler;
+import org.codelutin.vcs.provider.mock.MockURIResolver;
import org.codelutin.vcs.util.AbstractVCSProvider;
/** @author chemit */
public class MockProvider extends AbstractVCSProvider<MockConnexion, MockHandler> {
public MockProvider() {
- super("MOCK", MockHandler.class, MockConnexion.class);
+ super("MOCK", MockHandler.class, MockConnexion.class, MockURIResolver.class);
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -17,14 +17,13 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
/** @author chemit */
public class MockConnexion extends AbstractVCSConnexion<MockHandler> {
- public MockConnexion(VCSConnexionMode mode, MockHandler handler) {
- super(mode, handler);
+ public MockConnexion(MockHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -110,15 +110,15 @@
}
public String getChangeLog(File file) throws VCSException {
- return this+" changelog for : \n"+file+"... mock";
+ return this + " changelog for : \n" + file + "... mock";
}
public String getDiff(File file) throws VCSException, IOException {
- return this+" diff for : \n"+file+"... mock";
+ return this + " diff for : \n" + file + "... mock";
}
public String getDiff(File file, Object againstRevision) throws VCSException, IOException {
- return this+" diff for : \n"+file+"... mock";
+ return this + " diff for : \n" + file + "... mock";
}
public boolean hasProtocoleChanged() throws VCSException {
Added: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,25 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.provider.mock;
+
+import java.net.URI;
+
+/** @author chemit */
+public class MockURIResolver implements org.codelutin.vcs.VCSURIResolver {
+ public URI resolv(org.codelutin.vcs.VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
Modified: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.provider.svn.SVNConnexion;
import org.codelutin.vcs.provider.svn.SVNHandler;
+import org.codelutin.vcs.provider.svn.SVNURIResolver;
import org.codelutin.vcs.type.VCSTypeRepo;
import org.codelutin.vcs.util.AbstractVCSHandler;
import org.codelutin.vcs.util.AbstractVCSProvider;
@@ -45,9 +46,7 @@
private static boolean libraryInit;
public SVNProvider() {
-
- super("SVN", SVNHandler.class, SVNConnexion.class);
-
+ super("SVN", SVNHandler.class, SVNConnexion.class, SVNURIResolver.class);
setupLibrary();
}
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-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -20,7 +20,6 @@
import org.codelutin.vcs.VCSRuntimeException;
import org.codelutin.vcs.provider.SVNProvider;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
@@ -44,8 +43,8 @@
protected SVNWCClient ourWcClient;
- public SVNConnexion(VCSConnexionMode mode, SVNHandler handler) {
- super(mode, handler);
+ public SVNConnexion(SVNHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Added: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,28 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.provider.svn;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+import java.net.URI;
+
+/** @author chemit */
+public class SVNURIResolver implements org.codelutin.vcs.VCSURIResolver {
+
+ public URI resolv(VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
1
0
r642 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . type util
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 12:55:51 +0000 (Sun, 27 Apr 2008)
New Revision: 642
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java
Log:
introduce VCSRootConfig to represent a remote vcs host with a repository, no authentication is deal here.
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,48 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs;
+
+import org.codelutin.util.config.Config;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+
+/**
+ * Definition of a vcs root config comparable on his name.
+ *
+ * @author chemit
+ * @see VCSRootConfigProperty
+ * @see Config
+ */
+public interface VCSRootConfig extends Comparable<VCSRootConfig>, Config<VCSRootConfigProperty> {
+
+ String getName();
+
+ String getType();
+
+ String getHost();
+
+ String getRepository();
+
+ Integer getPort();
+
+ void setName(String name);
+
+ void setType(String type);
+
+ void setHost(String host);
+
+ void setPort(Integer port);
+
+ void setRepository(String repository);
+}
Copied: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java (from rev 640, trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java)
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,42 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.type;
+
+import org.codelutin.vcs.VCSRootConfig;
+
+/**
+ * Enumaration of properties to be used in a {@link VCSRootConfig}
+ *
+ * @author chemit
+ * @see VCSRootConfig
+ */
+public enum VCSRootConfigProperty {
+
+ /** property <code>name</code>, unique name of the root definition */
+ name,
+
+ /** property <code>type</code>, type of the root (eg, CVS,...), should match the name of a {@link org.codelutin.vcs.VCSProvider} */
+ type,
+
+ /** property <code>host</code>, host of the root (eg labs.libreentreprise.org) with no protocol information */
+ host,
+
+ /** property <code>repository</code>, relative path of vcs root on host (eg cvsroot/myModule) */
+ repository,
+
+ /** property <code>port</code>, the port used (if null, will use default vcs type port) */
+ port
+
+}
\ No newline at end of file
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,111 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.util;
+
+import org.codelutin.util.config.SimpleConfig;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.host;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.name;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.port;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.repository;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.type;
+
+import java.util.EnumMap;
+
+/** @author chemit */
+public class SimpleVCSRootConfig extends SimpleConfig<VCSRootConfigProperty> implements VCSRootConfig {
+
+ public SimpleVCSRootConfig() {
+ super(VCSRootConfigProperty.class);
+ }
+
+ public SimpleVCSRootConfig(EnumMap<VCSRootConfigProperty, Object> properties) {
+ super(VCSRootConfigProperty.class, properties);
+ }
+
+ public SimpleVCSRootConfig(String name, String type, String host, String repository, Integer port) {
+ this();
+ setName(name);
+ setType(type);
+ setHost(host);
+ setRepository(repository);
+ setPort(port);
+ }
+
+ public String getName() {
+ return (String) properties.get(name);
+ }
+
+ public String getType() {
+ return (String) properties.get(type);
+ }
+
+ public String getHost() {
+ return (String) properties.get(host);
+ }
+
+ public Integer getPort() {
+ return (Integer) properties.get(port);
+ }
+
+ public String getRepository() {
+ return (String) properties.get(repository);
+ }
+
+ public void setName(String newName) {
+ setProperty(name, newName);
+ }
+
+ public void setType(String newType) {
+ setProperty(type, newType);
+ }
+
+ public void setHost(String newHost) {
+ setProperty(host, newHost);
+ }
+
+ public void setPort(Integer newPort) {
+ setProperty(port, newPort);
+ }
+
+ public void setRepository(String newRepository) {
+ setProperty(repository, newRepository);
+ }
+
+ public int compareTo(VCSRootConfig o) {
+ String name = getName();
+ String oName = o.getName();
+ return name == null ? -1 : oName == null ? 1 : name.compareTo(oName);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SimpleConfig)) return false;
+
+ SimpleVCSRootConfig that = (SimpleVCSRootConfig) o;
+ String name = getName();
+ String oName = that.getName();
+ return !(name != null ? !name.equals(oName) : oName != null);
+ }
+
+ @Override
+ public int hashCode() {
+ String name = getName();
+ return (name != null ? name.hashCode() : 0);
+ }
+
+}
\ No newline at end of file
1
0
r641 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . util
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 10:24:07 +0000 (Sun, 27 Apr 2008)
New Revision: 641
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
Log:
improve generic type + remove unsued imports
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 10:23:27 UTC (rev 640)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 10:24:07 UTC (rev 641)
@@ -14,21 +14,16 @@
*/
package org.codelutin.vcs;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.VCSConnexion;
-import org.codelutin.vcs.VCSHandler;
-import org.codelutin.vcs.VCSConnexionConfig;
-
/**
* The contract to be realized to provide vcs communication.
* <p/>
- * Acts as a handler and connexion factory and manage a single handler instance
- *
+ * The provider acts as a factory of {@link VCSConnexion}.
+ *
* @author chemit
* @see org.codelutin.vcs.VCSHandler
* @see org.codelutin.vcs.VCSConnexion
*/
-public interface VCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> {
+public interface VCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> {
/** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
String getName();
@@ -48,6 +43,6 @@
* @param config the config to be used
* @return the new connexion initialized <b>but not opened</b>.
*/
- C newConnection(VCSConnexionMode mode, VCSConnexionConfig config);
+ C newConnection(org.codelutin.vcs.type.VCSConnexionMode mode, VCSConnexionConfig config);
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 10:23:27 UTC (rev 640)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 10:24:07 UTC (rev 641)
@@ -28,7 +28,7 @@
*
* @author chemit
*/
-public abstract class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> {
+public abstract class AbstractVCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> implements VCSProvider<C, H> {
static protected final Log log = LogFactory.getLog(AbstractVCSProvider.class);
1
0
r640 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 10:23:27 +0000 (Sun, 27 Apr 2008)
New Revision: 640
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
Log:
adding authentication properties list by connexion mode
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 08:42:16 UTC (rev 639)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 10:23:27 UTC (rev 640)
@@ -14,13 +14,33 @@
*/
package org.codelutin.vcs.type;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_LOGIN;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_PASSWORD;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_LOGIN;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PASSPHRASE;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PRIVATE_KEY_FILE;
+
/**
- * L'ensemble des typs de connexion VCS connues
+ * Enumaration of connexion mode.
+ * <p/>
+ * Each mode known the list of authentication properties required for a connexion.
*
* @author chemit
+ * @see org.codelutin.vcs.VCSConnexionConfig
*/
public enum VCSConnexionMode {
ANONYMOUS,
- PASSWORD,
- SSH
+ PASSWORD(PROPERTY_LOGIN, PROPERTY_PASSWORD),
+ SSH(PROPERTY_SSH_LOGIN, PROPERTY_SSH_PASSPHRASE, PROPERTY_SSH_PRIVATE_KEY_FILE);
+
+ /** array of authentication properties required for this connexion mode. */
+ private final String[] authenticationProperties;
+
+ VCSConnexionMode(String... authenticationProperties) {
+ this.authenticationProperties = authenticationProperties;
+ }
+
+ public String[] getAuthenticationProperties() {
+ return authenticationProperties;
+ }
}
1
0
r639 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:42:16 +0000 (Sun, 27 Apr 2008)
New Revision: 639
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-04-27 08:40:56 UTC (rev 638)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-04-27 08:42:16 UTC (rev 639)
@@ -3,7 +3,7 @@
<script>import static org.codelutin.vcs.ui.VCSUIFactory.*;</script>
<JToolBar>
<JButton id='showFirstLaunch' onActionPerformed="showUI(IDENTITY_UI)"/>
- <JButton id='showConfig' onActionPerformed="showUI(CONFIG_UI)" />
+ <JButton id='showConfig' onActionPerformed="showUI(CONNEXION_CONFIG_UI)" />
<JButton id='showSynch' onActionPerformed="showUI(SYNCH_UI)"/>
<Table fill='both' insets='0,0,0,0'>
<row>
1
0
r638 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:40:56 +0000 (Sun, 27 Apr 2008)
New Revision: 638
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
Log:
renommage ConfigUI en ConnexionConfigUI
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-04-27 08:40:06 UTC (rev 637)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-04-27 08:40:56 UTC (rev 638)
@@ -1,4 +1,4 @@
-<ConfigUI modal='true' resizable='false'>
+<ConnexionConfigUI modal='true' resizable='false'>
<style source="config.css"/>
<script>
import static org.codelutin.vcs.type.VCSConnexionMode.*;
@@ -130,4 +130,4 @@
</row>
</Table>
-</ConfigUI>
+</ConnexionConfigUI>
1
0
r637 - in trunk/lutinvcs: tools/src/test/java/org/codelutin/vcs ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:40:06 +0000 (Sun, 27 Apr 2008)
New Revision: 637
Modified:
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -54,7 +54,7 @@
log.info("show first launch ui "+firstModel.getIdentity());
return;
}
- if (uiDef == VCSUIFactory.CONFIG_UI) {
+ if (uiDef == VCSUIFactory.CONNEXION_CONFIG_UI) {
log.info("show config ui");
return;
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -59,13 +59,13 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONNEXION_CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
public static DialogUIDef[] defs() {
- return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI,TEST_UI};
+ return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI,TEST_UI};
}
protected static VCSUIFactory instance;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
+ CONNEXION_CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -29,7 +29,7 @@
private static final long serialVersionUID = 1L;
public ShowConfigAction(org.codelutin.ui.DialogUI ui, boolean showText) {
- super(ui, VCSUIFactory.CONFIG_UI, showText);
+ super(ui, VCSUIFactory.CONNEXION_CONFIG_UI, showText);
}
@Override
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -37,7 +37,7 @@
super.init();
// push icon and text in actions
initAction(VCSUIFactory.IDENTITY_UI, getUi().getShowFirstLaunch());
- initAction(VCSUIFactory.CONFIG_UI, getUi().getShowConfig());
+ initAction(VCSUIFactory.CONNEXION_CONFIG_UI, getUi().getShowConfig());
initAction(VCSUIFactory.SYNCH_UI, getUi().getShowSynch());
}
@@ -58,7 +58,7 @@
UIActionHelper.showIdentityUI(getModel().getIdentity(), getUi(), "bottom-left");
return;
}
- if (uiDef == VCSUIFactory.CONFIG_UI) {
+ if (uiDef == VCSUIFactory.CONNEXION_CONFIG_UI) {
UIActionHelper.showConfigUI(getModel().getConnexion().getConfig(), getUi(), "bottom-left");
return;
}
1
0
r636 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:39:32 +0000 (Sun, 27 Apr 2008)
New Revision: 636
Added:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
Removed:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
Log:
renommage ConfigUI en ConnexionConfigUI
Deleted: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-27 08:39:02 UTC (rev 635)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-27 08:39:32 UTC (rev 636)
@@ -1,133 +0,0 @@
-<ConfigUI modal='true' resizable='false'>
- <style source="config.css"/>
- <script>
- import static org.codelutin.vcs.type.VCSConnexionMode.*;
- import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
- import org.codelutin.vcs.ui.action.*;
- </script>
-
- <java.awt.CardLayout id='connexionPanelLayout'>
- <Table id='anonymousPanel' insets='2,2,2,2'>
- <row>
- <cell columns="3">
- <JLabel text="lutinvcs.no.config" enabled='false'/>
- </cell>
- </row>
- </Table>
- <Table id='passwordPanel' insets='2,2,2,2'>
- <row fill='horizontal'>
- <cell>
- <JLabel id='loginLabel'/>
- </cell>
- <cell>
- <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='passwordLabel' labelFor='{password}'/>
- </cell>
- <cell>
- <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
- </cell>
- </row>
- </Table>
- <Table id='sshPanel' opaque="false" insets='2,2,2,2'>
- <row fill='horizontal'>
- <cell>
- <JLabel id='sshLoginLabel'/>
- </cell>
- <cell>
- <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshLogin)"/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='passphraseLabel'/>
- </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()}'/>
- </JToolBar>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='privateKeyFileLabel'/>
- </cell>
- <cell>
- <JToolBar opaque='false' borderPainted='false' height="24">
- <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privateKeyFile)"/>
- <JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
- onActionPerformed="changePrivateKeyFile()"/>
- </JToolBar>
- </cell>
- </row>
- </Table>
- </java.awt.CardLayout>
-
- <JToolBar id='top' height='26'>
- <JLabel text='lutinvcs.config.message'/>
- <Table fill='both' insets='0,0,0,0'>
- <row>
- <cell fill='both'/>
- </row>
- </Table>
- <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>
-
- <JToolBar id='connexionHead' opaque='false' height='26'>
- <JLabel id='connexionModeLabel'/>
- <JRadioButton id='connexionModeAnonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
- <JRadioButton id='connexionModePassword' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
- <JRadioButton id='connexionModeSsh' onActionPerformed="changeAutheticationMode(SSH)"/>
- <Table fill='both' insets='0,0,0,0'>
- <row>
- <cell fill='both'/>
- </row>
- </Table>
- <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
- borderPainted='false'/>
- </JToolBar>
-
- <Table fill='both' insets="1,1,1,1">
- <row fill='horizontal'>
- <cell columns='2'>
- <JScrollPane columnHeaderView='{top}'>
- <JEditorPane id="doc"/>
- </JScrollPane>
- </cell>
- </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>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell columns="2" fill='both'>
- <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
- <JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
- </JScrollPane>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell weightx='1'>
- <JButton id='ok' onActionPerformed="save()"/>
- </cell>
- <cell weightx='1'>
- <JButton id='cancel' onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
-
-</ConfigUI>
Copied: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx (from rev 630, trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx)
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-04-27 08:39:32 UTC (rev 636)
@@ -0,0 +1,133 @@
+<ConfigUI modal='true' resizable='false'>
+ <style source="config.css"/>
+ <script>
+ import static org.codelutin.vcs.type.VCSConnexionMode.*;
+ import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
+ import org.codelutin.vcs.ui.action.*;
+ </script>
+
+ <java.awt.CardLayout id='connexionPanelLayout'>
+ <Table id='anonymousPanel' insets='2,2,2,2'>
+ <row>
+ <cell columns="3">
+ <JLabel text="lutinvcs.no.config" enabled='false'/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='passwordPanel' insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='loginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passwordLabel' labelFor='{password}'/>
+ </cell>
+ <cell>
+ <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='sshPanel' opaque="false" insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='sshLoginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshLogin)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passphraseLabel'/>
+ </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()}'/>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='privateKeyFileLabel'/>
+ </cell>
+ <cell>
+ <JToolBar opaque='false' borderPainted='false' height="24">
+ <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privateKeyFile)"/>
+ <JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
+ onActionPerformed="changePrivateKeyFile()"/>
+ </JToolBar>
+ </cell>
+ </row>
+ </Table>
+ </java.awt.CardLayout>
+
+ <JToolBar id='top' height='26'>
+ <JLabel text='lutinvcs.config.message'/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <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>
+
+ <JToolBar id='connexionHead' opaque='false' height='26'>
+ <JLabel id='connexionModeLabel'/>
+ <JRadioButton id='connexionModeAnonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
+ <JRadioButton id='connexionModePassword' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
+ <JRadioButton id='connexionModeSsh' onActionPerformed="changeAutheticationMode(SSH)"/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
+ borderPainted='false'/>
+ </JToolBar>
+
+ <Table fill='both' insets="1,1,1,1">
+ <row fill='horizontal'>
+ <cell columns='2'>
+ <JScrollPane columnHeaderView='{top}'>
+ <JEditorPane id="doc"/>
+ </JScrollPane>
+ </cell>
+ </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>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2" fill='both'>
+ <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
+ <JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell weightx='1'>
+ <JButton id='ok' onActionPerformed="save()"/>
+ </cell>
+ <cell weightx='1'>
+ <JButton id='cancel' onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+
+</ConfigUI>
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-27 08:39:02 UTC (rev 635)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-27 08:39:32 UTC (rev 636)
@@ -23,7 +23,7 @@
JaxxDiffUI.class,
JaxxChangelogUI.class,
JaxxConfirmUI.class,
- JaxxConfigUI.class,
+ JaxxConnexionConfigUI.class,
JaxxGenerateSshKeyUI.class,
JaxxIdentityUI.class,
JaxxTestUI.class);
1
0
r635 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action handler
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:39:02 +0000 (Sun, 27 Apr 2008)
New Revision: 635
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
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/VCSUIFactory.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
Log:
renommage ConfigUI en ConnexionConfigUI
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-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -18,7 +18,7 @@
import org.codelutin.ui.FormElement;
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.util.ui.AbstractUI;
import javax.swing.AbstractButton;
@@ -34,7 +34,7 @@
import java.util.Arrays;
/** @author chemit */
-public abstract class ConnexionConfigUI extends AbstractUI<ConfigUIHandler> {
+public abstract class ConnexionConfigUI extends AbstractUI<ConnexionConfigUIHandler> {
public enum Element implements FormElement<ConnexionConfigUI> {
connexion,
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -26,7 +26,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSFactory;
import org.codelutin.vcs.ui.handler.ChangelogUIHandler;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
import org.codelutin.vcs.ui.handler.DiffUIHandler;
import org.codelutin.vcs.ui.handler.IdentityUIHandler;
@@ -59,7 +59,7 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
+ CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -17,14 +17,14 @@
import org.codelutin.ui.DialogUIHandler;
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+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, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
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-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -20,14 +20,14 @@
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSFactory;
import org.codelutin.vcs.ui.ConnexionConfigUI;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
/** @author chemit */
-public class TestConnexionAction extends org.codelutin.ui.AbstractUIAction<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
+public class TestConnexionAction extends org.codelutin.ui.AbstractUIAction<ConnexionConfigUIHandler> {
private static final long serialVersionUID = 1L;
@@ -41,7 +41,7 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
checkInit();
- ConfigUIHandler uiHandler = getHandler();
+ ConnexionConfigUIHandler uiHandler = getHandler();
VCSConnexionConfig config = uiHandler.getConfig();
VCSConnexion connexion = VCSFactory.newConnexion(config);
ConnexionConfigUI ui = uiHandler.getUi();
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -1,288 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.vcs.ui.handler;
-
-import org.codelutin.vcs.VCSConnexionConfig;
-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;
-
-/** @author chemit */
-public class ConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
-
- protected List<Element> errors;
-
-
- public ConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
- super(ui, new ConnexionConfigUIModel(), config);
- ui.setHandler(this);
- errors = new ArrayList<Element>();
- }
-
- public void init() {
- super.init();
- ConnexionConfigUI ui = getUi();
- JPanel connexionPanel = ui.getConnexionPanel();
- connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
- connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
- connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
- }
-
- 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)) {
- 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;
- getUi().getOk().setEnabled(validConnexion);
- 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);
- }
- 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;
- }
-
- public void setModified(Element element, ConnexionConfigUI ui) {
- boolean modify = false;
- ConnexionConfigUIModel model = getModel();
-
- String value = ui.getElementValue(element);
-
- switch (element) {
- case connexion:
- modify = model.getMode() != model.getConfig().getMode();
- break;
- case login:
- modify = !model.getConfig().getUserName().equals(value);
- break;
- case sshLogin:
- modify = !model.getConfig().getUserName().equals(value);
- break;
- case nopassphrase:
- boolean b = ui.getNoPassPhrase().isSelected();
- modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
- if (!b) {
- model.removeModified(passphrase);
- } else {
- char[] password = ui.getPassphrase().getPassword();
- boolean modify2;
- if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
- modify2 = password.length == 0;
- } else {
- modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
- }
- if (modify2) {
- model.addModified(passphrase);
- }
- }
- break;
- case password:
- modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
- break;
- case privateKeyFile:
- modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
- break;
- case passphrase:
- modify = !model.getConfig().getPassphrase().equals(value);
- 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);
- }
- }
-
- public void doCheck(Element element) {
- List<Element> errors = validateModel(element);
- updateUI(errors);
- }
-
- public boolean isConfigValid() {
- return errors.isEmpty() && getModel().isConnexionState();
- }
-
- public void reset() {
- getModel().reset();
- }
-
- protected void populateUI(ConnexionConfigUIModel model) {
- ConnexionConfigUI ui = getUi();
- VCSConnexionConfig config = model.getConfig();
- switch (config.getMode()) {
- case ANONYMOUS:
- break;
- case PASSWORD:
- ui.getLogin().setText(config.getUserName());
- ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
- break;
- case SSH:
- ui.getSshLogin().setText(config.getUserName());
- ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
- ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
- ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
- break;
- }
- ui.getTestConnection().setEnabled(true);
- }
-
- 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:
- 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);
- ui.getConnexionModeSsh().setSelected(true);
- break;
- }
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- getUi().getConnexionPanelLayout().show(getUi().getConnexionPanel(), mode.name());
- getUi().pack();
- }
- });
- }
-
- 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
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java (from rev 633, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -0,0 +1,288 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.handler;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+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;
+
+/** @author chemit */
+public class ConnexionConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
+
+ protected List<Element> errors;
+
+
+ public ConnexionConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
+ super(ui, new ConnexionConfigUIModel(), config);
+ ui.setHandler(this);
+ errors = new ArrayList<Element>();
+ }
+
+ public void init() {
+ super.init();
+ ConnexionConfigUI ui = getUi();
+ JPanel connexionPanel = ui.getConnexionPanel();
+ connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
+ connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
+ connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
+ }
+
+ 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)) {
+ 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;
+ getUi().getOk().setEnabled(validConnexion);
+ 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);
+ }
+ 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;
+ }
+
+ public void setModified(Element element, ConnexionConfigUI ui) {
+ boolean modify = false;
+ ConnexionConfigUIModel model = getModel();
+
+ String value = ui.getElementValue(element);
+
+ switch (element) {
+ case connexion:
+ modify = model.getMode() != model.getConfig().getMode();
+ break;
+ case login:
+ modify = !model.getConfig().getUserName().equals(value);
+ break;
+ case sshLogin:
+ modify = !model.getConfig().getUserName().equals(value);
+ break;
+ case nopassphrase:
+ boolean b = ui.getNoPassPhrase().isSelected();
+ modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
+ if (!b) {
+ model.removeModified(passphrase);
+ } else {
+ char[] password = ui.getPassphrase().getPassword();
+ boolean modify2;
+ if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
+ modify2 = password.length == 0;
+ } else {
+ modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
+ }
+ if (modify2) {
+ model.addModified(passphrase);
+ }
+ }
+ break;
+ case password:
+ modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
+ break;
+ case privateKeyFile:
+ modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
+ break;
+ case passphrase:
+ modify = !model.getConfig().getPassphrase().equals(value);
+ 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);
+ }
+ }
+
+ public void doCheck(Element element) {
+ List<Element> errors = validateModel(element);
+ updateUI(errors);
+ }
+
+ public boolean isConfigValid() {
+ return errors.isEmpty() && getModel().isConnexionState();
+ }
+
+ public void reset() {
+ getModel().reset();
+ }
+
+ protected void populateUI(ConnexionConfigUIModel model) {
+ ConnexionConfigUI ui = getUi();
+ VCSConnexionConfig config = model.getConfig();
+ switch (config.getMode()) {
+ case ANONYMOUS:
+ break;
+ case PASSWORD:
+ ui.getLogin().setText(config.getUserName());
+ ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ case SSH:
+ ui.getSshLogin().setText(config.getUserName());
+ ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
+ ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
+ ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ }
+ ui.getTestConnection().setEnabled(true);
+ }
+
+ 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:
+ 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);
+ ui.getConnexionModeSsh().setSelected(true);
+ break;
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ getUi().getConnexionPanelLayout().show(getUi().getConnexionPanel(), mode.name());
+ getUi().pack();
+ }
+ });
+ }
+
+ 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
1
0
r634 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: action handler
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:38:39 +0000 (Sun, 27 Apr 2008)
New Revision: 634
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/handler/GenerateSshKeyUIHandler.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:28 UTC (rev 633)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:39 UTC (rev 634)
@@ -18,13 +18,13 @@
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
-import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.util.AbstractVCSShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-04-27 08:38:28 UTC (rev 633)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-04-27 08:38:39 UTC (rev 634)
@@ -23,7 +23,7 @@
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.nopassphrase;
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.passphrase;
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.values;
-import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.model.GenerateSshKeyUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
@@ -59,14 +59,14 @@
}
String action = evt.getPropertyName();
- if (ConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
populateUI((GenerateSshKeyUIModel) evt.getNewValue());
doCheck(null);
return;
}
- if (ConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
getUi().getReset().setEnabled(newValue != null && newValue);
getUi().getGenerate().setEnabled(isConfigValid());
1
0
r633 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . handler model
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:38:28 +0000 (Sun, 27 Apr 2008)
New Revision: 633
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:38:00 UTC (rev 632)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:38:28 UTC (rev 633)
@@ -34,7 +34,7 @@
import org.codelutin.vcs.ui.handler.SynchUIHandler;
import org.codelutin.vcs.ui.handler.TestUIHandler;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
-import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.model.ConfirmUIModel;
import org.codelutin.vcs.ui.model.DiffUIModel;
import org.codelutin.vcs.ui.model.IdentityUIModel;
@@ -59,7 +59,7 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConfigUIModel, ConnexionConfigUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler> CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConfigUIHandler.class, ConnexionConfigUI.class, ConfigUIModel.class,
+ CONFIG_UI = newDef(ConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:38:00 UTC (rev 632)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:38:28 UTC (rev 633)
@@ -25,7 +25,7 @@
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.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import javax.swing.JComponent;
@@ -40,13 +40,13 @@
import java.util.List;
/** @author chemit */
-public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConnexionConfigUI> {
+public class ConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
protected List<Element> errors;
public ConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
- super(ui, new ConfigUIModel(), config);
+ super(ui, new ConnexionConfigUIModel(), config);
ui.setHandler(this);
errors = new ArrayList<Element>();
}
@@ -66,19 +66,19 @@
}
String action = evt.getPropertyName();
- if (ConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
- populateUI((ConfigUIModel) evt.getNewValue());
+ populateUI((ConnexionConfigUIModel) evt.getNewValue());
doCheck(null);
return;
}
- if (ConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
updateUI((VCSConnexionMode) evt.getNewValue());
doCheck(null);
return;
}
- if (ConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
boolean modified = newValue != null && newValue;
getUi().getReset().setEnabled(modified);
@@ -86,7 +86,7 @@
return;
}
- if (ConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
boolean validConnexion = newValue != null && newValue;
getUi().getOk().setEnabled(validConnexion);
@@ -131,7 +131,7 @@
public void setModified(Element element, ConnexionConfigUI ui) {
boolean modify = false;
- ConfigUIModel model = getModel();
+ ConnexionConfigUIModel model = getModel();
String value = ui.getElementValue(element);
@@ -197,7 +197,7 @@
getModel().reset();
}
- protected void populateUI(ConfigUIModel model) {
+ protected void populateUI(ConnexionConfigUIModel model) {
ConnexionConfigUI ui = getUi();
VCSConnexionConfig config = model.getConfig();
switch (config.getMode()) {
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:38:00 UTC (rev 632)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:38:28 UTC (rev 633)
@@ -1,182 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * ##%
- */
-package org.codelutin.vcs.ui.model;
-
-import org.codelutin.vcs.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)
- *
- * @author chemit
- */
-public class ConfigUIModel 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 ConfigUIModel() {
- modifieds = new ArrayList<Element>();
- }
-
- public void populate(VCSConnexionConfig config) {
- this.config = config;
- setConnexionMode(config.getMode());
- 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().getMode()) {
- 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.ANONYMOUS) {
- config.setUserName(value);
- }
- break;
- case nopassphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setNoPassPhrase(Boolean.valueOf(value));
- }
- break;
- case password:
- if (mode == VCSConnexionMode.PASSWORD) {
- config.setPassPhrase(value);
- }
- case passphrase:
- if (mode == VCSConnexionMode.SSH) {
- config.setPassPhrase(value);
- }
- break;
- case privateKeyFile:
- if (mode == VCSConnexionMode.SSH) {
- config.setKeyFile(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
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java (from rev 632, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConnexionConfigUIModel.java 2008-04-27 08:38:28 UTC (rev 633)
@@ -0,0 +1,182 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.model;
+
+import org.codelutin.vcs.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)
+ *
+ * @author chemit
+ */
+public class ConnexionConfigUIModel 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 ConnexionConfigUIModel() {
+ modifieds = new ArrayList<Element>();
+ }
+
+ public void populate(VCSConnexionConfig config) {
+ this.config = config;
+ setConnexionMode(config.getMode());
+ 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().getMode()) {
+ 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.ANONYMOUS) {
+ config.setUserName(value);
+ }
+ break;
+ case nopassphrase:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setNoPassPhrase(Boolean.valueOf(value));
+ }
+ break;
+ case password:
+ if (mode == VCSConnexionMode.PASSWORD) {
+ config.setPassPhrase(value);
+ }
+ case passphrase:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setPassPhrase(value);
+ }
+ break;
+ case privateKeyFile:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setKeyFile(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
1
0
r632 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action handler model
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:38:00 +0000 (Sun, 27 Apr 2008)
New Revision: 632
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/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/ConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
Log:
renommage ConfigUI en ConnexionConfigUI
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java 2008-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -1,199 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.vcs.ui;
-
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.ui.FormElement;
-import org.codelutin.util.FileUtil;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
-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 ConfigConnexionUI extends AbstractUI<ConfigUIHandler> {
-
- public enum Element implements FormElement<ConfigConnexionUI> {
- connexion,
- login,
- sshLogin,
- password,
- passphrase,
- nopassphrase,
- privateKeyFile;
-
- public Object getValue(ConfigConnexionUI ui) {
- return ui.getElementValue(this);
- }
-
- public void setValue(ConfigConnexionUI ui, String value) {
- //TODO
- JComponent component = ui.getElement(this);
- }
-
- public JLabel getLabel(ConfigConnexionUI ui) {
- return ui.getElementLabel(this);
- }
- }
-
- public abstract ButtonGroup getConnexionMode();
-
- public abstract AbstractButton getChangePrivateKeyFile();
-
- public abstract AbstractButton getGenerateKey();
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
- public abstract AbstractButton getTestConnection();
-
- public abstract AbstractButton getAddRoot();
-
- public abstract AbstractButton getDeleteRoot();
-
- 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();
-
- public abstract JRadioButton getConnexionModePassword();
-
- public abstract JRadioButton getConnexionModeSsh();
-
- public abstract JTextField getLogin();
-
- public abstract JTextField getSshLogin();
-
- public abstract JPasswordField getPassword();
-
- public abstract JPasswordField getPassphrase();
-
- public abstract JCheckBox getNoPassPhrase();
-
- public abstract JTextField getPrivateKeyFile();
-
- public abstract JLabel getLoginLabel();
-
- public abstract JLabel getSshLoginLabel();
-
- public abstract JLabel getPasswordLabel();
-
- public abstract JLabel getPassphraseLabel();
-
- public abstract JLabel getPrivateKeyFileLabel();
-
- public abstract javax.swing.JPanel getConnexionPanel();
-
- public abstract java.awt.CardLayout getConnexionPanelLayout();
-
- public abstract javax.swing.JPanel getAnonymousPanel();
-
- public abstract javax.swing.JPanel getPasswordPanel();
-
- public abstract javax.swing.JPanel getSshPanel();
-
- 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);
- }
-
- protected void changePrivateKeyFile() {
- //TODO add title in lutinutil :)
- 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);
- }
- }
-
- protected void generateKey() {
- //TODO
- }
-
- protected void editRoot() {
- //TODO
- }
-
- protected void addRoot() {
- //TODO
- }
-
- protected void deleteRoot() {
- //TODO
- }
-
-}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java (from rev 631, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -0,0 +1,199 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.ui.FormElement;
+import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+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<ConfigUIHandler> {
+
+ public enum Element implements FormElement<ConnexionConfigUI> {
+ connexion,
+ login,
+ sshLogin,
+ password,
+ passphrase,
+ nopassphrase,
+ privateKeyFile;
+
+ 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();
+
+ public abstract AbstractButton getGenerateKey();
+
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancel();
+
+ public abstract AbstractButton getTestConnection();
+
+ public abstract AbstractButton getAddRoot();
+
+ public abstract AbstractButton getDeleteRoot();
+
+ 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();
+
+ public abstract JRadioButton getConnexionModePassword();
+
+ public abstract JRadioButton getConnexionModeSsh();
+
+ public abstract JTextField getLogin();
+
+ public abstract JTextField getSshLogin();
+
+ public abstract JPasswordField getPassword();
+
+ public abstract JPasswordField getPassphrase();
+
+ public abstract JCheckBox getNoPassPhrase();
+
+ public abstract JTextField getPrivateKeyFile();
+
+ public abstract JLabel getLoginLabel();
+
+ public abstract JLabel getSshLoginLabel();
+
+ public abstract JLabel getPasswordLabel();
+
+ public abstract JLabel getPassphraseLabel();
+
+ public abstract JLabel getPrivateKeyFileLabel();
+
+ public abstract javax.swing.JPanel getConnexionPanel();
+
+ public abstract java.awt.CardLayout getConnexionPanelLayout();
+
+ public abstract javax.swing.JPanel getAnonymousPanel();
+
+ public abstract javax.swing.JPanel getPasswordPanel();
+
+ public abstract javax.swing.JPanel getSshPanel();
+
+ 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);
+ }
+
+ protected void changePrivateKeyFile() {
+ //TODO add title in lutinutil :)
+ 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);
+ }
+ }
+
+ protected void generateKey() {
+ //TODO
+ }
+
+ protected void editRoot() {
+ //TODO
+ }
+
+ protected void addRoot() {
+ //TODO
+ }
+
+ protected void deleteRoot() {
+ //TODO
+ }
+
+}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -59,7 +59,7 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConfigUIModel, ConfigConnexionUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConfigUIModel, ConnexionConfigUI, ConfigUIHandler> CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConfigUIHandler.class, ConfigConnexionUI.class, ConfigUIModel.class,
+ CONFIG_UI = newDef(ConfigUIHandler.class, ConnexionConfigUI.class, ConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.ui.DialogUIHandler;
-import org.codelutin.vcs.ui.ConfigConnexionUI;
+import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
import org.codelutin.vcs.ui.model.ConfigUIModel;
@@ -24,7 +24,7 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConfigConnexionUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
@@ -33,8 +33,8 @@
}
@Override
- protected ConfigConnexionUI initUI(ActionEvent e) {
- ConfigConnexionUI ui = super.initUI(e);
+ protected ConnexionConfigUI initUI(ActionEvent e) {
+ ConnexionConfigUI ui = super.initUI(e);
ui.getHandler().getModel().populate(getConfig());
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-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -19,7 +19,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSFactory;
-import org.codelutin.vcs.ui.ConfigConnexionUI;
+import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
import javax.swing.JOptionPane;
@@ -32,7 +32,7 @@
private static final long serialVersionUID = 1L;
- public TestConnexionAction(ConfigConnexionUI ui) {
+ public TestConnexionAction(ConnexionConfigUI ui) {
super(null, org.codelutin.ui.UIHelper.createActionIcon("testconnexion"), ui);
putValue(SHORT_DESCRIPTION, org.codelutin.i18n.I18n._("lutinvcs.config.test.tip"));
//putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
@@ -44,7 +44,7 @@
ConfigUIHandler uiHandler = getHandler();
VCSConnexionConfig config = uiHandler.getConfig();
VCSConnexion connexion = VCSFactory.newConnexion(config);
- ConfigConnexionUI ui = uiHandler.getUi();
+ ConnexionConfigUI ui = uiHandler.getUi();
boolean result = false;
try {
connexion.testConnection();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -16,15 +16,15 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConfigConnexionUI;
-import org.codelutin.vcs.ui.ConfigConnexionUI.Element;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.login;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.password;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.sshLogin;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.values;
+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.ConfigUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
@@ -40,12 +40,12 @@
import java.util.List;
/** @author chemit */
-public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConfigConnexionUI> {
+public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConnexionConfigUI> {
protected List<Element> errors;
- public ConfigUIHandler(ConfigConnexionUI ui, VCSConnexionConfig config) {
+ public ConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
super(ui, new ConfigUIModel(), config);
ui.setHandler(this);
errors = new ArrayList<Element>();
@@ -53,7 +53,7 @@
public void init() {
super.init();
- ConfigConnexionUI ui = getUi();
+ ConnexionConfigUI ui = getUi();
JPanel connexionPanel = ui.getConnexionPanel();
connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
@@ -98,7 +98,7 @@
public synchronized List<Element> validateModel(Element element) {
errors.clear();
- ConfigConnexionUI ui = getUi();
+ ConnexionConfigUI ui = getUi();
if (element != null) {
// compute modifed
setModified(element, ui);
@@ -129,7 +129,7 @@
return errors;
}
- public void setModified(Element element, ConfigConnexionUI ui) {
+ public void setModified(Element element, ConnexionConfigUI ui) {
boolean modify = false;
ConfigUIModel model = getModel();
@@ -198,7 +198,7 @@
}
protected void populateUI(ConfigUIModel model) {
- ConfigConnexionUI ui = getUi();
+ ConnexionConfigUI ui = getUi();
VCSConnexionConfig config = model.getConfig();
switch (config.getMode()) {
case ANONYMOUS:
@@ -218,7 +218,7 @@
}
protected void updateUI(final VCSConnexionMode mode) {
- ConfigConnexionUI ui = getUi();
+ ConnexionConfigUI ui = getUi();
//getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
switch (mode) {
case ANONYMOUS:
@@ -246,7 +246,7 @@
}
protected void updateUI(List<Element> errors) {
- ConfigConnexionUI ui = getUi();
+ ConnexionConfigUI ui = getUi();
boolean valid = isConfigValid();
ui.getOk().setEnabled(valid && getModel().isModified());
//ui.getTestConnection().setEnabled(valid);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:36:35 UTC (rev 631)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:38:00 UTC (rev 632)
@@ -16,14 +16,14 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConfigConnexionUI.Element;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.connexion;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.login;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.password;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.sshLogin;
+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;
1
0
r631 - in trunk/lutinvcs/ui: common/src/main/java/org/codelutin/vcs/ui common/src/main/java/org/codelutin/vcs/ui/action 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 April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:36:35 +0000 (Sun, 27 Apr 2008)
New Revision: 631
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/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/ConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx
Log:
renommage ConfigUI en ConfigConnexionUI
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java (from rev 630, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigConnexionUI.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -0,0 +1,199 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.ui.FormElement;
+import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+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 ConfigConnexionUI extends AbstractUI<ConfigUIHandler> {
+
+ public enum Element implements FormElement<ConfigConnexionUI> {
+ connexion,
+ login,
+ sshLogin,
+ password,
+ passphrase,
+ nopassphrase,
+ privateKeyFile;
+
+ public Object getValue(ConfigConnexionUI ui) {
+ return ui.getElementValue(this);
+ }
+
+ public void setValue(ConfigConnexionUI ui, String value) {
+ //TODO
+ JComponent component = ui.getElement(this);
+ }
+
+ public JLabel getLabel(ConfigConnexionUI ui) {
+ return ui.getElementLabel(this);
+ }
+ }
+
+ public abstract ButtonGroup getConnexionMode();
+
+ public abstract AbstractButton getChangePrivateKeyFile();
+
+ public abstract AbstractButton getGenerateKey();
+
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancel();
+
+ public abstract AbstractButton getTestConnection();
+
+ public abstract AbstractButton getAddRoot();
+
+ public abstract AbstractButton getDeleteRoot();
+
+ 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();
+
+ public abstract JRadioButton getConnexionModePassword();
+
+ public abstract JRadioButton getConnexionModeSsh();
+
+ public abstract JTextField getLogin();
+
+ public abstract JTextField getSshLogin();
+
+ public abstract JPasswordField getPassword();
+
+ public abstract JPasswordField getPassphrase();
+
+ public abstract JCheckBox getNoPassPhrase();
+
+ public abstract JTextField getPrivateKeyFile();
+
+ public abstract JLabel getLoginLabel();
+
+ public abstract JLabel getSshLoginLabel();
+
+ public abstract JLabel getPasswordLabel();
+
+ public abstract JLabel getPassphraseLabel();
+
+ public abstract JLabel getPrivateKeyFileLabel();
+
+ public abstract javax.swing.JPanel getConnexionPanel();
+
+ public abstract java.awt.CardLayout getConnexionPanelLayout();
+
+ public abstract javax.swing.JPanel getAnonymousPanel();
+
+ public abstract javax.swing.JPanel getPasswordPanel();
+
+ public abstract javax.swing.JPanel getSshPanel();
+
+ 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);
+ }
+
+ protected void changePrivateKeyFile() {
+ //TODO add title in lutinutil :)
+ 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);
+ }
+ }
+
+ protected void generateKey() {
+ //TODO
+ }
+
+ protected void editRoot() {
+ //TODO
+ }
+
+ protected void addRoot() {
+ //TODO
+ }
+
+ protected void deleteRoot() {
+ //TODO
+ }
+
+}
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -1,199 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.vcs.ui;
-
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.ui.FormElement;
-import org.codelutin.util.FileUtil;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
-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 ConfigUI extends AbstractUI<ConfigUIHandler> {
-
- public enum Element implements FormElement<ConfigUI> {
- connexion,
- login,
- sshLogin,
- password,
- passphrase,
- nopassphrase,
- privateKeyFile;
-
- public Object getValue(ConfigUI ui) {
- return ui.getElementValue(this);
- }
-
- public void setValue(ConfigUI ui, String value) {
- //TODO
- JComponent component = ui.getElement(this);
- }
-
- public JLabel getLabel(ConfigUI ui) {
- return ui.getElementLabel(this);
- }
- }
-
- public abstract ButtonGroup getConnexionMode();
-
- public abstract AbstractButton getChangePrivateKeyFile();
-
- public abstract AbstractButton getGenerateKey();
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
- public abstract AbstractButton getTestConnection();
-
- public abstract AbstractButton getAddRoot();
-
- public abstract AbstractButton getDeleteRoot();
-
- 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();
-
- public abstract JRadioButton getConnexionModePassword();
-
- public abstract JRadioButton getConnexionModeSsh();
-
- public abstract JTextField getLogin();
-
- public abstract JTextField getSshLogin();
-
- public abstract JPasswordField getPassword();
-
- public abstract JPasswordField getPassphrase();
-
- public abstract JCheckBox getNoPassPhrase();
-
- public abstract JTextField getPrivateKeyFile();
-
- public abstract JLabel getLoginLabel();
-
- public abstract JLabel getSshLoginLabel();
-
- public abstract JLabel getPasswordLabel();
-
- public abstract JLabel getPassphraseLabel();
-
- public abstract JLabel getPrivateKeyFileLabel();
-
- public abstract javax.swing.JPanel getConnexionPanel();
-
- public abstract java.awt.CardLayout getConnexionPanelLayout();
-
- public abstract javax.swing.JPanel getAnonymousPanel();
-
- public abstract javax.swing.JPanel getPasswordPanel();
-
- public abstract javax.swing.JPanel getSshPanel();
-
- 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);
- }
-
- protected void changePrivateKeyFile() {
- //TODO add title in lutinutil :)
- 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);
- }
- }
-
- protected void generateKey() {
- //TODO
- }
-
- protected void editRoot() {
- //TODO
- }
-
- protected void addRoot() {
- //TODO
- }
-
- protected void deleteRoot() {
- //TODO
- }
-
-}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -59,7 +59,7 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConfigUIModel, ConfigUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConfigUIModel, ConfigConnexionUI, ConfigUIHandler> CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConfigUIHandler.class, ConfigUI.class, ConfigUIModel.class,
+ CONFIG_UI = newDef(ConfigUIHandler.class, ConfigConnexionUI.class, ConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.ui.DialogUIHandler;
-import org.codelutin.vcs.ui.ConfigUI;
+import org.codelutin.vcs.ui.ConfigConnexionUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
import org.codelutin.vcs.ui.model.ConfigUIModel;
@@ -24,7 +24,7 @@
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConfigConnexionUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
@@ -33,8 +33,8 @@
}
@Override
- protected ConfigUI initUI(ActionEvent e) {
- ConfigUI ui = super.initUI(e);
+ protected ConfigConnexionUI initUI(ActionEvent e) {
+ ConfigConnexionUI ui = super.initUI(e);
ui.getHandler().getModel().populate(getConfig());
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-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -19,7 +19,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSFactory;
-import org.codelutin.vcs.ui.ConfigUI;
+import org.codelutin.vcs.ui.ConfigConnexionUI;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
import javax.swing.JOptionPane;
@@ -32,7 +32,7 @@
private static final long serialVersionUID = 1L;
- public TestConnexionAction(org.codelutin.vcs.ui.ConfigUI ui) {
+ public TestConnexionAction(ConfigConnexionUI ui) {
super(null, org.codelutin.ui.UIHelper.createActionIcon("testconnexion"), ui);
putValue(SHORT_DESCRIPTION, org.codelutin.i18n.I18n._("lutinvcs.config.test.tip"));
//putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
@@ -44,7 +44,7 @@
ConfigUIHandler uiHandler = getHandler();
VCSConnexionConfig config = uiHandler.getConfig();
VCSConnexion connexion = VCSFactory.newConnexion(config);
- ConfigUI ui = uiHandler.getUi();
+ ConfigConnexionUI ui = uiHandler.getUi();
boolean result = false;
try {
connexion.testConnection();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -16,15 +16,15 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConfigUI;
-import org.codelutin.vcs.ui.ConfigUI.Element;
-import static org.codelutin.vcs.ui.ConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConfigUI.Element.sshLogin;
-import static org.codelutin.vcs.ui.ConfigUI.Element.values;
+import org.codelutin.vcs.ui.ConfigConnexionUI;
+import org.codelutin.vcs.ui.ConfigConnexionUI.Element;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.login;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.nopassphrase;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.passphrase;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.password;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.privateKeyFile;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.sshLogin;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.values;
import org.codelutin.vcs.ui.model.ConfigUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
@@ -40,12 +40,12 @@
import java.util.List;
/** @author chemit */
-public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConfigUI> {
+public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConfigConnexionUI> {
protected List<Element> errors;
- public ConfigUIHandler(ConfigUI ui, VCSConnexionConfig config) {
+ public ConfigUIHandler(ConfigConnexionUI ui, VCSConnexionConfig config) {
super(ui, new ConfigUIModel(), config);
ui.setHandler(this);
errors = new ArrayList<Element>();
@@ -53,7 +53,7 @@
public void init() {
super.init();
- ConfigUI ui = getUi();
+ ConfigConnexionUI ui = getUi();
JPanel connexionPanel = ui.getConnexionPanel();
connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
@@ -98,7 +98,7 @@
public synchronized List<Element> validateModel(Element element) {
errors.clear();
- ConfigUI ui = getUi();
+ ConfigConnexionUI ui = getUi();
if (element != null) {
// compute modifed
setModified(element, ui);
@@ -129,7 +129,7 @@
return errors;
}
- public void setModified(Element element, ConfigUI ui) {
+ public void setModified(Element element, ConfigConnexionUI ui) {
boolean modify = false;
ConfigUIModel model = getModel();
@@ -198,7 +198,7 @@
}
protected void populateUI(ConfigUIModel model) {
- ConfigUI ui = getUi();
+ ConfigConnexionUI ui = getUi();
VCSConnexionConfig config = model.getConfig();
switch (config.getMode()) {
case ANONYMOUS:
@@ -218,7 +218,7 @@
}
protected void updateUI(final VCSConnexionMode mode) {
- ConfigUI ui = getUi();
+ ConfigConnexionUI ui = getUi();
//getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
switch (mode) {
case ANONYMOUS:
@@ -246,7 +246,7 @@
}
protected void updateUI(List<Element> errors) {
- ConfigUI ui = getUi();
+ ConfigConnexionUI ui = getUi();
boolean valid = isConfigValid();
ui.getOk().setEnabled(valid && getModel().isModified());
//ui.getTestConnection().setEnabled(valid);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-27 08:36:35 UTC (rev 631)
@@ -16,14 +16,14 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConfigUI.Element;
-import static org.codelutin.vcs.ui.ConfigUI.Element.connexion;
-import static org.codelutin.vcs.ui.ConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConfigUI.Element.sshLogin;
+import org.codelutin.vcs.ui.ConfigConnexionUI.Element;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.connexion;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.login;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.nopassphrase;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.passphrase;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.password;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.privateKeyFile;
+import static org.codelutin.vcs.ui.ConfigConnexionUI.Element.sshLogin;
import org.codelutin.vcs.ui.util.model.AbstractUIModel;
import java.io.File;
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx 2008-04-27 08:31:07 UTC (rev 630)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxGenerateSshKeyUI.jaxx 2008-04-27 08:36:35 UTC (rev 631)
@@ -1,5 +1,4 @@
<GenerateSshKeyUI modal="true">
- <!--ConfigUI title='lutinvcs.config.title' resizable='false'-->
<style source="config.css"/>
<script>
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
1
0
r630 - trunk/lutinvcs/ui/jaxx/src/main/resources/icons
by tchemit@users.labs.libre-entreprise.org April 27, 2008
by tchemit@users.labs.libre-entreprise.org April 27, 2008
April 27, 2008
Author: tchemit
Date: 2008-04-27 08:31:07 +0000 (Sun, 27 Apr 2008)
New Revision: 630
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-addroot.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png
Log:
introduction ui Identity (pour les param?\195?\168tre perso de l'utilisateur (nom prenom email)
suppression de l'ui de config
debut de l'ui de configuration des VCSRoots
introduction ui de test
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/COPY.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-addroot.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-addroot.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/connection_mode.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/modified.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
1
0