Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
May 2008
- 1 participants
- 36 discussions
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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 13 May '08
by tchemit@users.labs.libre-entreprise.org 13 May '08
13 May '08
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