Jaxx-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
April 2008
- 1 participants
- 373 discussions
[Buix-commits] r533 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util: . handler
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 21:11:27 +0000 (Wed, 16 Apr 2008)
New Revision: 533
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java
Log:
refactor util package
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-16 21:11:09 UTC (rev 532)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-16 21:11:27 UTC (rev 533)
@@ -17,6 +17,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
/** @author chemit */
public abstract class AbstractUIAction<H extends AbstractUIHandler<?, ?>> extends javax.swing.AbstractAction {
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java 2008-04-16 21:11:09 UTC (rev 532)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java 2008-04-16 21:11:27 UTC (rev 533)
@@ -15,8 +15,8 @@
package org.codelutin.vcs.ui.util.handler;
import org.codelutin.vcs.VCSFactory;
-import org.codelutin.vcs.ui.util.AbstractBasicUIModel;
-import org.codelutin.vcs.ui.util.AbstractBasicUI;
+import org.codelutin.vcs.ui.util.model.AbstractBasicUIModel;
+import org.codelutin.vcs.ui.util.ui.AbstractBasicUI;
import org.codelutin.vcs.ui.util.UIHelper;
import org.codelutin.vcs.event.VCSActionThreadEventListener;
import org.codelutin.vcs.runner.VCSActionManager;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java 2008-04-16 21:11:09 UTC (rev 532)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java 2008-04-16 21:11:27 UTC (rev 533)
@@ -19,8 +19,8 @@
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.ui.model.DiffUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUI;
+import org.codelutin.vcs.ui.util.model.AbstractTabOneFileUIModel;
+import org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI;
import javax.swing.AbstractButton;
import javax.swing.ListSelectionModel;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java 2008-04-16 21:11:09 UTC (rev 532)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java 2008-04-16 21:11:27 UTC (rev 533)
@@ -21,8 +21,8 @@
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.VCSUIFactory;
-import org.codelutin.vcs.ui.util.AbstractTabUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabUI;
+import org.codelutin.vcs.ui.util.model.AbstractTabUIModel;
+import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import javax.swing.AbstractButton;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java 2008-04-16 21:11:09 UTC (rev 532)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java 2008-04-16 21:11:27 UTC (rev 533)
@@ -14,8 +14,8 @@
*/
package org.codelutin.vcs.ui.util.handler;
-import org.codelutin.vcs.ui.util.AbstractUIModel;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.model.AbstractUIModel;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
/**
* TODO Move this classe in jaxx
1
0
[Buix-commits] r532 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action model util util/model util/ui
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 21:11:09 +0000 (Wed, 16 Apr 2008)
New Revision: 532
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractBasicUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabOneFileUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractBasicUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractUI.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.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/VCSUI.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/VCSUIProvider.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/HelpAction.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/TabUIAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java
Log:
refactor util package
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ChangelogUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,8 +14,11 @@
*/
package org.codelutin.vcs.ui;
+import org.codelutin.vcs.ui.handler.ChangelogUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI;
+
/** @author chemit */
-public abstract class ChangelogUI extends org.codelutin.vcs.ui.util.AbstractTabOneFileUI<org.codelutin.vcs.ui.handler.ChangelogUIHandler> {
+public abstract class ChangelogUI extends AbstractTabOneFileUI<ChangelogUIHandler> {
public abstract javax.swing.JTextArea getChangelogContent();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -17,6 +17,8 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
@@ -30,7 +32,7 @@
import java.io.File;
/** @author chemit */
-public abstract class ConfigUI extends org.codelutin.vcs.ui.util.AbstractUI<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
+public abstract class ConfigUI extends AbstractUI<ConfigUIHandler> {
public enum Element {
firstname,
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -15,6 +15,8 @@
package org.codelutin.vcs.ui;
import org.codelutin.vcs.ui.action.ShowMessagesAction;
+import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractBasicUI;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
@@ -29,7 +31,7 @@
import javax.swing.JToolBar;
/** @author chemit */
-public abstract class ConfirmUI extends org.codelutin.vcs.ui.util.AbstractBasicUI<org.codelutin.vcs.ui.handler.ConfirmUIHandler> {
+public abstract class ConfirmUI extends AbstractBasicUI<ConfirmUIHandler> {
public abstract JLabel getActionLabel();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/DiffUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,13 +14,16 @@
*/
package org.codelutin.vcs.ui;
+import org.codelutin.vcs.ui.handler.DiffUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI;
+
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
/** @author chemit */
-public abstract class DiffUI extends org.codelutin.vcs.ui.util.AbstractTabOneFileUI<org.codelutin.vcs.ui.handler.DiffUIHandler> {
+public abstract class DiffUI extends AbstractTabOneFileUI<DiffUIHandler> {
public abstract AbstractButton getNextDiff();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,12 +14,15 @@
*/
package org.codelutin.vcs.ui;
+import org.codelutin.vcs.ui.handler.SynchUIHandler;
+import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
+
import javax.swing.AbstractButton;
import javax.swing.JPopupMenu;
import java.awt.event.WindowEvent;
/** @author chemit */
-public abstract class SynchUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.SynchUIHandler> {
+public abstract class SynchUI extends AbstractTabUI<SynchUIHandler> {
public abstract AbstractButton getRefreshAll();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,13 +14,13 @@
*/
package org.codelutin.vcs.ui;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
-import org.codelutin.vcs.ui.util.AbstractUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractUIModel;
/**
* @author chemit
- * @see AbstractUI
+ * @see org.codelutin.vcs.ui.util.ui.AbstractUI
* @see AbstractUIModel
* @see org.codelutin.vcs.ui.util.handler.AbstractUIHandler
*/
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -18,7 +18,7 @@
import org.apache.commons.logging.LogFactory;
import org.codelutin.util.StringUtil;
import org.codelutin.vcs.VCSFactory;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIProvider.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,7 +14,7 @@
*/
package org.codelutin.vcs.ui;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
/** @author chemit */
public abstract class VCSUIProvider {
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-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,7 +14,7 @@
*/
package org.codelutin.vcs.ui.action;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUI;
+import org.codelutin.vcs.ui.util.ui.AbstractTabOneFileUI;
import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
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-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractTabUI;
+import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.UIHelper;
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-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import static org.codelutin.i18n.I18n._;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import static org.codelutin.i18n.I18n._;
-import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.ui.AbstractUI;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.VCSUIFactory;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -16,7 +16,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
-import org.codelutin.vcs.ui.util.AbstractTabUI;
+import org.codelutin.vcs.ui.util.ui.AbstractTabUI;
import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import org.codelutin.vcs.ui.util.UIHelper;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ChangelogUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -16,7 +16,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractTabOneFileUIModel;
/**
* Model of a repository
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -24,7 +24,7 @@
import static org.codelutin.vcs.ui.ConfigUI.Element.password;
import static org.codelutin.vcs.ui.ConfigUI.Element.privateKeyFile;
import static org.codelutin.vcs.ui.ConfigUI.Element.sshLogin;
-import org.codelutin.vcs.ui.util.AbstractUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractUIModel;
import java.io.File;
import java.util.ArrayList;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -17,7 +17,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractBasicUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractBasicUIModel;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/DiffUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -16,7 +16,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractTabOneFileUIModel;
/**
* Model of a repository
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SynchUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -14,7 +14,7 @@
*/
package org.codelutin.vcs.ui.model;
-import org.codelutin.vcs.ui.util.AbstractTabUIModel;
+import org.codelutin.vcs.ui.util.model.AbstractTabUIModel;
/**
* Model of a repository
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,29 +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.vcs.ui.util.handler.AbstractUIHandler;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-
-/** @author chemit */
-public abstract class AbstractBasicUI<H extends AbstractUIHandler> extends AbstractUI<H> {
-
- public abstract JScrollPane getContentScroll();
-
- public abstract JTable getContentTable();
-
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,64 +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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.vcs.VCSConnexion;
-import org.codelutin.vcs.VCSEntry;
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.model.SimpleVCSEntriesTableModelImpl;
-
-import java.util.List;
-
-/**
- * Basic ui model, with a {@link AbstractVCSEntriesTableModel} model.
- * <p/>
- * Encapsulate an {@link org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel}.
- *
- * @author chemit
- */
-public abstract class AbstractBasicUIModel extends AbstractUIModel {
-
- static protected final Log log = LogFactory.getLog(AbstractBasicUIModel.class);
-
- protected final AbstractVCSEntriesTableModel entriesModel;
-
- protected AbstractBasicUIModel() {
- entriesModel = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName());
- }
-
- public AbstractVCSEntriesTableModel getEntriesModel() {
- return entriesModel;
- }
-
- public void populate(VCSConnexion connexion) throws VCSException {
- getEntriesModel().populate(connexion, System.nanoTime());
- }
-
- public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException {
- getEntriesModel().populate(connexion, System.nanoTime(), location, relativeLocalPaths);
- }
-
- public void populate(VCSEntryLocation location, VCSEntry[] datas) {
- getEntriesModel().populate(location, datas);
- }
-
- public void refresh(List<VCSEntry> entries) throws VCSException {
- getEntriesModel().refresh(System.nanoTime(), entries);
- }
-
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,55 +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.vcs.ui.action.ChangeFileAction;
-import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import java.awt.event.WindowEvent;
-
-/** @author chemit */
-public abstract class AbstractTabOneFileUI<H extends AbstractTabOneFileUIHandler<?, ?>> extends AbstractTabUI<H> {
-
- public abstract AbstractButton getNextFile();
-
- public abstract AbstractButton getPreviousFile();
-
- protected AbstractAction createFileAction(boolean goPrevious) {
- return ChangeFileAction.createAction(goPrevious, this);
- }
-
- protected boolean hasListener;
-
- @Override
- public synchronized void windowActivated(WindowEvent e) {
- if (!hasListener && getHandler().isUseThreadListener()) {
- // add action manager listener
- getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
- hasListener = true;
- }
- super.windowActivated(e);
- }
-
- @Override
- public synchronized void windowDeactivated(WindowEvent e) {
- if (!isVisible() && getHandler().isUseThreadListener() && hasListener) {
- // remove action manager listener
- getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
- hasListener = false;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,76 +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.vcs.VCSEntry;
-
-/**
- * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...)
- *
- * @author chemit
- */
-public class AbstractTabOneFileUIModel extends AbstractTabUIModel {
-
- public static final String FILE_PROPERTY_CHANGED = "file";
-
- /** current file displayed */
- protected VCSEntry fileModel;
-
- protected boolean hasNextFile;
- protected boolean hasPreviousFile;
-
- protected Integer fileIndex;
-
- public VCSEntry getFileModel() {
- if (fileIndex == null) {
- return null;
- }
- return getEntriesModel().getDisplayedEntry(fileIndex);
- }
-
- public void setFileModel(Integer fileIndex) {
- VCSEntry oldFileModel = this.fileModel;
- this.fileIndex = fileIndex;
-
- int size = getEntriesModel().getRowCount();
- if (fileIndex == null || size < 2) {
- hasNextFile = hasPreviousFile = false;
- } else {
- hasNextFile = hasPreviousFile = true;
- if (fileIndex == 0) {
- // first row : no previous file
- hasPreviousFile = false;
- } else {
- if (fileIndex == size - 1) {
- // last row : no next file
- hasNextFile = false;
- }
- }
- }
- firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileIndex);
- }
-
- public boolean hasPreviousFile() {
- return hasPreviousFile;
- }
-
- public boolean hasNextFile() {
- return hasNextFile;
- }
-
- public Integer getFileIndex() {
- return fileIndex;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,85 +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.vcs.type.VCSAction;
-import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.ButtonGroup;
-
-/** @author chemit */
-public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractBasicUI<H> {
-
- public abstract ButtonGroup getTabs();
-
- public abstract AbstractButton getAllTab();
-
- public abstract AbstractButton getLocalTab();
-
- public abstract AbstractButton getRemoteTab();
-
- public abstract AbstractButton getRefresh();
-
- public abstract AbstractButton getUpdate();
-
- public abstract AbstractButton getRevert();
-
- @Override
- public void setVisible(boolean b) {
- if (b) {
- VCSEntryLocation vcsEntryLocation = getHandler().getLocation();
- AbstractButton button = getButton(vcsEntryLocation);
- if (button == null) {
- button = getAllTab();
- }
- getHandler().getModel().setLocation(VCSEntryLocation.UNKNOW);
- button.doClick();
- }
- super.setVisible(b);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- // clean model
- getHandler().getModel().getEntriesModel().clear();
- }
-
- public AbstractButton getButton(VCSEntryLocation modelName) {
- switch (modelName) {
- case ALL:
- return getAllTab();
- case LOCAL:
- return getLocalTab();
- case REMOTE:
- return getRemoteTab();
- case UNKNOW:
- return null;
- }
- throw new IllegalStateException("no button found for " + modelName);
- }
-
- protected AbstractAction createLocationAction(VCSEntryLocation location) {
- return org.codelutin.vcs.ui.action.ChangeLocationAction.createAction(location, this);
- }
-
- protected AbstractAction createAction(VCSAction action, boolean useSelection) {
- return org.codelutin.vcs.ui.action.TabUIAction.createAction(action, useSelection, this);
- }
-
-}
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,34 +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.vcs.type.VCSEntryLocation;
-
-/**
- * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...)
- *
- * @author chemit
- */
-public class AbstractTabUIModel extends AbstractBasicUIModel {
-
- public static final String LOCATION_PROPERTY_CHANGED = "location";
-
- public void setLocation(VCSEntryLocation location) {
- VCSEntryLocation oldLocation = getEntriesModel().getLocation();
- getEntriesModel().setLocation(location);
- firePropertyChange(LOCATION_PROPERTY_CHANGED, oldLocation, location);
- }
-
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,35 +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.vcs.ui.util.handler.AbstractUIHandler;
-
-/**
- * A abstract dialog contract to be realised by a dialog
- * <p/>
- * TODO : make jaxx authorized implementing interface for root tag :)
- *
- * @author chemit
- */
-public abstract class AbstractUI<H extends AbstractUIHandler> extends jaxx.DialogUI<H> {
-
- protected javax.swing.AbstractAction createHelpAction() {
- return org.codelutin.vcs.ui.action.HelpAction.createAction(this);
- }
-
- protected javax.swing.AbstractAction createShowConfigAction() {
- return org.codelutin.vcs.ui.action.ShowConfigAction.createAction(this);
- }
-}
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 21:09:36 UTC (rev 531)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -1,27 +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 jaxx.DialogUIModel;
-
-/**
- * TODO Move this classe in jaxx
- * Abstract ui model, with property change support.
- *
- * @author chemit
- */
-public abstract class AbstractUIModel extends DialogUIModel {
-
-}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractBasicUIModel.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractBasicUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractBasicUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,65 @@
+/**
+ * ##% 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.model;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.VCSConnexion;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.model.SimpleVCSEntriesTableModelImpl;
+import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
+
+import java.util.List;
+
+/**
+ * Basic ui model, with a {@link org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel} model.
+ * <p/>
+ * Encapsulate an {@link org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel}.
+ *
+ * @author chemit
+ */
+public abstract class AbstractBasicUIModel extends AbstractUIModel {
+
+ static protected final Log log = LogFactory.getLog(AbstractBasicUIModel.class);
+
+ protected final AbstractVCSEntriesTableModel entriesModel;
+
+ protected AbstractBasicUIModel() {
+ entriesModel = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName());
+ }
+
+ public AbstractVCSEntriesTableModel getEntriesModel() {
+ return entriesModel;
+ }
+
+ public void populate(VCSConnexion connexion) throws VCSException {
+ getEntriesModel().populate(connexion, System.nanoTime());
+ }
+
+ public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException {
+ getEntriesModel().populate(connexion, System.nanoTime(), location, relativeLocalPaths);
+ }
+
+ public void populate(VCSEntryLocation location, VCSEntry[] datas) {
+ getEntriesModel().populate(location, datas);
+ }
+
+ public void refresh(List<VCSEntry> entries) throws VCSException {
+ getEntriesModel().refresh(System.nanoTime(), entries);
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabOneFileUIModel.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabOneFileUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabOneFileUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,76 @@
+/**
+ * ##% 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.model;
+
+import org.codelutin.vcs.VCSEntry;
+
+/**
+ * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...)
+ *
+ * @author chemit
+ */
+public class AbstractTabOneFileUIModel extends AbstractTabUIModel {
+
+ public static final String FILE_PROPERTY_CHANGED = "file";
+
+ /** current file displayed */
+ protected VCSEntry fileModel;
+
+ protected boolean hasNextFile;
+ protected boolean hasPreviousFile;
+
+ protected Integer fileIndex;
+
+ public VCSEntry getFileModel() {
+ if (fileIndex == null) {
+ return null;
+ }
+ return getEntriesModel().getDisplayedEntry(fileIndex);
+ }
+
+ public void setFileModel(Integer fileIndex) {
+ VCSEntry oldFileModel = this.fileModel;
+ this.fileIndex = fileIndex;
+
+ int size = getEntriesModel().getRowCount();
+ if (fileIndex == null || size < 2) {
+ hasNextFile = hasPreviousFile = false;
+ } else {
+ hasNextFile = hasPreviousFile = true;
+ if (fileIndex == 0) {
+ // first row : no previous file
+ hasPreviousFile = false;
+ } else {
+ if (fileIndex == size - 1) {
+ // last row : no next file
+ hasNextFile = false;
+ }
+ }
+ }
+ firePropertyChange(FILE_PROPERTY_CHANGED, oldFileModel, fileIndex);
+ }
+
+ public boolean hasPreviousFile() {
+ return hasPreviousFile;
+ }
+
+ public boolean hasNextFile() {
+ return hasNextFile;
+ }
+
+ public Integer getFileIndex() {
+ return fileIndex;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabUIModel.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractTabUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,34 @@
+/**
+ * ##% 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.model;
+
+import org.codelutin.vcs.type.VCSEntryLocation;
+
+/**
+ * Abstract for a dialog with location information (says one tab by location type (except UNKNOW type of course...)
+ *
+ * @author chemit
+ */
+public class AbstractTabUIModel extends AbstractBasicUIModel {
+
+ public static final String LOCATION_PROPERTY_CHANGED = "location";
+
+ public void setLocation(VCSEntryLocation location) {
+ VCSEntryLocation oldLocation = getEntriesModel().getLocation();
+ getEntriesModel().setLocation(location);
+ firePropertyChange(LOCATION_PROPERTY_CHANGED, oldLocation, location);
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractUIModel.java (from rev 530, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/model/AbstractUIModel.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,27 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.model;
+
+import jaxx.DialogUIModel;
+
+/**
+ * TODO Move this classe in jaxx
+ * Abstract ui model, with property change support.
+ *
+ * @author chemit
+ */
+public abstract class AbstractUIModel extends DialogUIModel {
+
+}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractBasicUI.java (from rev 531, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractBasicUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractBasicUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,29 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.ui;
+
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+/** @author chemit */
+public abstract class AbstractBasicUI<H extends AbstractUIHandler> extends AbstractUI<H> {
+
+ public abstract JScrollPane getContentScroll();
+
+ public abstract JTable getContentTable();
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java (from rev 531, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabOneFileUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,55 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.ui;
+
+import org.codelutin.vcs.ui.action.ChangeFileAction;
+import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+import java.awt.event.WindowEvent;
+
+/** @author chemit */
+public abstract class AbstractTabOneFileUI<H extends AbstractTabOneFileUIHandler<?, ?>> extends AbstractTabUI<H> {
+
+ public abstract AbstractButton getNextFile();
+
+ public abstract AbstractButton getPreviousFile();
+
+ protected AbstractAction createFileAction(boolean goPrevious) {
+ return ChangeFileAction.createAction(goPrevious, this);
+ }
+
+ protected boolean hasListener;
+
+ @Override
+ public synchronized void windowActivated(WindowEvent e) {
+ if (!hasListener && getHandler().isUseThreadListener()) {
+ // add action manager listener
+ getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
+ hasListener = true;
+ }
+ super.windowActivated(e);
+ }
+
+ @Override
+ public synchronized void windowDeactivated(WindowEvent e) {
+ if (!isVisible() && getHandler().isUseThreadListener() && hasListener) {
+ // remove action manager listener
+ getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
+ hasListener = false;
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java (from rev 531, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractTabUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,85 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.ui;
+
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+
+/** @author chemit */
+public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractBasicUI<H> {
+
+ public abstract ButtonGroup getTabs();
+
+ public abstract AbstractButton getAllTab();
+
+ public abstract AbstractButton getLocalTab();
+
+ public abstract AbstractButton getRemoteTab();
+
+ public abstract AbstractButton getRefresh();
+
+ public abstract AbstractButton getUpdate();
+
+ public abstract AbstractButton getRevert();
+
+ @Override
+ public void setVisible(boolean b) {
+ if (b) {
+ VCSEntryLocation vcsEntryLocation = getHandler().getLocation();
+ AbstractButton button = getButton(vcsEntryLocation);
+ if (button == null) {
+ button = getAllTab();
+ }
+ getHandler().getModel().setLocation(VCSEntryLocation.UNKNOW);
+ button.doClick();
+ }
+ super.setVisible(b);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ // clean model
+ getHandler().getModel().getEntriesModel().clear();
+ }
+
+ public AbstractButton getButton(VCSEntryLocation modelName) {
+ switch (modelName) {
+ case ALL:
+ return getAllTab();
+ case LOCAL:
+ return getLocalTab();
+ case REMOTE:
+ return getRemoteTab();
+ case UNKNOW:
+ return null;
+ }
+ throw new IllegalStateException("no button found for " + modelName);
+ }
+
+ protected AbstractAction createLocationAction(VCSEntryLocation location) {
+ return org.codelutin.vcs.ui.action.ChangeLocationAction.createAction(location, this);
+ }
+
+ protected AbstractAction createAction(VCSAction action, boolean useSelection) {
+ return org.codelutin.vcs.ui.action.TabUIAction.createAction(action, useSelection, this);
+ }
+
+}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractUI.java (from rev 531, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/ui/AbstractUI.java 2008-04-16 21:11:09 UTC (rev 532)
@@ -0,0 +1,35 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.ui;
+
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
+/**
+ * A abstract dialog contract to be realised by a dialog
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @author chemit
+ */
+public abstract class AbstractUI<H extends AbstractUIHandler> extends jaxx.DialogUI<H> {
+
+ protected javax.swing.AbstractAction createHelpAction() {
+ return org.codelutin.vcs.ui.action.HelpAction.createAction(this);
+ }
+
+ protected javax.swing.AbstractAction createShowConfigAction() {
+ return org.codelutin.vcs.ui.action.ShowConfigAction.createAction(this);
+ }
+}
1
0
[Buix-commits] r531 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action handler util util/handler
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 21:09:36 +0000 (Wed, 16 Apr 2008)
New Revision: 531
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.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/HelpAction.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/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/ConfigUIHandler.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/DiffUIHandler.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/util/AbstractBasicUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
Log:
refactor util package
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -15,14 +15,14 @@
package org.codelutin.vcs.ui;
import org.codelutin.vcs.ui.util.AbstractUI;
-import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import org.codelutin.vcs.ui.util.AbstractUIModel;
/**
* @author chemit
* @see AbstractUI
* @see AbstractUIModel
- * @see AbstractUIHandler
+ * @see org.codelutin.vcs.ui.util.handler.AbstractUIHandler
*/
public enum VCSUI {
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeFileAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -15,7 +15,7 @@
package org.codelutin.vcs.ui.action;
import org.codelutin.vcs.ui.util.AbstractTabOneFileUI;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import javax.swing.AbstractAction;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ChangeLocationAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -16,7 +16,7 @@
import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.ui.util.AbstractTabUI;
-import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.UIHelper;
import javax.swing.AbstractAction;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/HelpAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -16,7 +16,7 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.ui.util.AbstractUI;
-import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import javax.swing.AbstractAction;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -16,7 +16,7 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.ui.util.AbstractUI;
-import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
import org.codelutin.vcs.ui.VCSUIFactory;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TabUIAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -17,7 +17,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.ui.util.AbstractTabUI;
-import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import org.codelutin.vcs.ui.util.UIHelper;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -20,7 +20,7 @@
import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.ChangelogUI;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import javax.swing.SwingUtilities;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -20,7 +20,7 @@
import org.codelutin.vcs.ui.ConfigUI.Element;
import static org.codelutin.vcs.ui.ConfigUI.Element.*;
import org.codelutin.vcs.ui.model.ConfigUIModel;
-import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
import javax.swing.JComponent;
import javax.swing.JPanel;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -20,7 +20,7 @@
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.model.ConfirmUIModel;
-import org.codelutin.vcs.ui.util.AbstractBasicUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractBasicUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import org.codelutin.vcs.ui.util.UIHelper;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -22,7 +22,7 @@
import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.model.DiffUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import javax.swing.SwingUtilities;
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-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -7,7 +7,7 @@
import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.SynchUI;
import org.codelutin.vcs.ui.model.SynchUIModel;
-import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import javax.swing.AbstractButton;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -14,6 +14,8 @@
*/
package org.codelutin.vcs.ui.util;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
import javax.swing.JScrollPane;
import javax.swing.JTable;
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -1,72 +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.vcs.VCSFactory;
-import org.codelutin.vcs.event.VCSActionThreadEventListener;
-import org.codelutin.vcs.runner.VCSActionManager;
-import org.codelutin.vcs.type.VCSEntryLocation;
-
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-/** @author chemit */
-public abstract class AbstractBasicUIHandler<M extends AbstractBasicUIModel, U extends AbstractBasicUI<? extends AbstractBasicUIHandler>> extends AbstractUIHandler<M, U> implements ListSelectionListener, VCSActionThreadEventListener {
-
- private final boolean useThreadListener;
-
- protected abstract void afterSelectionChanged();
-
- protected AbstractBasicUIHandler(U ui, M model, boolean useThreadListener) {
- super(ui, model);
- this.useThreadListener = useThreadListener;
- }
-
- public final ListSelectionModel getSelectionModel() {
- return getUi().getContentTable().getSelectionModel();
- }
-
- public boolean isUseThreadListener() {
- return useThreadListener;
- }
-
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- // update popup states
- afterSelectionChanged();
- }
- }
-
- @Override
- public void init() {
- super.init();
- getUi().getContentTable().getSelectionModel().addListSelectionListener(this);
- JTable table = getUi().getContentTable();
- table.setModel(getModel().getEntriesModel());
- // init table renderer
- UIHelper.installVCSTableUI(table);
- }
-
- public VCSEntryLocation getLocation() {
- return getModel().getEntriesModel().getLocation();
- }
-
- public VCSActionManager getActionManager() {
- return VCSFactory.getActionManager();
- }
-
-}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -15,6 +15,7 @@
package org.codelutin.vcs.ui.util;
import org.codelutin.vcs.ui.action.ChangeFileAction;
+import org.codelutin.vcs.ui.util.handler.AbstractTabOneFileUIHandler;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -1,111 +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 static org.codelutin.i18n.I18n._;
-import org.codelutin.vcs.VCSEntry;
-import org.codelutin.vcs.type.VCSAction;
-import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.model.DiffUIModel;
-
-import javax.swing.AbstractButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import java.beans.PropertyChangeEvent;
-import java.util.EnumMap;
-
-/** @author chemit */
-public abstract class AbstractTabOneFileUIHandler<M extends AbstractTabOneFileUIModel, U extends AbstractTabOneFileUI<? extends AbstractTabUIHandler>> extends AbstractTabUIHandler<M, U> {
-
- protected AbstractTabOneFileUIHandler(U ui, M model,boolean useThreadListener) {
- super(ui, model,useThreadListener);
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
- afterSelectionChanged();
- return;
- }
- super.propertyChange(evt);
- }
-
- @Override
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
-
- ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
-
- Integer selectionIndex = selectionModel.isSelectionEmpty() ? null : selectionModel.getMinSelectionIndex();
-
- getModel().setFileModel(selectionIndex);
- }
- }
-
- protected void afterSelectionChanged() {
- U ui = getUi();
- boolean hasNext = getModel().hasNextFile();
- boolean hasPrevious = getModel().hasPreviousFile();
- ui.getNextFile().setEnabled(hasNext);
- ui.getPreviousFile().setEnabled(hasPrevious);
- ui.getNextFile().setToolTipText(hasNext ? _("lutinvcs.action.nextfile.tip") : null);
- ui.getPreviousFile().setToolTipText(hasPrevious ? _("lutinvcs.action.previousfile.tip") : null);
- // always scroll to selected
- Integer selectedRow = getModel().getFileIndex();
- if (selectedRow != null) {
- ui.getContentTable().scrollRectToVisible(ui.getContentTable().getCellRect(selectedRow, 0, true));
- }
- }
-
- public void afterLocationChanged() {
- if (getLocation() == VCSEntryLocation.UNKNOW) {
- return;
- }
- if (getModel().getEntriesModel().getRowCount() > 0) {
- // select first row
- getSelectionModel().setSelectionInterval(0, 0);
- } else {
- // disable all actions
- afterSelectionChanged();
- }
- }
-
- public void gotoPreviousFile() {
- Integer index = getModel().getFileIndex();
- if (index != null && getModel().hasPreviousFile) {
- getSelectionModel().setSelectionInterval(index - 1, index - 1);
- }
- }
-
- public void gotoNextFile() {
- Integer index = getModel().getFileIndex();
- if (index != null && getModel().hasNextFile) {
- getSelectionModel().setSelectionInterval(index + 1, index + 1);
- }
- }
-
- protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) {
- super.updateAction(actions, hasActions, ui, action);
- boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0;
- String tip = null;
- if (useAction) {
- tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName());
- }
- ui.setToolTipText(tip);
- }
-}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.util.handler.AbstractTabUIHandler;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -1,115 +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.vcs.VCSEntry;
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.type.VCSAction;
-import org.codelutin.vcs.ui.ChangelogUI;
-import org.codelutin.vcs.ui.ConfirmUI;
-import org.codelutin.vcs.ui.DiffUI;
-import org.codelutin.vcs.ui.VCSUIFactory;
-
-import javax.swing.AbstractButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.TableModelListener;
-import java.beans.PropertyChangeEvent;
-import java.util.EnumMap;
-import java.util.List;
-
-/** @author chemit */
-public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI<? extends AbstractTabUIHandler>> extends AbstractBasicUIHandler<M, U> implements TableModelListener {
-
- protected AbstractTabUIHandler(U ui, M model,boolean useThreadListener) {
- super(ui, model,useThreadListener);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
- if (AbstractTabUIModel.LOCATION_PROPERTY_CHANGED.equals(action)) {
- afterLocationChanged();
- }
- }
-
- @Override
- public void init() {
- super.init();
- getUi().getContentTable().getModel().addTableModelListener(this);
- }
-
- protected abstract void afterLocationChanged();
-
-
- protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action) {
- ui.setEnabled(hasActions && actions.containsKey(action) && actions.get(action) > 0);
- }
-
- public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- ConfirmUI ui = VCSUIFactory.newConfirmUI();
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
- public void showDiffUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- DiffUI ui = VCSUIFactory.newDiffUI();
- if (!useSelection) {
- // take all entries
- entries = model.filter(VCSAction.DIFF, model.getEntries());
- }
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getButton(model.getLocation()).setSelected(false);
- ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
- public void showChangelogUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
- ChangelogUI ui = VCSUIFactory.newChangelogUI();
- if (!useSelection) {
- // take all entries
- entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
- }
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
- ui.getContentScroll().setEnabled(entries.size() > 1);
- ui.setVisible(true);
- }
-
- public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) {
- log.info(selectionModel);
- selectionModel.clearSelection();
- if (log.isDebugEnabled()) {
- log.debug("nb entries:" + entries.size());
- }
- // do refresh of all states
- try {
- model.refresh(System.nanoTime(), entries);
- } catch (VCSException e) {
- log.error(e);
- }
- }
-
-}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -14,6 +14,8 @@
*/
package org.codelutin.vcs.ui.util;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
/**
* A abstract dialog contract to be realised by a dialog
* <p/>
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIAction.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -16,6 +16,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
/** @author chemit */
public abstract class AbstractUIAction<H extends AbstractUIHandler<?, ?>> extends javax.swing.AbstractAction {
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -1,27 +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;
-
-/**
- * TODO Move this classe in jaxx
- *
- * @author chemit
- */
-public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> extends jaxx.DialogUIHandler<M, U> {
-
- protected AbstractUIHandler(U ui, M model) {
- super(ui, model);
- }
-}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractBasicUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -0,0 +1,75 @@
+/**
+ * ##% 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.handler;
+
+import org.codelutin.vcs.VCSFactory;
+import org.codelutin.vcs.ui.util.AbstractBasicUIModel;
+import org.codelutin.vcs.ui.util.AbstractBasicUI;
+import org.codelutin.vcs.ui.util.UIHelper;
+import org.codelutin.vcs.event.VCSActionThreadEventListener;
+import org.codelutin.vcs.runner.VCSActionManager;
+import org.codelutin.vcs.type.VCSEntryLocation;
+
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+/** @author chemit */
+public abstract class AbstractBasicUIHandler<M extends AbstractBasicUIModel, U extends AbstractBasicUI<? extends AbstractBasicUIHandler>> extends AbstractUIHandler<M, U> implements ListSelectionListener, VCSActionThreadEventListener {
+
+ private final boolean useThreadListener;
+
+ protected abstract void afterSelectionChanged();
+
+ protected AbstractBasicUIHandler(U ui, M model, boolean useThreadListener) {
+ super(ui, model);
+ this.useThreadListener = useThreadListener;
+ }
+
+ public final ListSelectionModel getSelectionModel() {
+ return getUi().getContentTable().getSelectionModel();
+ }
+
+ public boolean isUseThreadListener() {
+ return useThreadListener;
+ }
+
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ // update popup states
+ afterSelectionChanged();
+ }
+ }
+
+ @Override
+ public void init() {
+ super.init();
+ getUi().getContentTable().getSelectionModel().addListSelectionListener(this);
+ JTable table = getUi().getContentTable();
+ table.setModel(getModel().getEntriesModel());
+ // init table renderer
+ UIHelper.installVCSTableUI(table);
+ }
+
+ public VCSEntryLocation getLocation() {
+ return getModel().getEntriesModel().getLocation();
+ }
+
+ public VCSActionManager getActionManager() {
+ return VCSFactory.getActionManager();
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabOneFileUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -0,0 +1,113 @@
+/**
+ * ##% 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.handler;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.model.DiffUIModel;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUIModel;
+import org.codelutin.vcs.ui.util.AbstractTabOneFileUI;
+
+import javax.swing.AbstractButton;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import java.beans.PropertyChangeEvent;
+import java.util.EnumMap;
+
+/** @author chemit */
+public abstract class AbstractTabOneFileUIHandler<M extends AbstractTabOneFileUIModel, U extends AbstractTabOneFileUI<? extends AbstractTabUIHandler>> extends AbstractTabUIHandler<M, U> {
+
+ protected AbstractTabOneFileUIHandler(U ui, M model,boolean useThreadListener) {
+ super(ui, model,useThreadListener);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ if (DiffUIModel.FILE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
+ afterSelectionChanged();
+ return;
+ }
+ super.propertyChange(evt);
+ }
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+
+ ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
+
+ Integer selectionIndex = selectionModel.isSelectionEmpty() ? null : selectionModel.getMinSelectionIndex();
+
+ getModel().setFileModel(selectionIndex);
+ }
+ }
+
+ protected void afterSelectionChanged() {
+ U ui = getUi();
+ boolean hasNext = getModel().hasNextFile();
+ boolean hasPrevious = getModel().hasPreviousFile();
+ ui.getNextFile().setEnabled(hasNext);
+ ui.getPreviousFile().setEnabled(hasPrevious);
+ ui.getNextFile().setToolTipText(hasNext ? _("lutinvcs.action.nextfile.tip") : null);
+ ui.getPreviousFile().setToolTipText(hasPrevious ? _("lutinvcs.action.previousfile.tip") : null);
+ // always scroll to selected
+ Integer selectedRow = getModel().getFileIndex();
+ if (selectedRow != null) {
+ ui.getContentTable().scrollRectToVisible(ui.getContentTable().getCellRect(selectedRow, 0, true));
+ }
+ }
+
+ public void afterLocationChanged() {
+ if (getLocation() == VCSEntryLocation.UNKNOW) {
+ return;
+ }
+ if (getModel().getEntriesModel().getRowCount() > 0) {
+ // select first row
+ getSelectionModel().setSelectionInterval(0, 0);
+ } else {
+ // disable all actions
+ afterSelectionChanged();
+ }
+ }
+
+ public void gotoPreviousFile() {
+ Integer index = getModel().getFileIndex();
+ if (index != null && getModel().hasPreviousFile) {
+ getSelectionModel().setSelectionInterval(index - 1, index - 1);
+ }
+ }
+
+ public void gotoNextFile() {
+ Integer index = getModel().getFileIndex();
+ if (index != null && getModel().hasNextFile) {
+ getSelectionModel().setSelectionInterval(index + 1, index + 1);
+ }
+ }
+
+ protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action, VCSEntry vcsEntry) {
+ super.updateAction(actions, hasActions, ui, action);
+ boolean useAction = hasActions && actions.containsKey(action) && actions.get(action) > 0;
+ String tip = null;
+ if (useAction) {
+ tip = _("lutinvcs.action.single.tip", action.getLibelle(), vcsEntry.getFile().getName());
+ }
+ ui.setToolTipText(tip);
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java (from rev 524, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractTabUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -0,0 +1,118 @@
+/**
+ * ##% 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.handler;
+
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.ui.ChangelogUI;
+import org.codelutin.vcs.ui.ConfirmUI;
+import org.codelutin.vcs.ui.DiffUI;
+import org.codelutin.vcs.ui.VCSUIFactory;
+import org.codelutin.vcs.ui.util.AbstractTabUIModel;
+import org.codelutin.vcs.ui.util.AbstractTabUI;
+import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
+
+import javax.swing.AbstractButton;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.TableModelListener;
+import java.beans.PropertyChangeEvent;
+import java.util.EnumMap;
+import java.util.List;
+
+/** @author chemit */
+public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI<? extends AbstractTabUIHandler>> extends AbstractBasicUIHandler<M, U> implements TableModelListener {
+
+ protected AbstractTabUIHandler(U ui, M model,boolean useThreadListener) {
+ super(ui, model,useThreadListener);
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+ if (AbstractTabUIModel.LOCATION_PROPERTY_CHANGED.equals(action)) {
+ afterLocationChanged();
+ }
+ }
+
+ @Override
+ public void init() {
+ super.init();
+ getUi().getContentTable().getModel().addTableModelListener(this);
+ }
+
+ protected abstract void afterLocationChanged();
+
+
+ protected void updateAction(EnumMap<VCSAction, Integer> actions, boolean hasActions, AbstractButton ui, VCSAction action) {
+ ui.setEnabled(hasActions && actions.containsKey(action) && actions.get(action) > 0);
+ }
+
+ public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
+ ConfirmUI ui = VCSUIFactory.newConfirmUI();
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
+ ui.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
+ }
+
+ public void showDiffUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
+ DiffUI ui = VCSUIFactory.newDiffUI();
+ if (!useSelection) {
+ // take all entries
+ entries = model.filter(VCSAction.DIFF, model.getEntries());
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
+ ui.getButton(model.getLocation()).setSelected(false);
+ ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
+ }
+
+ public void showChangelogUI(boolean useSelection, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
+ ChangelogUI ui = VCSUIFactory.newChangelogUI();
+ if (!useSelection) {
+ // take all entries
+ entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
+ ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
+ ui.getContentScroll().setEnabled(entries.size() > 1);
+ ui.setVisible(true);
+ }
+
+ public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) {
+ log.info(selectionModel);
+ selectionModel.clearSelection();
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
+ // do refresh of all states
+ try {
+ model.refresh(System.nanoTime(), entries);
+ } catch (VCSException e) {
+ log.error(e);
+ }
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java (from rev 530, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/handler/AbstractUIHandler.java 2008-04-16 21:09:36 UTC (rev 531)
@@ -0,0 +1,30 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.util.handler;
+
+import org.codelutin.vcs.ui.util.AbstractUIModel;
+import org.codelutin.vcs.ui.util.AbstractUI;
+
+/**
+ * TODO Move this classe in jaxx
+ *
+ * @author chemit
+ */
+public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> extends jaxx.DialogUIHandler<M, U> {
+
+ protected AbstractUIHandler(U ui, M model) {
+ super(ui, model);
+ }
+}
1
0
[Buix-commits] r530 - trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 21:07:57 +0000 (Wed, 16 Apr 2008)
New Revision: 530
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
Log:
using jaxx class
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 20:57:35 UTC (rev 529)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 21:07:57 UTC (rev 530)
@@ -14,15 +14,6 @@
*/
package org.codelutin.vcs.ui.util;
-import org.codelutin.vcs.ui.action.HelpAction;
-import org.codelutin.vcs.ui.action.ShowConfigAction;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.JDialog;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-
/**
* A abstract dialog contract to be realised by a dialog
* <p/>
@@ -30,51 +21,13 @@
*
* @author chemit
*/
-public abstract class AbstractUI<H extends AbstractUIHandler> extends JDialog implements WindowListener {
+public abstract class AbstractUI<H extends AbstractUIHandler> extends jaxx.DialogUI<H> {
- private H handler;
-
- public abstract AbstractButton getHelp();
-
- protected AbstractUI() {
- UIHelper.setQuitAction(this);
- addWindowListener(this);
+ protected javax.swing.AbstractAction createHelpAction() {
+ return org.codelutin.vcs.ui.action.HelpAction.createAction(this);
}
- public H getHandler() {
- return handler;
+ protected javax.swing.AbstractAction createShowConfigAction() {
+ return org.codelutin.vcs.ui.action.ShowConfigAction.createAction(this);
}
-
- public void setHandler(H handler) {
- this.handler = handler;
- }
-
- protected AbstractAction createHelpAction() {
- return HelpAction.createAction(this);
- }
-
- protected AbstractAction createShowConfigAction() {
- return ShowConfigAction.createAction(this);
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 20:57:35 UTC (rev 529)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 21:07:57 UTC (rev 530)
@@ -14,47 +14,14 @@
*/
package org.codelutin.vcs.ui.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-
/**
* TODO Move this classe in jaxx
*
* @author chemit
*/
-public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener {
+public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> extends jaxx.DialogUIHandler<M, U> {
- protected static Log log = LogFactory.getLog(AbstractUIHandler.class);
-
- /** ui handled */
- private U ui;
-
- /** model handled */
- private M model;
-
protected AbstractUIHandler(U ui, M model) {
- this.ui = ui;
- this.model = model;
+ super(ui, model);
}
-
- public final U getUi() {
- return ui;
- }
-
- public final M getModel() {
- return model;
- }
-
- public void init() {
- if (model == null) {
- throw new IllegalStateException("no model was defined for " + this);
- }
- model.addPropertyChangeListener(this);
- }
-
- public void dispose() {
- model.removePropertyChangeListener(this);
- }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 20:57:35 UTC (rev 529)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 21:07:57 UTC (rev 530)
@@ -14,77 +14,14 @@
*/
package org.codelutin.vcs.ui.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import jaxx.DialogUIModel;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
/**
* TODO Move this classe in jaxx
* Abstract ui model, with property change support.
*
* @author chemit
*/
-public abstract class AbstractUIModel {
+public abstract class AbstractUIModel extends DialogUIModel {
- static protected final Log log = LogFactory.getLog(AbstractUIModel.class);
-
- /** support for change properties support */
- protected PropertyChangeSupport changeSupport;
-
- protected AbstractUIModel() {
-
- }
-
- public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- if (listener == null) {
- return;
- }
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null) {
- return;
- }
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(listener);
- }
-
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null || changeSupport == null) {
- return;
- }
- changeSupport.removePropertyChangeListener(listener);
- }
-
- public synchronized void removePropertyChangeListeners() {
- if (changeSupport == null) {
- return;
- }
- for (PropertyChangeListener listener : getPropertyChangeListeners()) {
- changeSupport.removePropertyChangeListener(listener);
- }
- }
-
- public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
- if (changeSupport == null) {
- return new PropertyChangeListener[0];
- }
- return changeSupport.getPropertyChangeListeners();
- }
-
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (changeSupport == null || (oldValue == null && newValue == null) ||
- (oldValue != null && oldValue.equals(newValue))) {
- return;
- }
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
}
1
0
[Buix-commits] r529 - in trunk/jaxx: . src/main/java/jaxx
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 20:57:35 +0000 (Wed, 16 Apr 2008)
New Revision: 529
Added:
trunk/jaxx/src/main/java/jaxx/DialogUI.java
trunk/jaxx/src/main/java/jaxx/DialogUIHandler.java
trunk/jaxx/src/main/java/jaxx/DialogUIModel.java
Modified:
trunk/jaxx/changelog
Log:
add methods
Modified: trunk/jaxx/changelog
===================================================================
--- trunk/jaxx/changelog 2008-04-16 20:56:45 UTC (rev 528)
+++ trunk/jaxx/changelog 2008-04-16 20:57:35 UTC (rev 529)
@@ -1,3 +1,5 @@
+ver-1-0-6 chemit add dialogUI mini-framework 04-2008
+
ver-1-0-5 chemit clean code, migrate to java 1.5 01-2008
ver-1-0-4 chemit initial import from project jaxx-1.0.3-beta2 (svn:sourceforce rev 48) 01-2008
Added: trunk/jaxx/src/main/java/jaxx/DialogUI.java
===================================================================
--- trunk/jaxx/src/main/java/jaxx/DialogUI.java (rev 0)
+++ trunk/jaxx/src/main/java/jaxx/DialogUI.java 2008-04-16 20:57:35 UTC (rev 529)
@@ -0,0 +1,79 @@
+/**
+ * ##% 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 jaxx;
+
+import jaxx.runtime.UIHelper;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+
+/**
+ * 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 DialogUI<H extends DialogUIHandler> extends JDialog implements WindowListener {
+
+ private H handler;
+
+ public abstract AbstractButton getHelp();
+
+ //TODO will be handled by jaxx with javax.help...
+ protected abstract AbstractAction createHelpAction();
+
+ protected DialogUI() {
+ UIHelper.setQuitAction(this);
+ addWindowListener(this);
+ }
+
+ public H getHandler() {
+ return handler;
+ }
+
+ public void setHandler(H handler) {
+ this.handler = handler;
+ }
+
+ protected ImageIcon createActionIcon(String name) {
+ return UIHelper.createActionIcon(name);
+ }
+
+ public void windowOpened(WindowEvent e) {
+ }
+
+ public void windowClosed(WindowEvent e) {
+ }
+
+ public void windowClosing(WindowEvent e) {
+ }
+
+ public void windowIconified(WindowEvent e) {
+ }
+
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ public void windowActivated(WindowEvent e) {
+ }
+
+ public void windowDeactivated(WindowEvent e) {
+ }
+}
\ No newline at end of file
Added: trunk/jaxx/src/main/java/jaxx/DialogUIHandler.java
===================================================================
--- trunk/jaxx/src/main/java/jaxx/DialogUIHandler.java (rev 0)
+++ trunk/jaxx/src/main/java/jaxx/DialogUIHandler.java 2008-04-16 20:57:35 UTC (rev 529)
@@ -0,0 +1,60 @@
+/**
+ * ##% 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 jaxx;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+
+/**
+ * DialogUI handler
+ *
+ * @author chemit
+ */
+public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler>> implements PropertyChangeListener {
+
+ protected static Log log = LogFactory.getLog(DialogUIHandler.class);
+
+ /** ui handled */
+ private U ui;
+
+ /** model handled */
+ private M model;
+
+ protected DialogUIHandler(U ui, M model) {
+ this.ui = ui;
+ this.model = model;
+ }
+
+ public U getUi() {
+ return ui;
+ }
+
+ public M getModel() {
+ return model;
+ }
+
+ public void init() {
+ if (model == null) {
+ throw new IllegalStateException("no model was defined for " + this);
+ }
+ model.addPropertyChangeListener(this);
+ }
+
+ public void dispose() {
+ model.removePropertyChangeListener(this);
+ }
+}
\ No newline at end of file
Added: trunk/jaxx/src/main/java/jaxx/DialogUIModel.java
===================================================================
--- trunk/jaxx/src/main/java/jaxx/DialogUIModel.java (rev 0)
+++ trunk/jaxx/src/main/java/jaxx/DialogUIModel.java 2008-04-16 20:57:35 UTC (rev 529)
@@ -0,0 +1,85 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package jaxx;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * Abstract ui model, with property change support.
+ *
+ * @author chemit
+ */
+public abstract class DialogUIModel {
+
+ static protected final Log log = LogFactory.getLog(DialogUIModel.class);
+
+ /** support for change properties support */
+ protected PropertyChangeSupport changeSupport;
+
+ public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ if (listener == null) {
+ return;
+ }
+ if (changeSupport == null) {
+ changeSupport = new PropertyChangeSupport(this);
+ }
+ changeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (listener == null) {
+ return;
+ }
+ if (changeSupport == null) {
+ changeSupport = new PropertyChangeSupport(this);
+ }
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (listener == null || changeSupport == null) {
+ return;
+ }
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ public synchronized void removePropertyChangeListeners() {
+ if (changeSupport == null) {
+ return;
+ }
+ for (PropertyChangeListener listener : getPropertyChangeListeners()) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
+ if (changeSupport == null) {
+ return new PropertyChangeListener[0];
+ }
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ if (changeSupport == null || (oldValue == null && newValue == null) ||
+ (oldValue != null && oldValue.equals(newValue))) {
+ return;
+ }
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+}
\ No newline at end of file
1
0
[Buix-commits] r528 - trunk/jaxx/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 20:56:45 +0000 (Wed, 16 Apr 2008)
New Revision: 528
Modified:
trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java
Log:
add methods
Modified: trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java
===================================================================
--- trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java 2008-04-16 20:46:32 UTC (rev 527)
+++ trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java 2008-04-16 20:56:45 UTC (rev 528)
@@ -19,6 +19,13 @@
package jaxx.runtime;
import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+import javax.swing.JRootPane;
+import javax.swing.Action;
+import javax.swing.AbstractAction;
+import javax.swing.JComponent;
+import javax.swing.KeyStroke;
+import java.awt.event.ActionEvent;
/** @author tony */
public class UIHelper {
@@ -32,4 +39,27 @@
}
}
+ /**
+ * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key.
+ *
+ * @param ui ui
+ */
+ public static void setQuitAction(final JDialog ui) {
+ JRootPane rootPane = ui.getRootPane();
+
+ Action quitAction = new AbstractAction("quit") {
+ private static final long serialVersionUID = -869095664995763057L;
+
+ public void actionPerformed(ActionEvent e) {
+ ui.dispose();
+ }
+ };
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
+ rootPane.getActionMap().put("quit", quitAction);
+ }
+
+ public static ImageIcon createActionIcon(String name) {
+ return createImageIcon("action-" + name + ".png");
+ }
+
}
1
0
[Buix-commits] r527 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . handler model util
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 20:46:32 +0000 (Wed, 16 Apr 2008)
New Revision: 527
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
Log:
config ui
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -27,55 +27,30 @@
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
-import java.awt.Color;
import java.io.File;
-import java.util.Arrays;
-import java.util.List;
/** @author chemit */
public abstract class ConfigUI extends org.codelutin.vcs.ui.util.AbstractUI<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
public enum Element {
- firstname {
- public String getValue(ConfigUI ui) {
- return ui.getFirstname().getText();
- }},
- lastname {
- public String getValue(ConfigUI ui) {
- return ui.getLastname().getText();
- }},
- email {
- public String getValue(ConfigUI ui) {
- return ui.getEmail().getText();
- }},
- connexion {
- public String getValue(ConfigUI ui) {
- return ui.getFirstname().getText();
- }},
- login {
- public String getValue(ConfigUI ui) {
- return ui.getServerLogin().getText();
- }},
- password {
- public String getValue(ConfigUI ui) {
- return Arrays.toString(ui.getServerPassword().getPassword());
- }},
- passphrase {
- public String getValue(ConfigUI ui) {
- return Arrays.toString(ui.getServerPassword().getPassword());
- }},
- nopassphrase {
- public String getValue(ConfigUI ui) {
- return String.valueOf(ui.getServerNoPassPhrase().isSelected());
- }},
- privatekey {
- public String getValue(ConfigUI ui) {
- return ui.getServerPrivateKeyFile().getText();
- }};
-
- public abstract String getValue(ConfigUI ui);
+ firstname,
+ lastname,
+ email,
+ connexion,
+ login,
+ sshLogin,
+ password,
+ passphrase,
+ nopassphrase,
+ privateKeyFile
}
+ public abstract String getElementValue(Element element);
+
+ public abstract JLabel getElementLabel(Element element);
+
+ public abstract JComponent getElement(Element element);
+
public abstract JEditorPane getDoc();
public abstract JTextField getFirstname();
@@ -84,33 +59,35 @@
public abstract JTextField getEmail();
- public abstract JRadioButton getServerAuthenticationMethodAnonymous();
+ public abstract JRadioButton getConnexionModeAnonymous();
- public abstract JRadioButton getServerAuthenticationMethodPassword();
+ public abstract JRadioButton getConnexionModePassword();
- public abstract JRadioButton getServerAuthenticationMethodSsh();
+ public abstract JRadioButton getConnexionModeSsh();
- public abstract JTextField getServerLogin();
+ public abstract JTextField getLogin();
- public abstract JPasswordField getServerPassword();
+ public abstract JTextField getSshLogin();
- public abstract JPasswordField getServerPassphrase();
+ public abstract JPasswordField getPassword();
- public abstract JCheckBox getServerNoPassPhrase();
+ public abstract JPasswordField getPassphrase();
- public abstract JTextField getServerPrivateKeyFile();
+ public abstract JCheckBox getNoPassPhrase();
- public abstract ButtonGroup getServerMethod();
+ public abstract JTextField getPrivateKeyFile();
- public abstract AbstractButton getServerPrivateKeyChangeFile();
+ public abstract ButtonGroup getConnexionMode();
- public abstract AbstractButton getServerPrivateKeyGenerate();
+ public abstract AbstractButton getChangePrivateKeyFile();
+ public abstract AbstractButton getGenerateKey();
+
public abstract AbstractButton getOk();
public abstract AbstractButton getReset();
- public abstract AbstractButton getCancelAction();
+ public abstract AbstractButton getCancel();
public abstract AbstractButton getTestConnection();
@@ -120,15 +97,27 @@
public abstract JLabel getEmailLabel();
- public abstract JLabel getServerLoginLabel();
+ public abstract JLabel getLoginLabel();
- public abstract JLabel getServerPasswordLabel();
+ public abstract JLabel getSshLoginLabel();
- public abstract JLabel getServerPassphraseLabel();
+ public abstract JLabel getPasswordLabel();
- public abstract JLabel getServerPrivateKeyFileLabel();
+ public abstract JLabel getPassphraseLabel();
+ public abstract JLabel getPrivateKeyFileLabel();
+ public abstract javax.swing.JPanel getConnexionPanel();
+
+ public abstract java.awt.CardLayout getConnexionPanelLayout();
+
+ public abstract javax.swing.JPanel getAnonymousPanel();
+
+ public abstract javax.swing.JPanel getPasswordPanel();
+
+ public abstract javax.swing.JPanel getSshPanel();
+
+ public abstract javax.swing.JScrollPane getIdentityScroll();
public boolean isConfigValid() {
return getHandler().isConfigValid();
}
@@ -146,22 +135,28 @@
getHandler().doCheck(element);
}
+ protected void changeAutheticationMode(VCSConnexionMode mode) {
+ getHandler().getModel().setConnexionMode(mode);
+ doCheck(Element.connexion);
+ //doCheck(Element.connexion);
+ }
+
protected void changePrivateKeyFile() {
+ //TODO add title in lutinutil :)
File file = FileUtil.getFile(".*.pub$", _("lutinvcs.config.find.public.key"));
if (file != null) {
String path = file.getAbsolutePath();
- getServerPrivateKeyFile().setText(path.substring(0, path.length() - 4));
- doCheck(Element.privatekey);
+ getPrivateKeyFile().setText(path.substring(0, path.length() - 4));
+ doCheck(Element.privateKeyFile);
}
}
- protected void setColor(List<String> errors, String name, JComponent component) {
- component.setForeground(errors.contains(name) ? Color.red : Color.black);
+ protected void generateKey() {
+ //TODO
}
- public void changeAutheticationMode(VCSConnexionMode mode) {
- getHandler().getModel().setConnexionMode(mode);
- doCheck(Element.connexion);
+ protected void testConnexion() {
+ //TODO
}
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -18,10 +18,12 @@
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.ConfigUI;
import org.codelutin.vcs.ui.ConfigUI.Element;
+import static org.codelutin.vcs.ui.ConfigUI.Element.*;
import org.codelutin.vcs.ui.model.ConfigUIModel;
import org.codelutin.vcs.ui.util.AbstractUIHandler;
import javax.swing.JComponent;
+import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.text.JTextComponent;
import java.awt.Color;
@@ -34,15 +36,25 @@
/** @author chemit */
public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConfigUI> {
- protected List<String> errors;
+ protected List<Element> errors;
public ConfigUIHandler(ConfigUI ui) {
super(ui, new ConfigUIModel());
ui.setHandler(this);
- errors = new ArrayList<String>();
+ errors = new ArrayList<Element>();
}
+ public void init() {
+ super.init();
+ ConfigUI ui = getUi();
+ JPanel connexionPanel = ui.getConnexionPanel();
+ connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
+ connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
+ connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
+ //getUi().pack();
+ }
+
public void propertyChange(PropertyChangeEvent evt) {
if (log.isDebugEnabled()) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
@@ -51,7 +63,7 @@
if (ConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
- updateUI((ConfigUIModel) evt.getNewValue());
+ populateUI((ConfigUIModel) evt.getNewValue());
doCheck(null);
return;
}
@@ -69,41 +81,40 @@
throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
}
-
- public synchronized List<String> validateModel(Element element) {
+ public synchronized List<Element> validateModel(Element element) {
errors.clear();
+ ConfigUI ui = getUi();
if (element != null) {
// compute modifed
- setModified(element, getUi());
+ setModified(element, ui);
}
- ConfigUI ui = getUi();
- // validate firstname + lastname + email (only if visible)
- if (ui.getFirstname().isVisible()) {
- checkData(ui.getFirstname(), "firstname");
- checkData(ui.getLastname(), "lastname");
- checkData(ui.getEmail(), "email");
+ // validate firstname + lastname + email (only if required)
+ if (getModel().isShowIdentity()) {
+ checkData(ui.getFirstname(), firstname);
+ checkData(ui.getLastname(), lastname);
+ checkData(ui.getEmail(), email);
}
+
switch (getModel().getMode()) {
case ANONYMOUS:
// nothing to validate
break;
case PASSWORD:
// login + password not empty
- checkData(ui.getServerLogin(), "login");
- checkData(ui.getServerPassword().getPassword().length == 0, "password");
+ checkData(ui.getLogin(), login);
+ checkData(ui.getPassword().getPassword().length == 0, password);
break;
case SSH:
// login + private key exists
- checkData(ui.getServerLogin(), "login");
- String s = ui.getServerPrivateKeyFile().getText();
+ checkData(ui.getSshLogin(), sshLogin);
+ String s = ui.getPrivateKeyFile().getText();
File file = new File(s);
- checkData(s.isEmpty() || !file.exists(), "privatekey");
- checkData(errors.contains("login") || file.exists(), "generatekey");
- if (Element.nopassphrase.getValue(ui).equals("false")) {
+ checkData(s.isEmpty() || !file.exists(), privateKeyFile);
+ if (ui.getElementValue(nopassphrase).equals("false")) {
// check it there is a pass-phrase
- checkData(ui.getServerPassphrase().getPassword().length == 0, "passphrase");
+ checkData(ui.getPassphrase().getPassword().length == 0, passphrase);
} else {
- errors.remove("passphrase");
+ errors.remove(passphrase);
}
break;
}
@@ -113,30 +124,35 @@
public void setModified(Element element, ConfigUI ui) {
boolean modify = false;
ConfigUIModel model = getModel();
+
+ String value = ui.getElementValue(element);
+
switch (element) {
-
case connexion:
modify = model.getMode() != model.getConfig().getMode();
break;
case email:
- modify = !model.getEmail().equals(element.getValue(ui));
+ modify = !model.getEmail().equals(value);
break;
case firstname:
- modify = !model.getFirstname().equals(element.getValue(ui));
+ modify = !model.getFirstname().equals(value);
break;
case lastname:
- modify = !model.getLasttname().equals(element.getValue(ui));
+ modify = !model.getLasttname().equals(value);
break;
case login:
- modify = !model.getConfig().getUserName().equals(element.getValue(ui));
+ modify = !model.getConfig().getUserName().equals(value);
break;
+ case sshLogin:
+ modify = !model.getConfig().getUserName().equals(value);
+ break;
case nopassphrase:
- boolean b = ui.getServerNoPassPhrase().isSelected();
+ boolean b = ui.getNoPassPhrase().isSelected();
modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
if (!b) {
- model.removeModified(Element.passphrase);
+ model.removeModified(passphrase);
} else {
- char[] password = ui.getServerPassphrase().getPassword();
+ char[] password = ui.getPassphrase().getPassword();
boolean modify2;
if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
modify2 = password.length == 0;
@@ -144,18 +160,18 @@
modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
}
if (modify2) {
- model.addModified(Element.passphrase);
+ model.addModified(passphrase);
}
}
break;
case password:
- modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getServerPassword().getPassword()));
+ modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
break;
- case privatekey:
- modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(element.getValue(ui));
+ case privateKeyFile:
+ modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
break;
case passphrase:
- modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getServerPassphrase().getPassword()));
+ modify = !model.getConfig().getPassphrase().equals(value);
break;
}
if (modify) {
@@ -166,99 +182,100 @@
}
public void doCheck(Element element) {
- List<String> errors = validateModel(element);
+ List<Element> errors = validateModel(element);
updateUI(errors);
}
-
public boolean isConfigValid() {
- return errors.isEmpty() || (errors.size() == 1 && errors.contains("generatekey"));
+ return errors.isEmpty();
}
public void reset() {
getModel().reset();
}
- protected void updateUI(ConfigUIModel configUIModel) {
+ protected void populateUI(ConfigUIModel model) {
ConfigUI ui = getUi();
- VCSConnexionConfig config = configUIModel.getConfig();
- ui.getServerLogin().setText(config.getUserName());
- ui.getServerNoPassPhrase().setSelected(config.isNoPassPhrase());
- ui.getServerPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
- ui.getServerPassword().setText(configUIModel.getMode() != VCSConnexionMode.PASSWORD || config.getPassphrase() == null ? "" : config.getPassphrase());
- ui.getServerPassphrase().setText(configUIModel.getMode() != VCSConnexionMode.SSH || config.getPassphrase() == null ? "" : config.getPassphrase());
- boolean showIdenty = configUIModel.isShowIdentity();
- getUi().getFirstnameLabel().setVisible(showIdenty);
- getUi().getLastnameLabel().setVisible(showIdenty);
- getUi().getEmailLabel().setVisible(showIdenty);
- getUi().getFirstname().setVisible(showIdenty);
- getUi().getLastname().setVisible(showIdenty);
- getUi().getEmail().setVisible(showIdenty);
+ VCSConnexionConfig config = model.getConfig();
+ switch (config.getMode()) {
+ case ANONYMOUS:
+ break;
+ case PASSWORD:
+ ui.getLogin().setText(config.getUserName());
+ ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ case SSH:
+ ui.getSshLogin().setText(config.getUserName());
+ ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
+ ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
+ ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ }
+ boolean showIdenty = model.isShowIdentity();
+ ui.getIdentityScroll().setVisible(showIdenty);
if (showIdenty) {
- getUi().getFirstname().setText(configUIModel.getFirstname());
- getUi().getLastname().setText(configUIModel.getLasttname());
- getUi().getEmail().setText(configUIModel.getEmail());
+ getUi().getFirstname().setText(model.getFirstname());
+ getUi().getLastname().setText(model.getLasttname());
+ getUi().getEmail().setText(model.getEmail());
}
}
- protected void updateUI(VCSConnexionMode mode) {
+ protected void updateUI(final VCSConnexionMode mode) {
ConfigUI ui = getUi();
+ //getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
switch (mode) {
case ANONYMOUS:
- ui.getServerAuthenticationMethodAnonymous().setSelected(true);
+ ui.getConnexionModeAnonymous().setSelected(true);
break;
case PASSWORD:
- ui.getServerAuthenticationMethodPassword().setSelected(true);
- setModified(Element.login, ui);
- setModified(Element.password, ui);
+ ui.getConnexionModePassword().setSelected(true);
+ setModified(login, ui);
+ setModified(password, ui);
break;
case SSH:
- setModified(Element.login, ui);
- setModified(Element.nopassphrase, ui);
- setModified(Element.passphrase, ui);
- setModified(Element.privatekey, ui);
- ui.getServerAuthenticationMethodSsh().setSelected(true);
+ setModified(sshLogin, ui);
+ setModified(nopassphrase, ui);
+ setModified(passphrase, ui);
+ setModified(privateKeyFile, ui);
+ ui.getConnexionModeSsh().setSelected(true);
break;
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
+ getUi().getConnexionPanelLayout().show(getUi().getConnexionPanel(), mode.name());
getUi().pack();
}
});
}
- protected void updateUI(List<String> errors) {
+ protected void updateUI(List<Element> errors) {
ConfigUI ui = getUi();
boolean valid = isConfigValid();
ui.getOk().setEnabled(valid && getModel().isModified());
ui.getTestConnection().setEnabled(valid);
-
- setColor(errors, "firstname", ui.getFirstnameLabel());
- setColor(errors, "lastname", ui.getLastnameLabel());
- setColor(errors, "email", ui.getEmailLabel());
- setColor(errors, "login", ui.getServerLoginLabel());
- setColor(errors, "password", ui.getServerPasswordLabel());
- setColor(errors, "passphrase", ui.getServerPassphraseLabel());
- setColor(errors, "privatekey", ui.getServerPrivateKeyFileLabel());
- if (getModel().getMode() == VCSConnexionMode.SSH) {
- ui.getServerPrivateKeyGenerate().setEnabled(!errors.contains("generatekey"));
+ ui.getGenerateKey().setEnabled(getModel().getMode() == VCSConnexionMode.SSH && !errors.contains(sshLogin) && !errors.contains(passphrase));
+ for (Element element : values()) {
+ setLabelColor(errors, element);
}
}
- protected void checkData(JTextComponent component, String errorName) {
+ protected void checkData(JTextComponent component, Element errorName) {
if (component.getText().isEmpty()) {
errors.add(errorName);
}
}
- protected void checkData(boolean notValid, String errorName) {
+ protected void checkData(boolean notValid, Element errorName) {
if (notValid) {
errors.add(errorName);
}
}
- protected void setColor(List<String> errors, String name, JComponent component) {
- component.setForeground(errors.contains(name) ? Color.red : Color.black);
+ protected void setLabelColor(List<Element> errors, Element element) {
+ JComponent component = getUi().getElementLabel(element);
+ if (component != null && component.isVisible()) {
+ component.setForeground(errors.contains(element) ? Color.red : Color.black);
+ }
}
public void save() {
@@ -266,7 +283,7 @@
log.warn("nothing to save");
}
for (Element element : getModel().getModifieds()) {
- String value = element.getValue(getUi());
+ String value = getUi().getElementValue(element);
getModel().save(element, value);
log.info("save " + element);
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -17,6 +17,13 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.ui.ConfigUI.Element;
+import static org.codelutin.vcs.ui.ConfigUI.Element.connexion;
+import static org.codelutin.vcs.ui.ConfigUI.Element.login;
+import static org.codelutin.vcs.ui.ConfigUI.Element.nopassphrase;
+import static org.codelutin.vcs.ui.ConfigUI.Element.passphrase;
+import static org.codelutin.vcs.ui.ConfigUI.Element.password;
+import static org.codelutin.vcs.ui.ConfigUI.Element.privateKeyFile;
+import static org.codelutin.vcs.ui.ConfigUI.Element.sshLogin;
import org.codelutin.vcs.ui.util.AbstractUIModel;
import java.io.File;
@@ -81,17 +88,18 @@
// nothing to clean
break;
case PASSWORD:
- modifieds.remove(Element.login);
- modifieds.remove(Element.password);
+ removeModified(login, password);
break;
case SSH:
- modifieds.remove(Element.login);
- modifieds.remove(Element.passphrase);
- modifieds.remove(Element.nopassphrase);
- modifieds.remove(Element.privatekey);
+ removeModified(sshLogin, passphrase, nopassphrase, privateKeyFile);
break;
}
}
+ if (mode == getConfig().getMode()) {
+ removeModified(connexion);
+ } else {
+ addModified(connexion);
+ }
firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
}
@@ -132,15 +140,19 @@
public void addModified(Element elementname) {
if (!modifieds.contains(elementname)) {
modifieds.add(elementname);
- setModified(true);
+
}
+ setModified(!modifieds.isEmpty());
}
- public void removeModified(Element elementname) {
- if (modifieds.contains(elementname)) {
- modifieds.remove(elementname);
+ public void removeModified(Element... elementnames) {
+ for (Element elementname : elementnames) {
+ if (modifieds.contains(elementname)) {
+ modifieds.remove(elementname);
+ }
+ setModified(!modifieds.isEmpty());
}
- setModified(!modifieds.isEmpty());
+
}
public void setModified(boolean modified) {
@@ -181,7 +193,7 @@
config.setPassPhrase(value);
}
break;
- case privatekey:
+ case privateKeyFile:
if (mode == VCSConnexionMode.SSH) {
config.setKeyFile(new File(value));
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -24,8 +24,4 @@
public abstract JTable getContentTable();
- protected AbstractBasicUI() {
- super();
- }
-
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -19,16 +19,23 @@
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
+import javax.swing.JDialog;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
-/** @author chemit */
-public abstract class AbstractUI<H extends AbstractUIHandler> extends javax.swing.JDialog implements WindowListener {
+/**
+ * A abstract dialog contract to be realised by a dialog
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @author chemit
+ */
+public abstract class AbstractUI<H extends AbstractUIHandler> extends JDialog implements WindowListener {
+ private H handler;
+
public abstract AbstractButton getHelp();
- private H handler;
-
protected AbstractUI() {
UIHelper.setQuitAction(this);
addWindowListener(this);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -19,7 +19,11 @@
import java.beans.PropertyChangeListener;
-/** @author chemit */
+/**
+ * TODO Move this classe in jaxx
+ *
+ * @author chemit
+ */
public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener {
protected static Log log = LogFactory.getLog(AbstractUIHandler.class);
@@ -52,5 +56,5 @@
public void dispose() {
model.removePropertyChangeListener(this);
- }
+ }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 20:40:48 UTC (rev 526)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-16 20:46:32 UTC (rev 527)
@@ -21,6 +21,7 @@
import java.beans.PropertyChangeSupport;
/**
+ * TODO Move this classe in jaxx
* Abstract ui model, with property change support.
*
* @author chemit
1
0
[Buix-commits] r526 - trunk/lutinvcs/ui/jaxx/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 20:40:48 +0000 (Wed, 16 Apr 2008)
New Revision: 526
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:
config ui
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-16 20:40:38 UTC (rev 525)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-en_GB.properties 2008-04-16 20:40:48 UTC (rev 526)
@@ -6,6 +6,7 @@
lutinvcs.config.anonymous=
lutinvcs.config.email=
lutinvcs.config.firstname=
+lutinvcs.config.identiy=
lutinvcs.config.lastname=
lutinvcs.config.message=
lutinvcs.config.pass=
@@ -16,14 +17,14 @@
lutinvcs.config.server.ssh.confirm.passphrase=
lutinvcs.config.server.ssh.key.change=
lutinvcs.config.server.ssh.key.generate=
-lutinvcs.config.server.ssh.no.passphrase=
lutinvcs.config.server.ssh.passphrase=
lutinvcs.config.server.ssh.privateKeyFile=
lutinvcs.config.server.ssh.publicKeyFile=
lutinvcs.config.ssh=
-lutinvcs.config.test=
+lutinvcs.config.test.tip=
lutinvcs.config.title=
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
+lutinvcs.no.config=
lutinvcs.reset=
lutinvcs.synch.title=Synch UI
Modified: trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-16 20:40:38 UTC (rev 525)
+++ trunk/lutinvcs/ui/jaxx/src/main/resources/i18n/jaxx-fr_FR.properties 2008-04-16 20:40:48 UTC (rev 526)
@@ -6,6 +6,7 @@
lutinvcs.config.anonymous=anonyme
lutinvcs.config.email=Courriel
lutinvcs.config.firstname=Pr\u00E9nom
+lutinvcs.config.identiy=Identit\u00E9
lutinvcs.config.lastname=Nom
lutinvcs.config.message=Configuration de la connexion
lutinvcs.config.pass=password
@@ -16,14 +17,14 @@
lutinvcs.config.server.ssh.confirm.passphrase=Confirmation
lutinvcs.config.server.ssh.key.change=changer la clef ssh
lutinvcs.config.server.ssh.key.generate=g\u00E9n\u00E9rer la clef ssh
-lutinvcs.config.server.ssh.no.passphrase=pas de passe-phrase
lutinvcs.config.server.ssh.passphrase=passe-phrase
lutinvcs.config.server.ssh.privateKeyFile=clef priv\u00E9e
lutinvcs.config.server.ssh.publicKeyFile=clef publique
lutinvcs.config.ssh=ssh
-lutinvcs.config.test=tester la connexion
+lutinvcs.config.test.tip=Tester la connexion
lutinvcs.config.title=Config UI
lutinvcs.confirm.title=Confirm UI
lutinvcs.diff.title=Diff UI
+lutinvcs.no.config=< Pas de configuration >
lutinvcs.reset=R\u00E9initialiser
lutinvcs.synch.title=Synch UI
1
0
[Buix-commits] r525 - in trunk/lutinvcs/ui/jaxx/src/main: resources/icons uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
by tchemit@users.labs.libre-entreprise.org 16 Apr '08
16 Apr '08
Author: tchemit
Date: 2008-04-16 20:40:38 +0000 (Wed, 16 Apr 2008)
New Revision: 525
Added:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-filechooser.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-generatekey.png
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-test.png
Removed:
trunk/lutinvcs/ui/jaxx/src/main/resources/icons/Button_C32.png
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
Log:
config ui
Deleted: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/Button_C32.png
===================================================================
(Binary files differ)
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-filechooser.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-filechooser.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-generatekey.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-generatekey.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-test.png
===================================================================
(Binary files differ)
Property changes on: trunk/lutinvcs/ui/jaxx/src/main/resources/icons/action-test.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-15 08:49:43 UTC (rev 524)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-16 20:40:38 UTC (rev 525)
@@ -1,6 +1,98 @@
-<ConfigUI title='lutinvcs.config.title' resizable='false'>
+<ConfigUI title='lutinvcs.config.title'>
+ <!--ConfigUI title='lutinvcs.config.title' resizable='false'-->
<style source="config.css"/>
- <script>import static org.codelutin.vcs.type.VCSConnexionMode.*;</script>
+ <script>
+ import static org.codelutin.vcs.type.VCSConnexionMode.*;
+ import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
+
+ public String getElementValue(Element element) {
+ JComponent o = getElement(element);
+ if (o instanceof JPasswordField) {
+ return Arrays.toString(((JPasswordField) o).getPassword());
+ }
+ if (o instanceof JTextField) {
+ return ((JTextField) o).getText();
+ }
+ if (o instanceof JRadioButton) {
+ return String.valueOf(((JRadioButton) o).isSelected());
+ }
+ if (o instanceof JCheckBox) {
+ return String.valueOf(((JCheckBox) o).isSelected());
+ }
+ return "";
+ }
+
+ public JLabel getElementLabel(Element element) {
+ return (JLabel) $objectMap.get(element.name() + "Label");
+ }
+
+ public JComponent getElement(Element element) {
+ return (JComponent) $objectMap.get(element.name());
+ }
+ </script>
+
+ <java.awt.CardLayout id='connexionPanelLayout'>
+ <Table id='anonymousPanel' insets='2,2,2,2'>
+ <row>
+ <cell columns="3">
+ <JLabel text="lutinvcs.no.config" enabled='false'/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='passwordPanel' insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='loginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passwordLabel' labelFor='{password}'/>
+ </cell>
+ <cell>
+ <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='sshPanel' opaque="false" insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='sshLoginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshlogin)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passphraseLabel'/>
+ </cell>
+ <cell>
+ <JToolBar opaque='false' borderPainted='false' height="24">
+ <JCheckBox id='noPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)"/>
+ <JPasswordField id='passphrase' onKeyReleased="doCheck(Element.passphrase)"
+ enabled='{!noPassPhrase.isSelected()}'/>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='privateKeyFileLabel'/>
+ </cell>
+ <cell>
+ <JToolBar opaque='false' borderPainted='false' height="24">
+ <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privatekey)"/>
+ <JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
+ onActionPerformed="changePrivateKeyFile()"/>
+ </JToolBar>
+ </cell>
+ </row>
+ </Table>
+ </java.awt.CardLayout>
+
<JToolBar id='top'>
<JLabel text='lutinvcs.config.message'/>
<Table fill='both' insets='0,0,0,0'>
@@ -8,113 +100,87 @@
<cell fill='both'/>
</row>
</Table>
- <JButton id='help' action='{createHelpAction()}'/>
+ <JButton id='help' action='{createHelpAction()}' borderPainted='false'/>
</JToolBar>
+
+ <JToolBar id='connexionHead' opaque='false' height='30'>
+ <JLabel id='connexionModeLabel'/>
+ <JRadioButton id='connexionModeAnonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
+ <JRadioButton id='connexionModePassword' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
+ <JRadioButton id='connexionModeSsh' onActionPerformed="changeAutheticationMode(SSH)"/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
+ borderPainted='false'/>
+ <JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/>
+ <JButton id='testConnection' onActionPerformed="testConnexion()" icon='{createActionIcon("test")}'
+ borderPainted='false'/>
+ </JToolBar>
+
+ <!--JToolBar id='identityHead' opaque='false' onMouseClicked="identityContent.setVisible(!identityContent.isVisible());if (!identityContent.isVisible()) identityScroll.setSize(0,0);pack();identityScroll.invalidate();"-->
+ <JToolBar id='identityHead' opaque='false'>
+ <JLabel id='identityLabel'/>
+ </JToolBar>
<Table fill='both' insets="1,1,1,1">
<row fill='horizontal'>
<cell columns='2'>
- <JScrollPane height="60" columnHeaderView='{top}'>
+ <JScrollPane columnHeaderView='{top}'>
+ <!--JScrollPane height="60" columnHeaderView='{top}' width="420"-->
<JEditorPane id="doc"/>
</JScrollPane>
</cell>
</row>
<row fill='horizontal'>
- <cell>
- <JLabel id='firstnameLabel'/>
+ <cell columns="2" fill='both'>
+ <JScrollPane columnHeaderView='{identityHead}' styleClass='connexionScroll' id='identityScroll'>
+ <Table id="identityContent">
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='firstnameLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='firstname' onKeyReleased="doCheck(Element.firstname)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='lastnameLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='lastname' onKeyReleased="doCheck(Element.lastname)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='emailLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='email' onKeyReleased="doCheck(Element.email)"/>
+ </cell>
+ </row>
+ </Table>
+ </JScrollPane>
</cell>
- <cell>
- <JTextField id='firstname' onKeyReleased="doCheck(Element.firstname)"/>
- </cell>
</row>
<row fill='horizontal'>
- <cell>
- <JLabel id='lastnameLabel'/>
+ <cell columns="2" fill='both'>
+ <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
+ <!--JScrollPane columnHeaderView='{connexionHead}' height="120" width="420" styleClass='connexionScroll'-->
+ <JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
+ </JScrollPane>
</cell>
- <cell>
- <JTextField id='lastname' onKeyReleased="doCheck(Element.lastname)"/>
- </cell>
</row>
<row fill='horizontal'>
- <cell>
- <JLabel id='emailLabel'/>
+ <cell weightx='1'>
+ <JButton id='ok' onActionPerformed="save()"/>
</cell>
- <cell>
- <JTextField id='email' onKeyReleased="doCheck(Element.email)"/>
+ <cell weightx='1'>
+ <JButton id='cancel' onActionPerformed="dispose()"/>
</cell>
</row>
- <row fill='horizontal'>
- <cell>
- <JLabel width='150' height='20' id='serverAuthenticationMethodLabel'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
- <JRadioButton id='serverAuthenticationMethodAnonymous' value='anonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
- <JRadioButton id='serverAuthenticationMethodPassword' value='pass' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
- <JRadioButton id='serverAuthenticationMethodSsh' value='ssh' onActionPerformed="changeAutheticationMode(SSH)"/>
- </JPanel>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='serverLoginLabel' visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/>
- </cell>
- <cell>
- <JTextField id='serverLogin' onKeyReleased="doCheck(Element.login)" visible='{!serverAuthenticationMethodAnonymous.isSelected()}'/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='serverPasswordLabel' visible='{serverAuthenticationMethodPassword.isSelected()}'/>
- </cell>
- <cell>
- <JPasswordField id='serverPassword' visible='{serverAuthenticationMethodPassword.isSelected()}' onKeyReleased="doCheck(Element.password)"/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='serverLoginNoPassPhraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
- </cell>
- <cell>
- <JCheckBox id='serverNoPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}'/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='serverPassphraseLabel' visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/>
- </cell>
- <cell>
- <JPasswordField id='serverPassphrase' onKeyReleased="doCheck(Element.passphrase)" visible='{serverAuthenticationMethodSsh.isSelected()}' enabled='{!serverNoPassPhrase.isSelected()}'/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='serverPrivateKeyFileLabel' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
- </cell>
- <cell>
- <JTextField id='serverPrivateKeyFile' onKeyReleased="doCheck(Element.privatekey)" visible='{serverAuthenticationMethodSsh.isSelected()}'/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell columns="2">
- <JToolBar>
- <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
- <JButton id='serverPrivateKeyChangeFile' text='lutinvcs.config.server.ssh.key.change' visible='{serverAuthenticationMethodSsh.isSelected()}' onActionPerformed="changePrivateKeyFile()"/>
- <JButton id='serverPrivateKeyGenerate' text='lutinvcs.config.server.ssh.key.generate' visible='{serverAuthenticationMethodSsh.isSelected()}'/>
- <JButton id='testConnection' text='lutinvcs.config.test'/>
- </JPanel>
- </JToolBar>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell columns="2">
- <JToolBar>
- <JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
- <JButton id='ok' text='lutinvcs.apply' onActionPerformed="save();"/>
- <JButton id='reset' text='lutinvcs.reset' onActionPerformed="reset();"/>
- <JButton id='cancelAction' text='lutinvcs.cancel' onActionPerformed="dispose();"/>
- </JPanel>
- </JToolBar>
- </cell>
- </row>
</Table>
+
</ConfigUI>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-15 08:49:43 UTC (rev 524)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-04-16 20:40:38 UTC (rev 525)
@@ -36,7 +36,7 @@
}
.updateScroll, .diffScroll, .confirmScroll {
- verticalScrollBarPolicy: 20;
+ verticalScrollBarPolicy: 21;
horizontalScrollBarPolicy: 31;
}
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-15 08:49:43 UTC (rev 524)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/config.css 2008-04-16 20:40:38 UTC (rev 525)
@@ -9,26 +9,17 @@
}
JTextField {
- columns: 30;
+ columns: 27;
}
#top, #help {
borderPainted: false;
- opaque: false;
+ opaque: false;
}
-#serverPrivateKeyFileLabel {
- text: "lutinvcs.config.server.ssh.privateKeyFile";
+#identityLabel {
+ text: "lutinvcs.config.identiy";
}
-
-#serverLoginNoPassPhraseLabel {
- text: "lutinvcs.config.server.ssh.no.passphrase";
-}
-
-#serverLoginLabel {
- text: "lutinvcs.config.server.login";
-}
-
#firstnameLabel {
text: "lutinvcs.config.firstname";
}
@@ -41,29 +32,74 @@
text: "lutinvcs.config.email";
}
-#serverAuthenticationMethodLabel {
+#connexionModeLabel {
text: "lutinvcs.config.server.authenticationMethod";
}
-#serverPasswordLabel {
+#connexionModeAnonymous {
+ text: "lutinvcs.config.anonymous";
+ buttonGroup: "connexionMode";
+}
+
+#connexionModePassword {
+ text: "lutinvcs.config.pass";
+ buttonGroup: "connexionMode";
+}
+
+#connexionModeSsh {
+ text: "lutinvcs.config.ssh";
+ buttonGroup: "connexionMode";
+}
+
+#loginLabel,#sshLoginLabel {
+ text: "lutinvcs.config.server.login";
+}
+
+#passwordLabel {
text: "lutinvcs.config.server.password";
}
-#serverPassphraseLabel {
+#noPassPhraseLabel {
+ text: "lutinvcs.config.server.ssh.no.passphrase";
+}
+
+#passphraseLabel {
text: "lutinvcs.config.server.passphrase";
}
-#serverAuthenticationMethodAnonymous {
- text: "lutinvcs.config.anonymous";
- buttonGroup: "serverMethod";
+#privateKeyFileLabel {
+ text: "lutinvcs.config.server.ssh.privateKeyFile";
}
-#serverAuthenticationMethodPassword {
- text: "lutinvcs.config.pass";
- buttonGroup: "serverMethod";
+#changePrivateKeyFile {
+ toolTipText: "lutinvcs.config.server.ssh.key.change";
+ opaque:false;
+ borderPainted:false;
+ margin:0;
}
-#serverAuthenticationMethodSsh {
- text: "lutinvcs.config.ssh";
- buttonGroup: "serverMethod";
+#generateKey {
+ toolTipText: "lutinvcs.config.server.ssh.key.generate";
}
+
+#testConnection {
+ /*text: "lutinvcs.config.test";*/
+ toolTipText: "lutinvcs.config.test.tip";
+}
+
+#ok {
+ text: "lutinvcs.apply";
+}
+
+#reset {
+ toolTipText: "lutinvcs.reset";
+}
+
+#cancel {
+ text: "lutinvcs.cancel";
+}
+
+.connexionScroll{
+ verticalScrollBarPolicy: 20;
+ horizontalScrollBarPolicy: 31;
+}
\ No newline at end of file
1
0
[Buix-commits] r524 - in trunk/lutinvcs: all/src/test/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler ui/common/src/main/java/org/codelutin/vcs/ui/model ui/common/src/main/java/org/codelutin/vcs/ui/util ui/common/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
by tchemit@users.labs.libre-entreprise.org 15 Apr '08
15 Apr '08
Author: tchemit
Date: 2008-04-15 08:49:43 +0000 (Tue, 15 Apr 2008)
New Revision: 524
Added:
trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/ConfigUITest.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java
Modified:
trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/UITest.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.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/VCSUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/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/DiffUIHandler.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/model/ConfirmUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
Log:
mise en place listener sur action du thread (et non plus sur chaque entr?\195?\169e ?\195?\160 traiter).
mise en place ConfigUI
Copied: trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/ConfigUITest.java (from rev 511, trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/UITest.java)
===================================================================
--- trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/ConfigUITest.java (rev 0)
+++ trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/ConfigUITest.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,86 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui;
+
+import org.codelutin.i18n.I18n;
+import org.codelutin.vcs.VCSConnexion;
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.VCSFactory;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.util.VCSConnexionConfigImpl;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+
+/** @author chemit */
+public class ConfigUITest {
+
+ public static void main(String[] args) throws IOException, VCSException {
+
+ I18n.init();
+
+ final RepositoryGenerator generator = new RepositoryGenerator();
+
+ final File root = generator.generateWorkingRepositoryPath();
+
+ root.mkdirs();
+
+ //generator.generateWorkingRepository(root, 5, 5, 10, 14);
+
+ final VCSConnexion connexion = initMockVCS(root);
+
+ connexion.open();
+
+ ConfigUI ui = VCSUIFactory.newConfigUI();
+
+ ConfigUIModel model = ui.getHandler().getModel();
+
+ model.populate(connexion.getConfig(), true, "tony", "chemit", "chemit(a)codelutin.com");
+
+ ui.setVisible(true);
+ ui.addWindowListener(new WindowAdapter() {
+ boolean wasClosed = false;
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ if (wasClosed) {
+ return;
+ }
+ connexion.close();
+ generator.deleteWorkingCopy(root);
+ wasClosed = true;
+ }
+ });
+ }
+
+ public static VCSConnexion initMockVCS(File root) {
+ VCSConnexionConfig config = new VCSConnexionConfigImpl();
+ config.setKeyFile(new File("/home/tony/.ssh/id_dsa"));
+ config.setUserName("tchemit");
+ //config.setPassPhrase("pass");
+ config.setNoPassPhrase(true);
+ config.setType("MOCK");
+ config.setLocalDatabasePath(root);
+ config.setConnexionMode(VCSConnexionMode.SSH);
+ VCSConnexion connexion = VCSFactory.newConnexion(VCSConnexionMode.ANONYMOUS, config);
+ connexion.init(config);
+ return connexion;
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/UITest.java
===================================================================
--- trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/all/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -39,7 +39,7 @@
final File root = generator.generateWorkingRepositoryPath();
- generator.generateWorkingRepository(root, 10, 5, 10, 100);
+ generator.generateWorkingRepository(root, 10, 5, 10, 1024);
final VCSConnexion connexion = initMockVCS(root);
Added: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfigUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,167 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.util.FileUtil;
+import org.codelutin.vcs.type.VCSConnexionMode;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+/** @author chemit */
+public abstract class ConfigUI extends org.codelutin.vcs.ui.util.AbstractUI<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
+
+ public enum Element {
+ firstname {
+ public String getValue(ConfigUI ui) {
+ return ui.getFirstname().getText();
+ }},
+ lastname {
+ public String getValue(ConfigUI ui) {
+ return ui.getLastname().getText();
+ }},
+ email {
+ public String getValue(ConfigUI ui) {
+ return ui.getEmail().getText();
+ }},
+ connexion {
+ public String getValue(ConfigUI ui) {
+ return ui.getFirstname().getText();
+ }},
+ login {
+ public String getValue(ConfigUI ui) {
+ return ui.getServerLogin().getText();
+ }},
+ password {
+ public String getValue(ConfigUI ui) {
+ return Arrays.toString(ui.getServerPassword().getPassword());
+ }},
+ passphrase {
+ public String getValue(ConfigUI ui) {
+ return Arrays.toString(ui.getServerPassword().getPassword());
+ }},
+ nopassphrase {
+ public String getValue(ConfigUI ui) {
+ return String.valueOf(ui.getServerNoPassPhrase().isSelected());
+ }},
+ privatekey {
+ public String getValue(ConfigUI ui) {
+ return ui.getServerPrivateKeyFile().getText();
+ }};
+
+ public abstract String getValue(ConfigUI ui);
+ }
+
+ public abstract JEditorPane getDoc();
+
+ public abstract JTextField getFirstname();
+
+ public abstract JTextField getLastname();
+
+ public abstract JTextField getEmail();
+
+ public abstract JRadioButton getServerAuthenticationMethodAnonymous();
+
+ public abstract JRadioButton getServerAuthenticationMethodPassword();
+
+ public abstract JRadioButton getServerAuthenticationMethodSsh();
+
+ public abstract JTextField getServerLogin();
+
+ public abstract JPasswordField getServerPassword();
+
+ public abstract JPasswordField getServerPassphrase();
+
+ public abstract JCheckBox getServerNoPassPhrase();
+
+ public abstract JTextField getServerPrivateKeyFile();
+
+ public abstract ButtonGroup getServerMethod();
+
+ public abstract AbstractButton getServerPrivateKeyChangeFile();
+
+ public abstract AbstractButton getServerPrivateKeyGenerate();
+
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancelAction();
+
+ public abstract AbstractButton getTestConnection();
+
+ public abstract JLabel getFirstnameLabel();
+
+ public abstract JLabel getLastnameLabel();
+
+ public abstract JLabel getEmailLabel();
+
+ public abstract JLabel getServerLoginLabel();
+
+ public abstract JLabel getServerPasswordLabel();
+
+ public abstract JLabel getServerPassphraseLabel();
+
+ public abstract JLabel getServerPrivateKeyFileLabel();
+
+
+ public boolean isConfigValid() {
+ return getHandler().isConfigValid();
+ }
+
+ protected void reset() {
+ getHandler().reset();
+ }
+
+ protected void save() {
+ getHandler().save();
+ dispose();
+ }
+
+ protected void doCheck(Element element) {
+ getHandler().doCheck(element);
+ }
+
+ protected void changePrivateKeyFile() {
+ File file = FileUtil.getFile(".*.pub$", _("lutinvcs.config.find.public.key"));
+ if (file != null) {
+ String path = file.getAbsolutePath();
+ getServerPrivateKeyFile().setText(path.substring(0, path.length() - 4));
+ doCheck(Element.privatekey);
+ }
+ }
+
+ protected void setColor(List<String> errors, String name, JComponent component) {
+ component.setForeground(errors.contains(name) ? Color.red : Color.black);
+ }
+
+ public void changeAutheticationMode(VCSConnexionMode mode) {
+ getHandler().getModel().setConnexionMode(mode);
+ doCheck(Element.connexion);
+ }
+
+}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConfirmUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -29,7 +29,7 @@
import javax.swing.JToolBar;
/** @author chemit */
-public abstract class ConfirmUI extends org.codelutin.vcs.ui.util.AbstractUI<org.codelutin.vcs.ui.handler.ConfirmUIHandler> {
+public abstract class ConfirmUI extends org.codelutin.vcs.ui.util.AbstractBasicUI<org.codelutin.vcs.ui.handler.ConfirmUIHandler> {
public abstract JLabel getActionLabel();
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/SynchUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -16,6 +16,7 @@
import javax.swing.AbstractButton;
import javax.swing.JPopupMenu;
+import java.awt.event.WindowEvent;
/** @author chemit */
public abstract class SynchUI extends org.codelutin.vcs.ui.util.AbstractTabUI<org.codelutin.vcs.ui.handler.SynchUIHandler> {
@@ -48,4 +49,19 @@
public abstract JPopupMenu getPopup();
+ @Override
+ public void windowOpened(WindowEvent e) {
+ if (getHandler().isUseThreadListener()) {
+ // add action manager listener
+ getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
+ }
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ if (getHandler().isUseThreadListener()) {
+ // remove action manager listener
+ getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
+ }
+ }
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -29,7 +29,8 @@
synch(SynchUI.class, org.codelutin.vcs.ui.handler.SynchUIHandler.class),
diff(DiffUI.class, org.codelutin.vcs.ui.handler.DiffUIHandler.class),
changelog(ChangelogUI.class, org.codelutin.vcs.ui.handler.ChangelogUIHandler.class),
- confirm(ConfirmUI.class, org.codelutin.vcs.ui.handler.ConfirmUIHandler.class);
+ confirm(ConfirmUI.class, org.codelutin.vcs.ui.handler.ConfirmUIHandler.class),
+ config(ConfigUI.class, org.codelutin.vcs.ui.handler.ConfigUIHandler.class);
private final Class<? extends AbstractUI> uiClass;
private final Class<? extends AbstractUIHandler> handlerClass;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -56,6 +56,10 @@
return (ConfirmUI) getInstance().newUI(VCSUI.confirm);
}
+ public static ConfigUI newConfigUI() {
+ return (ConfigUI) getInstance().newUI(VCSUI.config);
+ }
+
public void close() {
if (cache != null) {
cache.clear();
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java (from rev 511, 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/ShowConfigAction.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,52 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.vcs.ui.action;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.ui.util.AbstractUI;
+import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
+import org.codelutin.vcs.ui.VCSUIFactory;
+
+import javax.swing.AbstractAction;
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ShowConfigAction extends org.codelutin.vcs.ui.util.AbstractUIAction<AbstractUIHandler<?, ?>> {
+
+ public static <H extends AbstractUIHandler<?, ?>> AbstractAction createAction(AbstractUI<H> ui) {
+ ShowConfigAction action = new ShowConfigAction();
+ action.setUi(ui);
+ return action;
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public void actionPerformed(ActionEvent e) {
+ checkInit();
+ ui = VCSUIFactory.newConfigUI();
+ ui.setVisible(true);
+ }
+
+ protected ShowConfigAction() {
+ super(_("lutinvcs.action.showconfig.libelle"), createActionIcon("showconfig"));
+ String name = (String) getValue(NAME);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
+ putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
+ putValue(NAME, null);
+ putValue(SHORT_DESCRIPTION, _("lutinvcs.action.showconfig.tip"));
+ }
+
+}
\ No newline at end of file
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-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ChangelogUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -15,11 +15,17 @@
package org.codelutin.vcs.ui.handler;
import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.event.VCSActionThreadEvent;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.ChangelogUI;
import org.codelutin.vcs.ui.model.ChangelogUIModel;
import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TableModelEvent;
+import javax.swing.table.TableModel;
import java.util.Collections;
import java.util.EnumMap;
@@ -27,10 +33,44 @@
public class ChangelogUIHandler extends AbstractTabOneFileUIHandler<ChangelogUIModel, ChangelogUI> {
public ChangelogUIHandler(ChangelogUI ui) {
- super(ui, new ChangelogUIModel());
+ super(ui, new ChangelogUIModel(), true);
ui.setHandler(this);
}
+ public void tableChanged(final TableModelEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ TableModel source = (TableModel) e.getSource();
+ if (source.getRowCount() == 0) {
+ getModel().setFileModel(null);
+ afterSelectionChanged();
+ } else {
+ getSelectionModel().setSelectionInterval(0, 0);
+ }
+ }
+ });
+ }
+
+ public void onActionStarted(VCSActionThreadEvent event) {
+ log.info(event);
+ }
+
+ public void onActionDone(VCSActionThreadEvent event) {
+ if (log.isDebugEnabled()) {
+ log.info(event);
+ }
+ AbstractVCSEntriesTableModel entriesModel = getModel().getEntriesModel();
+ for (VCSEntry entry : event.getSource()) {
+ if (entry.getState() == VCSState.UP_TO_DATE) {
+ // remove it from model
+ entriesModel.removeEntry(entry);
+ }
+ }
+ log.info("notify table model changed " + this);
+ entriesModel.fireTableDataChanged();
+ }
+
+ @Override
protected void afterSelectionChanged() {
super.afterSelectionChanged();
VCSEntry vcsEntry = getModel().getFileModel();
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java (from rev 511, 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/ConfigUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,274 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%
+ */
+package org.codelutin.vcs.ui.handler;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.ConfigUI;
+import org.codelutin.vcs.ui.ConfigUI.Element;
+import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.util.AbstractUIHandler;
+
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.text.JTextComponent;
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** @author chemit */
+public class ConfigUIHandler extends AbstractUIHandler<ConfigUIModel, ConfigUI> {
+
+ protected List<String> errors;
+
+
+ public ConfigUIHandler(ConfigUI ui) {
+ super(ui, new ConfigUIModel());
+ ui.setHandler(this);
+ errors = new ArrayList<String>();
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+
+ if (ConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ // update ui with model values,
+ updateUI((ConfigUIModel) evt.getNewValue());
+ doCheck(null);
+ return;
+ }
+ if (ConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
+ updateUI((VCSConnexionMode) evt.getNewValue());
+ doCheck(null);
+ return;
+ }
+
+ if (ConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ getUi().getReset().setEnabled(newValue != null && newValue);
+ return;
+ }
+ throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
+ }
+
+
+ public synchronized List<String> validateModel(Element element) {
+ errors.clear();
+ if (element != null) {
+ // compute modifed
+ setModified(element, getUi());
+ }
+ ConfigUI ui = getUi();
+ // validate firstname + lastname + email (only if visible)
+ if (ui.getFirstname().isVisible()) {
+ checkData(ui.getFirstname(), "firstname");
+ checkData(ui.getLastname(), "lastname");
+ checkData(ui.getEmail(), "email");
+ }
+ switch (getModel().getMode()) {
+ case ANONYMOUS:
+ // nothing to validate
+ break;
+ case PASSWORD:
+ // login + password not empty
+ checkData(ui.getServerLogin(), "login");
+ checkData(ui.getServerPassword().getPassword().length == 0, "password");
+ break;
+ case SSH:
+ // login + private key exists
+ checkData(ui.getServerLogin(), "login");
+ String s = ui.getServerPrivateKeyFile().getText();
+ File file = new File(s);
+ checkData(s.isEmpty() || !file.exists(), "privatekey");
+ checkData(errors.contains("login") || file.exists(), "generatekey");
+ if (Element.nopassphrase.getValue(ui).equals("false")) {
+ // check it there is a pass-phrase
+ checkData(ui.getServerPassphrase().getPassword().length == 0, "passphrase");
+ } else {
+ errors.remove("passphrase");
+ }
+ break;
+ }
+ return errors;
+ }
+
+ public void setModified(Element element, ConfigUI ui) {
+ boolean modify = false;
+ ConfigUIModel model = getModel();
+ switch (element) {
+
+ case connexion:
+ modify = model.getMode() != model.getConfig().getMode();
+ break;
+ case email:
+ modify = !model.getEmail().equals(element.getValue(ui));
+ break;
+ case firstname:
+ modify = !model.getFirstname().equals(element.getValue(ui));
+ break;
+ case lastname:
+ modify = !model.getLasttname().equals(element.getValue(ui));
+ break;
+ case login:
+ modify = !model.getConfig().getUserName().equals(element.getValue(ui));
+ break;
+ case nopassphrase:
+ boolean b = ui.getServerNoPassPhrase().isSelected();
+ modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
+ if (!b) {
+ model.removeModified(Element.passphrase);
+ } else {
+ char[] password = ui.getServerPassphrase().getPassword();
+ boolean modify2;
+ if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
+ modify2 = password.length == 0;
+ } else {
+ modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
+ }
+ if (modify2) {
+ model.addModified(Element.passphrase);
+ }
+ }
+ break;
+ case password:
+ modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getServerPassword().getPassword()));
+ break;
+ case privatekey:
+ modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(element.getValue(ui));
+ break;
+ case passphrase:
+ modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getServerPassphrase().getPassword()));
+ break;
+ }
+ if (modify) {
+ model.addModified(element);
+ } else if (model.getModifieds().contains(element)) {
+ model.removeModified(element);
+ }
+ }
+
+ public void doCheck(Element element) {
+ List<String> errors = validateModel(element);
+ updateUI(errors);
+ }
+
+
+ public boolean isConfigValid() {
+ return errors.isEmpty() || (errors.size() == 1 && errors.contains("generatekey"));
+ }
+
+ public void reset() {
+ getModel().reset();
+ }
+
+ protected void updateUI(ConfigUIModel configUIModel) {
+ ConfigUI ui = getUi();
+ VCSConnexionConfig config = configUIModel.getConfig();
+ ui.getServerLogin().setText(config.getUserName());
+ ui.getServerNoPassPhrase().setSelected(config.isNoPassPhrase());
+ ui.getServerPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
+ ui.getServerPassword().setText(configUIModel.getMode() != VCSConnexionMode.PASSWORD || config.getPassphrase() == null ? "" : config.getPassphrase());
+ ui.getServerPassphrase().setText(configUIModel.getMode() != VCSConnexionMode.SSH || config.getPassphrase() == null ? "" : config.getPassphrase());
+ boolean showIdenty = configUIModel.isShowIdentity();
+ getUi().getFirstnameLabel().setVisible(showIdenty);
+ getUi().getLastnameLabel().setVisible(showIdenty);
+ getUi().getEmailLabel().setVisible(showIdenty);
+ getUi().getFirstname().setVisible(showIdenty);
+ getUi().getLastname().setVisible(showIdenty);
+ getUi().getEmail().setVisible(showIdenty);
+ if (showIdenty) {
+ getUi().getFirstname().setText(configUIModel.getFirstname());
+ getUi().getLastname().setText(configUIModel.getLasttname());
+ getUi().getEmail().setText(configUIModel.getEmail());
+ }
+ }
+
+ protected void updateUI(VCSConnexionMode mode) {
+ ConfigUI ui = getUi();
+ switch (mode) {
+ case ANONYMOUS:
+ ui.getServerAuthenticationMethodAnonymous().setSelected(true);
+ break;
+ case PASSWORD:
+ ui.getServerAuthenticationMethodPassword().setSelected(true);
+ setModified(Element.login, ui);
+ setModified(Element.password, ui);
+ break;
+ case SSH:
+ setModified(Element.login, ui);
+ setModified(Element.nopassphrase, ui);
+ setModified(Element.passphrase, ui);
+ setModified(Element.privatekey, ui);
+ ui.getServerAuthenticationMethodSsh().setSelected(true);
+ break;
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ getUi().pack();
+ }
+ });
+ }
+
+ protected void updateUI(List<String> errors) {
+ ConfigUI ui = getUi();
+ boolean valid = isConfigValid();
+ ui.getOk().setEnabled(valid && getModel().isModified());
+ ui.getTestConnection().setEnabled(valid);
+
+ setColor(errors, "firstname", ui.getFirstnameLabel());
+ setColor(errors, "lastname", ui.getLastnameLabel());
+ setColor(errors, "email", ui.getEmailLabel());
+ setColor(errors, "login", ui.getServerLoginLabel());
+ setColor(errors, "password", ui.getServerPasswordLabel());
+ setColor(errors, "passphrase", ui.getServerPassphraseLabel());
+ setColor(errors, "privatekey", ui.getServerPrivateKeyFileLabel());
+ if (getModel().getMode() == VCSConnexionMode.SSH) {
+ ui.getServerPrivateKeyGenerate().setEnabled(!errors.contains("generatekey"));
+ }
+ }
+
+ protected void checkData(JTextComponent component, String errorName) {
+ if (component.getText().isEmpty()) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void checkData(boolean notValid, String errorName) {
+ if (notValid) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void setColor(List<String> errors, String name, JComponent component) {
+ component.setForeground(errors.contains(name) ? Color.red : Color.black);
+ }
+
+ public void save() {
+ if (!getModel().isModified()) {
+ log.warn("nothing to save");
+ }
+ for (Element element : getModel().getModifieds()) {
+ String value = element.getValue(getUi());
+ getModel().save(element, value);
+ log.info("save " + element);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfirmUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -16,10 +16,11 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.event.VCSActionThreadEvent;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.model.ConfirmUIModel;
-import org.codelutin.vcs.ui.util.AbstractUIHandler;
+import org.codelutin.vcs.ui.util.AbstractBasicUIHandler;
import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import org.codelutin.vcs.ui.util.UIHelper;
@@ -37,16 +38,18 @@
import java.util.List;
/** @author chemit */
-public class ConfirmUIHandler extends AbstractUIHandler<ConfirmUIModel, ConfirmUI> {
+public class ConfirmUIHandler extends AbstractBasicUIHandler<ConfirmUIModel, ConfirmUI> {
+
public ConfirmUIHandler(ConfirmUI ui) {
- super(ui, new ConfirmUIModel());
+ super(ui, new ConfirmUIModel(), false);
ui.setHandler(this);
}
@Override
public void init() {
super.init();
+
getUi().getMessageModel().addElement("");
getUi().getMessageSelectionModel().addListSelectionListener(new ListSelectionListener() {
@@ -106,6 +109,14 @@
throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
}
+ public void onActionStarted(VCSActionThreadEvent event) {
+ // confirm ui does not listen thread
+ }
+
+ public void onActionDone(VCSActionThreadEvent event) {
+ // confirm ui does not listen thread
+ }
+
protected void afterActionChanged() {
VCSAction action = getModel().getAction();
getUi().getActionLabel().setIcon(UIHelper.createActionIcon(action));
@@ -187,4 +198,11 @@
getUi().dispose();
}
+ public void setBusy(Boolean busy) {
+ if (busy) {
+ // make busy ui
+ } else {
+ // release ui
+ }
+ }
}
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-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/DiffUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -17,11 +17,17 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.event.VCSActionThreadEvent;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.model.DiffUIModel;
import org.codelutin.vcs.ui.util.AbstractTabOneFileUIHandler;
+import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TableModelEvent;
+import javax.swing.table.TableModel;
import java.beans.PropertyChangeEvent;
import java.util.Collections;
import java.util.EnumMap;
@@ -30,10 +36,29 @@
public class DiffUIHandler extends AbstractTabOneFileUIHandler<DiffUIModel, DiffUI> {
public DiffUIHandler(DiffUI ui) {
- super(ui, new DiffUIModel());
+ super(ui, new DiffUIModel(), true);
ui.setHandler(this);
}
+ public void onActionStarted(VCSActionThreadEvent event) {
+ log.info(event);
+ }
+
+ public void onActionDone(VCSActionThreadEvent event) {
+ if (log.isDebugEnabled()) {
+ log.info(event);
+ }
+ AbstractVCSEntriesTableModel entriesModel = getModel().getEntriesModel();
+ for (VCSEntry entry : event.getSource()) {
+ if (entry.getState() == VCSState.UP_TO_DATE) {
+ // remove it from model
+ entriesModel.removeEntry(entry);
+ }
+ }
+ log.info("notify table model changed " + this);
+ entriesModel.fireTableDataChanged();
+ }
+
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (log.isDebugEnabled()) {
@@ -46,6 +71,21 @@
super.propertyChange(evt);
}
+ public void tableChanged(final TableModelEvent e) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ TableModel source = (TableModel) e.getSource();
+ if (source.getRowCount() == 0) {
+ getModel().setFileModel(null);
+ afterSelectionChanged();
+ } else {
+ getSelectionModel().setSelectionInterval(0, 0);
+ }
+ }
+ });
+ }
+
@Override
protected void afterSelectionChanged() {
super.afterSelectionChanged();
@@ -78,22 +118,18 @@
DiffUI ui = getUi();
boolean hasNext = getModel().hasNext();
boolean hasPrevious = getModel().hasPrevious();
- log.info("//TODO :" + this + " next:" + hasNext + ", prev:" + hasPrevious);
ui.getNextDiff().setEnabled(hasNext);
ui.getPreviousDiff().setEnabled(hasPrevious);
ui.getNextDiff().setToolTipText(hasNext ? _("lutinvcs.action.nextdiff.tip") : null);
ui.getPreviousDiff().setToolTipText(hasPrevious ? _("lutinvcs.action.previousdiff.tip") : null);
-
- //TODO init diff handler
+ //TODO update diff handler
}
public void gotoNextDiff() {
getModel().setDiff(getModel().getDiff() + 1);
- log.info("//TODO :" + this);
}
public void gotoPreviousDiff() {
getModel().setDiff(getModel().getDiff() - 1);
- log.info("//TODO :" + this);
}
}
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-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/SynchUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -1,15 +1,21 @@
package org.codelutin.vcs.ui.handler;
import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.event.VCSActionThreadEvent;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSState;
import org.codelutin.vcs.ui.SynchUI;
import org.codelutin.vcs.ui.model.SynchUIModel;
import org.codelutin.vcs.ui.util.AbstractTabUIHandler;
+import org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel;
import javax.swing.AbstractButton;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TableModelEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.EnumMap;
@@ -18,10 +24,39 @@
public class SynchUIHandler extends AbstractTabUIHandler<SynchUIModel, SynchUI> {
public SynchUIHandler(SynchUI ui) {
- super(ui, new SynchUIModel());
+ super(ui, new SynchUIModel(), true);
ui.setHandler(this);
}
+ public void onActionStarted(VCSActionThreadEvent event) {
+ log.info(event);
+ }
+
+ public void onActionDone(VCSActionThreadEvent event) {
+ if (log.isDebugEnabled()) {
+ log.info(event);
+ }
+ AbstractVCSEntriesTableModel entriesModel = getModel().getEntriesModel();
+ for (VCSEntry entry : event.getSource()) {
+ if (entry.getState() == VCSState.UP_TO_DATE) {
+ // remove it from model
+ entriesModel.removeEntry(entry);
+ }
+ }
+ log.info("notify table model changed " + this);
+ entriesModel.fireTableDataChanged();
+ }
+
+ public void tableChanged(TableModelEvent e) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ // rebuild lists
+ afterLocationChanged();
+ }
+ });
+ }
+
@Override
public void init() {
super.init();
@@ -75,12 +110,19 @@
}
protected void afterLocationChanged() {
-
- EnumMap<VCSAction, Integer> actions = getModel().getEntriesModel().countActions((ListSelectionModel) null);
+ EnumMap<VCSAction, Integer> actions;
+ if (getModel().getEntriesModel().getRowCount() == 0) {
+ getUi().getContentTable().setVisible(false);
+ actions = new EnumMap<VCSAction, Integer>(VCSAction.class);
+ } else {
+ getUi().getContentTable().setVisible(true);
+ actions = getModel().getEntriesModel().countActions((ListSelectionModel) null);
+ }
boolean hasActions = !actions.isEmpty();
SynchUI ui = getUi();
// refresh actions is enabled on all files
- int nbFiles = actions.get(VCSAction.REFRESH);
+ Integer nbFiles = actions.get(VCSAction.REFRESH);
+ nbFiles = nbFiles == null ? 0 : nbFiles;
updateAction(actions, hasActions, ui.getDiffAll(), VCSAction.DIFF, true, nbFiles);
updateAction(actions, hasActions, ui.getChangelogAll(), VCSAction.CHANGELOG, true, nbFiles);
updateAction(actions, hasActions, ui.getUpdateAll(), VCSAction.UPDATE, true, nbFiles);
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfigUIModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,198 @@
+/**
+ * ##% 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.ConfigUI.Element;
+import org.codelutin.vcs.ui.util.AbstractUIModel;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Model of a a confirmation of action on entries (single type of action possible)
+ *
+ * @author chemit
+ */
+public class ConfigUIModel extends AbstractUIModel {
+
+ public static final String CONFIG_PROPERTY_CHANGED = "config";
+
+ public static final String MODE_PROPERTY_CHANGED = "mode";
+
+ public static final String IDENTITY_PROPERTY_CHANGED = "identity";
+
+ public static final String MODIFIED_PROPERTY_CHANGED = "modify";
+
+ private boolean showIdentity;
+
+ private String firstname;
+ private String lasttname;
+ private String email;
+ private VCSConnexionMode mode;
+
+ protected List<Element> modifieds;
+ protected VCSConnexionConfig config;
+
+ public ConfigUIModel() {
+ modifieds = new ArrayList<Element>();
+ }
+
+ public void populate(VCSConnexionConfig config, boolean showIdentify, String firstname, String lastname, String email) {
+ this.config = config;
+ this.firstname = firstname;
+ this.lasttname = lastname;
+ this.email = email;
+ this.showIdentity = showIdentify;
+ setConnexionMode(config.getMode());
+ setModified(false);
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void populate(VCSConnexionConfig config) {
+ populate(config, false, null, null, null);
+ }
+
+ public void reset() {
+ checkConnexionInit();
+ populate(config, showIdentity, firstname, lasttname, email);
+ }
+
+ 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:
+ modifieds.remove(Element.login);
+ modifieds.remove(Element.password);
+ break;
+ case SSH:
+ modifieds.remove(Element.login);
+ modifieds.remove(Element.passphrase);
+ modifieds.remove(Element.nopassphrase);
+ modifieds.remove(Element.privatekey);
+ break;
+ }
+ }
+ firePropertyChange(MODE_PROPERTY_CHANGED, oldMode, mode);
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public String getLasttname() {
+ return lasttname;
+ }
+
+ public boolean isShowIdentity() {
+ return showIdentity;
+ }
+
+ public boolean isModified() {
+ return !modifieds.isEmpty();
+ }
+
+ public List<Element> getModifieds() {
+ return modifieds;
+ }
+
+ 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(true);
+ }
+ }
+
+ public void removeModified(Element elementname) {
+ 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 email:
+ break;
+ case firstname:
+ break;
+ case lastname:
+ break;
+ case login:
+ if (mode != VCSConnexionMode.ANONYMOUS) {
+ config.setUserName(value);
+ }
+ break;
+ case nopassphrase:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setNoPassPhrase(Boolean.valueOf(value));
+ }
+ break;
+ case password:
+ if (mode == VCSConnexionMode.PASSWORD) {
+ config.setPassPhrase(value);
+ }
+ case passphrase:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setPassPhrase(value);
+ }
+ break;
+ case privatekey:
+ if (mode == VCSConnexionMode.SSH) {
+ config.setKeyFile(new File(value));
+ }
+ break;
+ }
+ }
+
+
+ protected void checkConnexionInit() throws IllegalStateException {
+ if (config == null) {
+ throw new IllegalStateException("no config found in model " + this);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/ConfirmUIModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -17,7 +17,7 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.util.AbstractUIModel;
+import org.codelutin.vcs.ui.util.AbstractBasicUIModel;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +27,7 @@
*
* @author chemit
*/
-public class ConfirmUIModel extends AbstractUIModel {
+public class ConfirmUIModel extends AbstractBasicUIModel {
public static final String ACCEPT_PROPERTY_CHANGED = "action";
public static final String MESSAGE_HISTORY_PROPERTY_CHANGED = "historyMessage";
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/model/SimpleVCSEntriesTableModelImpl.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -57,5 +57,4 @@
return result;
}
-
}
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,31 @@
+/**
+ * ##% 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 javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+/** @author chemit */
+public abstract class AbstractBasicUI<H extends AbstractUIHandler> extends AbstractUI<H> {
+
+ public abstract JScrollPane getContentScroll();
+
+ public abstract JTable getContentTable();
+
+ protected AbstractBasicUI() {
+ super();
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,72 @@
+/**
+ * ##% 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.vcs.VCSFactory;
+import org.codelutin.vcs.event.VCSActionThreadEventListener;
+import org.codelutin.vcs.runner.VCSActionManager;
+import org.codelutin.vcs.type.VCSEntryLocation;
+
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+/** @author chemit */
+public abstract class AbstractBasicUIHandler<M extends AbstractBasicUIModel, U extends AbstractBasicUI<? extends AbstractBasicUIHandler>> extends AbstractUIHandler<M, U> implements ListSelectionListener, VCSActionThreadEventListener {
+
+ private final boolean useThreadListener;
+
+ protected abstract void afterSelectionChanged();
+
+ protected AbstractBasicUIHandler(U ui, M model, boolean useThreadListener) {
+ super(ui, model);
+ this.useThreadListener = useThreadListener;
+ }
+
+ public final ListSelectionModel getSelectionModel() {
+ return getUi().getContentTable().getSelectionModel();
+ }
+
+ public boolean isUseThreadListener() {
+ return useThreadListener;
+ }
+
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ // update popup states
+ afterSelectionChanged();
+ }
+ }
+
+ @Override
+ public void init() {
+ super.init();
+ getUi().getContentTable().getSelectionModel().addListSelectionListener(this);
+ JTable table = getUi().getContentTable();
+ table.setModel(getModel().getEntriesModel());
+ // init table renderer
+ UIHelper.installVCSTableUI(table);
+ }
+
+ public VCSEntryLocation getLocation() {
+ return getModel().getEntriesModel().getLocation();
+ }
+
+ public VCSActionManager getActionManager() {
+ return VCSFactory.getActionManager();
+ }
+
+}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java (from rev 511, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractBasicUIModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -0,0 +1,64 @@
+/**
+ * ##% 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.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.VCSConnexion;
+import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.model.SimpleVCSEntriesTableModelImpl;
+
+import java.util.List;
+
+/**
+ * Basic ui model, with a {@link AbstractVCSEntriesTableModel} model.
+ * <p/>
+ * Encapsulate an {@link org.codelutin.vcs.ui.util.AbstractVCSEntriesTableModel}.
+ *
+ * @author chemit
+ */
+public abstract class AbstractBasicUIModel extends AbstractUIModel {
+
+ static protected final Log log = LogFactory.getLog(AbstractBasicUIModel.class);
+
+ protected final AbstractVCSEntriesTableModel entriesModel;
+
+ protected AbstractBasicUIModel() {
+ entriesModel = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName());
+ }
+
+ public AbstractVCSEntriesTableModel getEntriesModel() {
+ return entriesModel;
+ }
+
+ public void populate(VCSConnexion connexion) throws VCSException {
+ getEntriesModel().populate(connexion, System.nanoTime());
+ }
+
+ public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException {
+ getEntriesModel().populate(connexion, System.nanoTime(), location, relativeLocalPaths);
+ }
+
+ public void populate(VCSEntryLocation location, VCSEntry[] datas) {
+ getEntriesModel().populate(location, datas);
+ }
+
+ public void refresh(List<VCSEntry> entries) throws VCSException {
+ getEntriesModel().refresh(System.nanoTime(), entries);
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -18,6 +18,7 @@
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
+import java.awt.event.WindowEvent;
/** @author chemit */
public abstract class AbstractTabOneFileUI<H extends AbstractTabOneFileUIHandler<?, ?>> extends AbstractTabUI<H> {
@@ -26,15 +27,28 @@
public abstract AbstractButton getPreviousFile();
+ protected AbstractAction createFileAction(boolean goPrevious) {
+ return ChangeFileAction.createAction(goPrevious, this);
+ }
+
+ protected boolean hasListener;
+
@Override
- public void setVisible(boolean b) {
- super.setVisible(b);
- getContentTable().setAutoscrolls(true);
- //TODO selected first file ?
+ public synchronized void windowActivated(WindowEvent e) {
+ if (!hasListener && getHandler().isUseThreadListener()) {
+ // add action manager listener
+ getHandler().getActionManager().addVCSActionThreadEventListener(getHandler());
+ hasListener = true;
+ }
+ super.windowActivated(e);
}
- protected AbstractAction createFileAction(boolean goPrevious) {
- return ChangeFileAction.createAction(goPrevious, this);
+ @Override
+ public synchronized void windowDeactivated(WindowEvent e) {
+ if (!isVisible() && getHandler().isUseThreadListener() && hasListener) {
+ // remove action manager listener
+ getHandler().getActionManager().removeVCSActionThreadEventListener(getHandler());
+ hasListener = false;
+ }
}
-
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabOneFileUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -17,6 +17,7 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.ui.model.DiffUIModel;
import javax.swing.AbstractButton;
@@ -28,8 +29,8 @@
/** @author chemit */
public abstract class AbstractTabOneFileUIHandler<M extends AbstractTabOneFileUIModel, U extends AbstractTabOneFileUI<? extends AbstractTabUIHandler>> extends AbstractTabUIHandler<M, U> {
- protected AbstractTabOneFileUIHandler(U ui, M model) {
- super(ui, model);
+ protected AbstractTabOneFileUIHandler(U ui, M model,boolean useThreadListener) {
+ super(ui, model,useThreadListener);
}
@Override
@@ -54,15 +55,12 @@
getModel().setFileModel(selectionIndex);
}
- //super.valueChanged(e);
}
protected void afterSelectionChanged() {
-
U ui = getUi();
boolean hasNext = getModel().hasNextFile();
boolean hasPrevious = getModel().hasPreviousFile();
- log.info("//TODO :" + this + " next:" + hasNext + ", prev:" + hasPrevious);
ui.getNextFile().setEnabled(hasNext);
ui.getPreviousFile().setEnabled(hasPrevious);
ui.getNextFile().setToolTipText(hasNext ? _("lutinvcs.action.nextfile.tip") : null);
@@ -75,6 +73,9 @@
}
public void afterLocationChanged() {
+ if (getLocation() == VCSEntryLocation.UNKNOW) {
+ return;
+ }
if (getModel().getEntriesModel().getRowCount() > 0) {
// select first row
getSelectionModel().setSelectionInterval(0, 0);
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -22,7 +22,7 @@
import javax.swing.ButtonGroup;
/** @author chemit */
-public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractUI<H> {
+public abstract class AbstractTabUI<H extends AbstractTabUIHandler<?, ?>> extends AbstractBasicUI<H> {
public abstract ButtonGroup getTabs();
@@ -41,7 +41,6 @@
@Override
public void setVisible(boolean b) {
if (b) {
-
VCSEntryLocation vcsEntryLocation = getHandler().getLocation();
AbstractButton button = getButton(vcsEntryLocation);
if (button == null) {
@@ -52,7 +51,14 @@
}
super.setVisible(b);
}
-
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ // clean model
+ getHandler().getModel().getEntriesModel().clear();
+ }
+
public AbstractButton getButton(VCSEntryLocation modelName) {
switch (modelName) {
case ALL:
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -15,24 +15,25 @@
package org.codelutin.vcs.ui.util;
import org.codelutin.vcs.VCSEntry;
+import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSAction;
-import org.codelutin.vcs.type.VCSEntryLocation;
+import org.codelutin.vcs.ui.ChangelogUI;
import org.codelutin.vcs.ui.ConfirmUI;
import org.codelutin.vcs.ui.DiffUI;
import org.codelutin.vcs.ui.VCSUIFactory;
-import org.codelutin.vcs.ui.ChangelogUI;
import javax.swing.AbstractButton;
import javax.swing.ListSelectionModel;
+import javax.swing.event.TableModelListener;
import java.beans.PropertyChangeEvent;
import java.util.EnumMap;
import java.util.List;
/** @author chemit */
-public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI<? extends AbstractTabUIHandler>> extends AbstractUIHandler<M, U> {
+public abstract class AbstractTabUIHandler<M extends AbstractTabUIModel, U extends AbstractTabUI<? extends AbstractTabUIHandler>> extends AbstractBasicUIHandler<M, U> implements TableModelListener {
- protected AbstractTabUIHandler(U ui, M model) {
- super(ui, model);
+ protected AbstractTabUIHandler(U ui, M model,boolean useThreadListener) {
+ super(ui, model,useThreadListener);
}
public void propertyChange(PropertyChangeEvent evt) {
@@ -45,6 +46,12 @@
}
}
+ @Override
+ public void init() {
+ super.init();
+ getUi().getContentTable().getModel().addTableModelListener(this);
+ }
+
protected abstract void afterLocationChanged();
@@ -54,7 +61,9 @@
public void showConfirmUI(VCSAction action, AbstractVCSEntriesTableModel model, List<VCSEntry> entries) {
ConfirmUI ui = VCSUIFactory.newConfirmUI();
- log.info("nb files:" + entries.size());
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
ui.getHandler().getModel().init(action, model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
ui.getContentScroll().setEnabled(entries.size() > 1);
ui.setVisible(true);
@@ -66,7 +75,9 @@
// take all entries
entries = model.filter(VCSAction.DIFF, model.getEntries());
}
- log.info("nb entries:" + entries.size());
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
ui.getButton(model.getLocation()).setSelected(false);
ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
ui.getContentScroll().setEnabled(entries.size() > 1);
@@ -79,8 +90,10 @@
// take all entries
entries = model.filter(VCSAction.CHANGELOG, model.getEntries());
}
- log.info("nb entries:" + entries.size());
- ui.getHandler().getModel().init(VCSEntryLocation.REMOTE, entries.toArray(new VCSEntry[entries.size()]));
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
+ ui.getHandler().getModel().init(model.getLocation(), entries.toArray(new VCSEntry[entries.size()]));
ui.getContentScroll().setEnabled(entries.size() > 1);
ui.setVisible(true);
}
@@ -88,9 +101,15 @@
public void doRefresh(AbstractVCSEntriesTableModel model, List<VCSEntry> entries, ListSelectionModel selectionModel) {
log.info(selectionModel);
selectionModel.clearSelection();
- log.info("nb entries:" + entries.size());
+ if (log.isDebugEnabled()) {
+ log.debug("nb entries:" + entries.size());
+ }
// do refresh of all states
- model.refresh(System.nanoTime(), entries);
+ try {
+ model.refresh(System.nanoTime(), entries);
+ } catch (VCSException e) {
+ log.error(e);
+ }
}
-
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractTabUIModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -21,7 +21,7 @@
*
* @author chemit
*/
-public class AbstractTabUIModel extends AbstractUIModel {
+public class AbstractTabUIModel extends AbstractBasicUIModel {
public static final String LOCATION_PROPERTY_CHANGED = "location";
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUI.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -15,25 +15,23 @@
package org.codelutin.vcs.ui.util;
import org.codelutin.vcs.ui.action.HelpAction;
+import org.codelutin.vcs.ui.action.ShowConfigAction;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
/** @author chemit */
-public abstract class AbstractUI<H extends AbstractUIHandler> extends javax.swing.JDialog {
+public abstract class AbstractUI<H extends AbstractUIHandler> extends javax.swing.JDialog implements WindowListener {
- public abstract JScrollPane getContentScroll();
-
- public abstract JTable getContentTable();
-
public abstract AbstractButton getHelp();
private H handler;
protected AbstractUI() {
UIHelper.setQuitAction(this);
+ addWindowListener(this);
}
public H getHandler() {
@@ -47,4 +45,29 @@
protected AbstractAction createHelpAction() {
return HelpAction.createAction(this);
}
+
+ protected AbstractAction createShowConfigAction() {
+ return ShowConfigAction.createAction(this);
+ }
+
+ public void windowOpened(WindowEvent e) {
+ }
+
+ public void windowClosed(WindowEvent e) {
+ }
+
+ public void windowClosing(WindowEvent e) {
+ }
+
+ public void windowIconified(WindowEvent e) {
+ }
+
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ public void windowActivated(WindowEvent e) {
+ }
+
+ public void windowDeactivated(WindowEvent e) {
+ }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIHandler.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -16,18 +16,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.vcs.VCSFactory;
-import org.codelutin.vcs.runner.VCSActionManager;
-import org.codelutin.vcs.type.VCSEntryLocation;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
import java.beans.PropertyChangeListener;
/** @author chemit */
-public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener, ListSelectionListener {
+public abstract class AbstractUIHandler<M extends AbstractUIModel, U extends AbstractUI<? extends AbstractUIHandler>> implements PropertyChangeListener {
protected static Log log = LogFactory.getLog(AbstractUIHandler.class);
@@ -37,8 +30,6 @@
/** model handled */
private M model;
- protected abstract void afterSelectionChanged();
-
protected AbstractUIHandler(U ui, M model) {
this.ui = ui;
this.model = model;
@@ -52,35 +43,14 @@
return model;
}
- public final ListSelectionModel getSelectionModel() {
- return getUi().getContentTable().getSelectionModel();
- }
-
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting()) {
- // update popup states
- afterSelectionChanged();
- }
- }
-
public void init() {
if (model == null) {
throw new IllegalStateException("no model was defined for " + this);
}
model.addPropertyChangeListener(this);
- getUi().getContentTable().getSelectionModel().addListSelectionListener(this);
- JTable table = getUi().getContentTable();
- table.setModel(getModel().getEntriesModel());
- // init table renderer
- UIHelper.installVCSTableUI(table);
}
- public VCSEntryLocation getLocation() {
- return model.getEntriesModel().getLocation();
- }
-
- protected VCSActionManager getActionManager() {
- return VCSFactory.getActionManager();
- }
-
+ public void dispose() {
+ model.removePropertyChangeListener(this);
+ }
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractUIModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -16,20 +16,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.vcs.VCSConnexion;
-import org.codelutin.vcs.VCSEntry;
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.type.VCSEntryLocation;
-import org.codelutin.vcs.ui.model.SimpleVCSEntriesTableModelImpl;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.util.List;
/**
* Abstract ui model, with property change support.
- * <p/>
- * Encapsulate an {@link AbstractVCSEntriesTableModel}.
*
* @author chemit
*/
@@ -40,32 +32,10 @@
/** support for change properties support */
protected PropertyChangeSupport changeSupport;
- protected final AbstractVCSEntriesTableModel entriesModel;
-
protected AbstractUIModel() {
- entriesModel = new SimpleVCSEntriesTableModelImpl(getClass().getSimpleName());
- }
- public AbstractVCSEntriesTableModel getEntriesModel() {
- return entriesModel;
}
- public void populate(VCSConnexion connexion) throws VCSException {
- getEntriesModel().populate(connexion, System.nanoTime());
- }
-
- public void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location) throws VCSException {
- getEntriesModel().populate(connexion, System.nanoTime(), location, relativeLocalPaths);
- }
-
- public void populate(VCSEntryLocation location, VCSEntry[] datas) {
- getEntriesModel().populate(location, datas);
- }
-
- public void refresh(List<VCSEntry> entries) {
- getEntriesModel().refresh(System.nanoTime(), entries);
- }
-
public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
if (listener == null) {
return;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/AbstractVCSEntriesTableModel.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -19,6 +19,8 @@
* ##% */
package org.codelutin.vcs.ui.util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSEntries;
@@ -34,8 +36,8 @@
import javax.swing.table.TableRowSorter;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.EnumMap;
import java.util.List;
-import java.util.EnumMap;
/**
* Simple Table model to display list of VCSFileState
@@ -44,8 +46,11 @@
*/
public abstract class AbstractVCSEntriesTableModel extends javax.swing.table.AbstractTableModel implements VCSEntries {
+ static protected final Log log = LogFactory.getLog(AbstractVCSEntriesTableModel.class);
+
protected final String name;
+
/** column names */
protected final String[] columnNames;
@@ -62,7 +67,6 @@
private static final long serialVersionUID = 4697917831388337369L;
-
protected AbstractVCSEntriesTableModel(String name, String[] columnNames) {
super();
this.name = name;
@@ -115,9 +119,7 @@
public void setLocation(VCSEntryLocation location) {
this.location = location;
- displayedEntries.clear();
- displayedEntries.addAll(filter(location));
- fireTableDataChanged();
+ updateEntries();
}
public EnumMap<VCSAction, Integer> countActions(ListSelectionModel selectionModel) {
@@ -154,6 +156,15 @@
return delegate.filter(action, entries);
}
+ public void addEntry(VCSEntry entry) {
+ delegate.addEntry(entry);
+ }
+
+ public void removeEntry(VCSEntry entry) {
+ delegate.removeEntry(entry);
+ displayedEntries.remove(entry);
+ }
+
public List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries) {
return delegate.filter(connexion, entries);
}
@@ -188,11 +199,16 @@
updateEntries();
}
- public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException {
+ public void refresh(long timestamp, List<VCSEntry> entries) throws IllegalStateException, VCSException {
delegate.refresh(timestamp, entries);
- updateEntries();
+ //updateEntries();
}
+ public void refresh(long timestamp, VCSEntry entry) throws IllegalStateException, VCSException {
+ delegate.refresh(timestamp, entry);
+
+ }
+
public EnumMap<VCSAction, Integer> countActions(List<VCSEntry> entries) {
return delegate.countActions(entries);
}
@@ -203,12 +219,16 @@
public void clear() {
delegate.clear();
- displayedEntries.clear();
+ clearDisplayed();
fireTableDataChanged();
}
+ public void clearDisplayed() {
+ displayedEntries.clear();
+ }
+
protected void updateEntries() {
- displayedEntries.clear();
+ clearDisplayed();
displayedEntries.addAll(filter(location));
fireTableDataChanged();
}
@@ -219,4 +239,5 @@
}
return displayedEntries.get(rowSorter.convertRowIndexToModel(row));
}
+
}
\ No newline at end of file
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/util/UIHelper.java 2008-04-15 08:49:43 UTC (rev 524)
@@ -16,18 +16,18 @@
import org.codelutin.vcs.VCSEntry;
import org.codelutin.vcs.type.VCSAction;
+import org.codelutin.vcs.type.VCSEntryLocation;
import org.codelutin.vcs.type.VCSState;
-import org.codelutin.vcs.type.VCSEntryLocation;
import javax.swing.AbstractAction;
import javax.swing.Action;
+import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JRootPane;
import javax.swing.JTable;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
-import javax.swing.ImageIcon;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.util.EnumMap;
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-en_GB.properties 2008-04-15 08:49:43 UTC (rev 524)
@@ -13,8 +13,11 @@
lutinvcs.action.nextfile.tip=select newt file
lutinvcs.action.previousdiff.tip=goto previous diff
lutinvcs.action.previousfile.tip=select previous file
+lutinvcs.action.showconfig.libelle=
+lutinvcs.action.showconfig.tip=
lutinvcs.action.showmessages.tip=show previous commit messages
lutinvcs.action.single.tip=Launch action ''{0}'' on selected file ''{1}''
+lutinvcs.config.find.public.key=Public ssh key (*.pub) associated with the required private key
lutinvcs.file=File
lutinvcs.module=Module
lutinvcs.status=Status
Modified: trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties
===================================================================
--- trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-15 08:48:00 UTC (rev 523)
+++ trunk/lutinvcs/ui/common/src/main/resources/i18n/common-fr_FR.properties 2008-04-15 08:49:43 UTC (rev 524)
@@ -13,8 +13,11 @@
lutinvcs.action.nextfile.tip=S\u00E9lectionner le prochain fichier
lutinvcs.action.previousdiff.tip=voir la diff\u00E9rence pr\u00E9c\u00E9dente
lutinvcs.action.previousfile.tip=S\u00E9lectionner le pr\u00E9c\u00E9dent fichier
+lutinvcs.action.showconfig.libelle=Modifier la configuration
+lutinvcs.action.showconfig.tip=Modifier la configuration vcs
lutinvcs.action.showmessages.tip=voir les messages de publication pr\u00E9c\u00E9dents
lutinvcs.action.single.tip=ex\u00E9cuter l''action ''{0}'' sur le fichier s\u00E9l\u00E9ctionn\u00E9 ''{1}''
+lutinvcs.config.find.public.key=Clef publique ssh (*.pub) associ\u00E9e \u00E0 la clef priv\u00E9e
lutinvcs.file=Fichier
lutinvcs.module=Module
lutinvcs.status=Status
1
0