Simexplorer-si-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
February 2008
- 2 participants
- 701 discussions
r1135 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing: . model
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 13:50:41 +0000 (Wed, 20 Feb 2008)
New Revision: 1135
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java
Log:
refactoring model d'onglet de synchronisation
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-20 13:49:46 UTC (rev 1134)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-20 13:50:41 UTC (rev 1135)
@@ -19,9 +19,9 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
+import javax.swing.JTabbedPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
@@ -43,60 +43,66 @@
public class SynchronizeTabRefreshHelper {
protected static void refreshSynchronizeTab(JSynchronizeTab ui, SynchronizeTabModel model) {
- SynchronizeTabRefreshHelper.refreshTreeLocalActions(ui, null);
- SynchronizeTabRefreshHelper.refreshTreeRemoteActions(ui, null);
- SynchronizeTabRefreshHelper.refreshExportElement(ui, model, true);
- SynchronizeTabRefreshHelper.refreshExportElement(ui, model, false);
- SynchronizeTabRefreshHelper.refreshRootNodes(ui, model);
+ EntityTreeNodeHelper.refreshTreeActions(ui.getCollapseButton(false), ui.getExpandButton(false), null);
+ EntityTreeNodeHelper.refreshTreeActions(ui.getCollapseButton(true), ui.getExpandButton(true), null);
+
+ refreshExportElement(ui, model, true);
+ refreshExportElement(ui, model, false);
+
+ refreshRootNode(ui, model, false);
+ refreshRootNode(ui, model, true);
}
- public static void refreshRootNodes(JSynchronizeTab ui, SynchronizeTabModel model) {
+ public static void updateTree(JTabbedPane container, LoggableElement oldLocalRoot, LoggableElement oldRemoteRoot) {
- boolean remote = model.isRemote();
- TreeNode sourceRoot = EntityTreeNodeHelper.build(model.getSource(), remote);
- TreeNode destinationRoot = model.getDestination() == null ? null : EntityTreeNodeHelper.build(model.getDestination(), !remote);
+ SimExplorerTab tab = SimExplorerTab.synchronize;
- JTree sourceTree, destinationTree;
- if (remote) {
- // source is remote
- sourceTree = ui.getContentTreeRemote();
- destinationTree = ui.getContentTreeLocal();
- } else {
- // source is local
- sourceTree = ui.getContentTreeLocal();
- destinationTree = ui.getContentTreeRemote();
+ SynchronizeTabModel model = (SynchronizeTabModel) tab.getModel();
+ if (model.getRootNode(false) == null && model.getRootNode(true) == null) {
+ // on doit supprimer la vue
+ tab.closeTab(container);
}
- ((DefaultTreeModel) sourceTree.getModel()).setRoot(sourceRoot);
- ((DefaultTreeModel) destinationTree.getModel()).setRoot(destinationRoot);
- if (sourceRoot == null) {
- sourceTree.getSelectionModel().clearSelection();
- } else {
- sourceTree.setSelectionRow(0);
+ JSynchronizeTab ui = (JSynchronizeTab) tab.getUI();
+
+ if (model.getRootNode(false) != oldLocalRoot) {
+ // rebuild node ?
+ refreshRootNode(ui, model, false);
}
- if (destinationRoot == null) {
- destinationTree.getSelectionModel().clearSelection();
+ if (model.getRootNode(true) != oldRemoteRoot) {
+ // rebuild node ?
+ refreshRootNode(ui, model, true);
+ }
+ }
+
+ protected static void refreshRootNode(JSynchronizeTab ui, SynchronizeTabModel model, boolean remote) {
+
+ LoggableElement element;
+ TreeNode root = null;
+
+ element = model.getRootNode(remote);
+ if (element != null) {
+ root = EntityTreeNodeHelper.build(element, remote);
+ }
+
+ JTree tree = ui.getTree(remote);
+
+ ((DefaultTreeModel) tree.getModel()).setRoot(root);
+
+ if (root == null) {
+ tree.getSelectionModel().clearSelection();
} else {
- destinationTree.setSelectionRow(0);
+ tree.setSelectionRow(0);
}
}
public static void refreshExportElement(JSynchronizeTab ui, SynchronizeTabModel model, boolean remote) {
LoggableElement sNode = model.getSelectedNode(remote);
- MainUIRefreshHelper.refreshExportElement(remote ? ui.getExportElementToLocal() : ui.getExportElementToRemote(), remote, sNode);
+ MainUIRefreshHelper.refreshExportElement(ui.getExportButton(remote), remote, sNode);
}
- public static void refreshTreeLocalActions(JSynchronizeTab ui, EntityTreeNode node) {
- EntityTreeNodeHelper.refreshTreeActions(ui.getCollapseAllLocal(), ui.getExpandAllLocal(), node);
- }
-
- public static void refreshTreeRemoteActions(JSynchronizeTab ui, EntityTreeNode node) {
- EntityTreeNodeHelper.refreshTreeActions(ui.getCollapseAllRemote(), ui.getExpandAllRemote(), node);
- }
-
-
protected SynchronizeTabRefreshHelper() {
// do not instanciate me please
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java 2008-02-20 13:49:46 UTC (rev 1134)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java 2008-02-20 13:50:41 UTC (rev 1135)
@@ -19,84 +19,133 @@
package fr.cemagref.simexplorer.is.ui.swing.model;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.entities.metadata.Version;
+import fr.cemagref.simexplorer.is.ui.SimExplorerContext;
+import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
/**
- * Le model pour un Tab contenant 2 listes d'applications
+ * Le model pour un Tab contenant 2 arbres de navigation de LE
*
* @author chemit
*/
public class SynchronizeTabModel extends SimExplorerTabModel {
+ public static final String ROOT_LOCAL_NODE_PROPERTY_CHANGED = "rootLocalNodePropertyChanged";
+
+ public static final String ROOT_REMOTE_NODE_PROPERTY_CHANGED = "rootRemoteNodePropertyChanged";
+
public static final String SELECTED_LOCAL_NODE_PROPERTY_CHANGED = "selectedLocalNodePropertyChanged";
public static final String SELECTED_REMOTE_NODE_PROPERTY_CHANGED = "selectedRemoteNodePropertyChanged";
private static final long serialVersionUID = -3623331875470531459L;
- /** l'élément source de la demande de synchronisation */
- protected LoggableElement destination;
+ /** la racine de l'arbre de nivation local. */
+ protected LoggableElement localRootNode;
- /** l'élément destination de la demande de synchronisation */
- protected LoggableElement source;
+ /** la racine de l'abre de navigation distant. */
+ protected LoggableElement remoteRootNode;
- /** l'élément dans l'arbre de navigation sélectionné dans l'abre distant */
- protected LoggableElement remoteSelectedNode;
-
- /** l'élément dans l'arbre de navigation sélectionné dans l'abre local */
+ /** l'élément dans l'arbre de navigation local sélectionné */
protected LoggableElement localSelectedNode;
- public LoggableElement getSource() {
- return source;
- }
+ /** l'élément de l'arbre de navigation distant sélectionné */
+ protected LoggableElement remoteSelectedNode;
- public LoggableElement getDestination() {
- return destination;
+ /**
+ * @param remote flag pour indiquer sur quel arbre on travaille
+ * @return le LE encapsulé dans le root de l'arbre de navigation, ou null
+ */
+ public LoggableElement getRootNode(boolean remote) {
+ return remote ? remoteRootNode : localRootNode;
}
- public LoggableElement getLocalSelectedNode() {
- return localSelectedNode;
+ /**
+ * @param remote flag pour indiquer sur quel arbre on travaille
+ * @return le LE encapsulé dans le noeud sélection de l'arbre de navigation, ou null
+ */
+ public LoggableElement getSelectedNode(boolean remote) {
+ return remote ? remoteSelectedNode : localSelectedNode;
}
- public LoggableElement getRemoteSelectedNode() {
- return remoteSelectedNode;
+ public String getRootProperty(boolean remote) {
+ return remote ? ROOT_REMOTE_NODE_PROPERTY_CHANGED : ROOT_LOCAL_NODE_PROPERTY_CHANGED;
}
- public LoggableElement getSelectedNode(boolean remote) {
- return remote ? getRemoteSelectedNode() : getLocalSelectedNode();
+ public String getSelectedProperty(boolean remote) {
+ return remote ? SELECTED_REMOTE_NODE_PROPERTY_CHANGED : SELECTED_LOCAL_NODE_PROPERTY_CHANGED;
}
- public LoggableElement getRootNode(boolean remote) {
+ public void setRootNode(LoggableElement source, boolean remote) {
+ String property = getRootProperty(remote);
+ LoggableElement oldRootNode = getRootNode(remote);
if (remote) {
- return isRemote() ? getLocalSelectedNode() : getRemoteSelectedNode();
+ remoteRootNode = source;
} else {
- return isRemote() ? getRemoteSelectedNode() : getLocalSelectedNode();
+ localRootNode = source;
}
+ firePropertyChange(property, oldRootNode, source);
}
- public void setSource(LoggableElement source) {
- this.source = source;
+ public void setSelectedNode(LoggableElement source, boolean remote) {
+ String property = getSelectedProperty(remote);
+ LoggableElement oldSelectedNode = getSelectedNode(remote);
+ if (remote) {
+ remoteSelectedNode = source;
+ } else {
+ localSelectedNode = source;
+ }
+ firePropertyChange(property, oldSelectedNode, source);
}
- public void setDestination(LoggableElement destination) {
- this.destination = destination;
- }
+ public void updateTabModel(SimExplorerContext context, DataEntityModel selected) {
- public void setLocalSelectedNode(LoggableElement localSelectedNode) {
- LoggableElement oldSelectedNode = this.localSelectedNode;
- this.localSelectedNode = localSelectedNode;
- firePropertyChange(SELECTED_LOCAL_NODE_PROPERTY_CHANGED, oldSelectedNode, localSelectedNode);
- }
+ // on nettoye le model avant tout
+ reset();
- public void setRemoteSelectedNode(LoggableElement remoteSelectedNode) {
- LoggableElement oldSelectedNode = this.remoteSelectedNode;
- this.remoteSelectedNode = remoteSelectedNode;
- firePropertyChange(SELECTED_REMOTE_NODE_PROPERTY_CHANGED, oldSelectedNode, remoteSelectedNode);
+ if (selected == null) {
+ // rien de plus à faire
+ return;
+ }
+
+ boolean remote = selected.isRemote();
+ String uuid = selected.getUuid();
+
+ // l'élément selectionné est bien la source
+ setSelectedItem(selected);
+
+ DataEntityModel save = getSelectedItem();
+ LoggableElement source = save.getLe(context);
+
+ setSelectedItem(null);
+
+ // recuperation des versions de l'element destination
+ Version[] versions = StorageServiceHelper.getVersions(context, !remote, uuid);
+ Version requiredVersion = null;
+ if (versions.length != 0) {
+ // on prend la dernière version disponible dans la base (i.e
+ // la première de la liste des versions :))
+ requiredVersion = versions[0];
+ }
+
+ synch(!remote, uuid, requiredVersion);
+
+ LoggableElement destination = getSelectedItem().getLe(context);
+
+ // sauvegarde de la source
+ setRootNode(source, remote);
+
+ // sauvegarde de la destination
+ setRootNode(destination, !remote);
+
+ setSelectedItem(save);
}
+ @Override
public void reset() {
super.reset();
localSelectedNode = remoteSelectedNode = null;
- source = destination = null;
+ localRootNode = remoteRootNode = null;
}
}
\ No newline at end of file
1
0
r1134 - trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 13:49:46 +0000 (Wed, 20 Feb 2008)
New Revision: 1134
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JSynchronizeTab.jaxx
Log:
ajout de methodes generiques pour travailler sur l'ui de synchronisation (avec un parametre remote)
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JSynchronizeTab.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JSynchronizeTab.jaxx 2008-02-19 21:50:22 UTC (rev 1133)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/JSynchronizeTab.jaxx 2008-02-20 13:49:46 UTC (rev 1134)
@@ -1,13 +1,25 @@
<JAXXTab insets='0,0,0,0'>
<style source="common.css"/>
+ <script>
+public JTree getTree(boolean remote) {
+ return remote ? treeRemote : treeLocal;
+}
+public AbstractButton getExpandButton(boolean remote) {
+ return remote ? expandAllRemote : expandAllLocal;
+}
+public AbstractButton getCollapseButton(boolean remote) {
+ return remote ? collapseAllRemote : collapseAllLocal;
+}
+public AbstractButton getExportButton(boolean remote) {
+ return remote ? exportElementToLocal : exportElementToRemote;
+}
+ </script>
<row>
<cell>
<Table id='toolbarNavigationLocal' styleClass='border' insets='0,0,0,0'>
<row>
<cell insets='0,5,0,0' weightx="1" fill='horizontal'>
- <JLabel id='navigationHeaderLocal'
- icon='{createImageIcon("action/local.png")}'
- text='simexplorer.node.navigation.local'/>
+ <JLabel id='navigationHeaderLocal' icon='{createImageIcon("action/local.png")}' text='simexplorer.node.navigation.local'/>
</cell>
<cell anchor="east">
<JToolBar>
@@ -24,9 +36,7 @@
<Table id='toolbarNavigationRemote' styleClass='border' insets='0,0,0,0'>
<row>
<cell insets='0,5,0,0' weightx="1" fill='horizontal'>
- <JLabel id='navigationHeaderRemote'
- icon='{createImageIcon("action/remote.png")}'
- text='simexplorer.node.navigation.remote'/>
+ <JLabel id='navigationHeaderRemote' icon='{createImageIcon("action/remote.png")}' text='simexplorer.node.navigation.remote'/>
</cell>
<cell anchor="east">
<JToolBar>
@@ -41,7 +51,7 @@
<row fill="both">
<cell weightx="1" weighty="1">
<JScrollPane columnHeaderView='{toolbarNavigationLocal}' horizontalScrollBarPolicy='horizontal_scrollbar_always' verticalScrollBarPolicy='vertical_scrollbar_always'>
- <JTree id='contentTreeLocal' model='{new javax.swing.tree.DefaultTreeModel(null)}'/>
+ <JTree id='treeLocal' model='{new javax.swing.tree.DefaultTreeModel(null)}'/>
</JScrollPane>
</cell>
<cell fill='vertical'>
@@ -70,7 +80,7 @@
</cell>
<cell weightx="1" weighty="1">
<JScrollPane columnHeaderView='{toolbarNavigationRemote}' horizontalScrollBarPolicy='horizontal_scrollbar_always' verticalScrollBarPolicy='vertical_scrollbar_always'>
- <JTree id='contentTreeRemote' model='{new javax.swing.tree.DefaultTreeModel(null)}'/>
+ <JTree id='treeRemote' model='{new javax.swing.tree.DefaultTreeModel(null)}'/>
</JScrollPane>
</cell>
</row>
1
0
r1133 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing/actions resources/i18n
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 21:50:22 +0000 (Tue, 19 Feb 2008)
New Revision: 1133
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
Log:
improve export refresh
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java 2008-02-19 21:13:55 UTC (rev 1132)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java 2008-02-19 21:50:22 UTC (rev 1133)
@@ -133,6 +133,10 @@
protected void updateSynchronizeTab() {
SimExplorerTab tab;
tab = SimExplorerTab.synchronize;
+ if (!tab.isTabVisible(getTabContainer())) {
+ // nothing to do
+ return;
+ }
JSynchronizeTab ui = (JSynchronizeTab) tab.getUI();
SynchronizeTabModel model = (SynchronizeTabModel) tab.getModel();
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java 2008-02-19 21:13:55 UTC (rev 1132)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java 2008-02-19 21:50:22 UTC (rev 1133)
@@ -21,8 +21,8 @@
import fr.cemagref.simexplorer.is.service.StorageService;
import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
@@ -30,11 +30,10 @@
import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.SimExplorerTabModel;
import jaxx.runtime.builder.TabModel;
+import static org.codelutin.i18n.I18n.n_;
import java.awt.event.ActionEvent;
-import static org.codelutin.i18n.I18n.n_;
-
/**
* Action pour exporter une application
*
@@ -141,9 +140,15 @@
model.setPagination(null);
model.updateTabModel(getContext(), (ListTableModel) ui.getTable().getModel());
tab.updateUI();
+ boolean wasVisible = SimExplorerTab.synchronize.isTabVisible(getTabContainer());
+ if (wasVisible) {
+ SimExplorerActionManager.fireAction("showTab_synchronize", e.getSource());
+ if (getTab() != SimExplorerTab.synchronize) {
+ SimExplorerTab.synchronize.closeTab(getTabContainer());
+ getTab().showTab(getTabContainer());
+ }
+ }
- // reinit de l'onglet synchronize
- SimExplorerActionManager.fireAction("showTab_synchronize",e.getSource());
}
@Override
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 21:13:55 UTC (rev 1132)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 21:50:22 UTC (rev 1133)
@@ -72,16 +72,16 @@
simexplorer.action.hideTab_remote.tooltip=Cacher la liste des \u00E9l\u00E9ments du serveur distant
simexplorer.action.historyDelete=Suprimer de l'historique
simexplorer.action.historyDelete.help=
-simexplorer.action.historyDelete.tooltip=Supprimer un élément de l'historique
+simexplorer.action.historyDelete.tooltip=Supprimer un \u00E9l\u00E9ment de l'historique
simexplorer.action.historyNext=El\u00E9ment suivant
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Afficher l''\u00E9l\u00E9ment suivant ''{0}''
simexplorer.action.historyPrevious=El\u00E9ment pr\u00E9c\u00E9dent
simexplorer.action.historyPrevious.help=
simexplorer.action.historyPrevious.tooltip=Afficher l''\u00E9l\u00E9ment pr\u00E9c\u00E9dent ''{0}''
-simexplorer.action.historyUnconnect=Supprimer les éléments distants
+simexplorer.action.historyUnconnect=Supprimer les \u00E9l\u00E9ments distants
simexplorer.action.historyUnconnect.help=
-simexplorer.action.historyUnconnect.tooltip=Supprimer les éléments distants de l'historique
+simexplorer.action.historyUnconnect.tooltip=Supprimer les \u00E9l\u00E9ments distants de l'historique
simexplorer.action.i18n.en=Anglais
simexplorer.action.i18n.en.help=
simexplorer.action.i18n.en.tooltip=Traduire l'application en anglais
1
0
r1132 - trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 21:13:55 +0000 (Tue, 19 Feb 2008)
New Revision: 1132
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
Log:
improve export refresh
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 21:10:23 UTC (rev 1131)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 21:13:55 UTC (rev 1132)
@@ -42,10 +42,10 @@
simexplorer.action.exportElement.help=
simexplorer.action.exportElementToLocal=export to local
simexplorer.action.exportElementToLocal.help=
-simexplorer.action.exportElementToLocal.tooltip=Export element ''{0}'' to locale database
+simexplorer.action.exportElementToLocal.tooltip=Export element ''{0} [{1}]'' to locale database
simexplorer.action.exportElementToRemote=export to remote
simexplorer.action.exportElementToRemote.help=
-simexplorer.action.exportElementToRemote.tooltip=Export element ''{0}'' to remote database
+simexplorer.action.exportElementToRemote.tooltip=Export element ''{0} [{1}]'' to remote database
simexplorer.action.goFirstPage=First page
simexplorer.action.goFirstPage.help=
simexplorer.action.goFirstPage.tooltip=Access to first page in the list of results
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 21:10:23 UTC (rev 1131)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 21:13:55 UTC (rev 1132)
@@ -42,10 +42,10 @@
simexplorer.action.exportElement.help=
simexplorer.action.exportElementToLocal=Exporter vers le serveur local
simexplorer.action.exportElementToLocal.help=
-simexplorer.action.exportElementToLocal.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}'' vers la base locale
+simexplorer.action.exportElementToLocal.tooltip=Exporter l''\u00E9l\u00E9ment ''{0} [{1}]'' vers la base locale
simexplorer.action.exportElementToRemote=Exporter vers le serveur distant
simexplorer.action.exportElementToRemote.help=
-simexplorer.action.exportElementToRemote.tooltip=Export l''\u00E9l\u00E9ment ''{0}'' vers la base distante
+simexplorer.action.exportElementToRemote.tooltip=Export l''\u00E9l\u00E9ment ''{0} [{1}]'' vers la base distante
simexplorer.action.goFirstPage=Premi\u00E8re page
simexplorer.action.goFirstPage.help=
simexplorer.action.goFirstPage.tooltip=Acc\u00E9der \u00E0 la premi\u00E8re page de la liste des r\u00E9sultats
1
0
r1131 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing resources/i18n
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 21:10:23 +0000 (Tue, 19 Feb 2008)
New Revision: 1131
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
Log:
improve export refresh
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-19 20:50:34 UTC (rev 1130)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-19 21:10:23 UTC (rev 1131)
@@ -18,16 +18,16 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.entities.metadata.Version;
import fr.cemagref.simexplorer.is.ui.SimExplorer;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
import fr.cemagref.simexplorer.is.ui.swing.model.DetailTableModel;
import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
import static org.codelutin.i18n.I18n._;
import javax.swing.DefaultComboBoxModel;
@@ -62,7 +62,7 @@
EntityTreeNode root = EntityTreeNodeHelper.build(model.getRootNode(), model.isRemote());
EntityTreeNode current = model.getHistory().getCurrent();
//FIXME : if object has different version, it says that this is same!!!
- if (current==null || !root.getUserObject().equals(current.getUserObject())) {
+ if (current == null || !root.getUserObject().equals(current.getUserObject())) {
model.getHistory().add(root);
}
DetailTabRefreshHelper.updateDetailNavigationTree(ui, model.getHistory());
@@ -95,19 +95,19 @@
public static void refreshDownloadElementAction(JDetailTab ui, DetailTabModel model, EntityTreeNode node) {
MetaData detail = model.getDetail();
boolean enabled = EntityHelper.Action.DOWNLOAD.accept(node);
- MainUIRefreshHelper.UpdateButton(ui.getDownloadElement(), enabled, enabled?detail == null ? node.getUserObject() : detail.getName() + " [" + model.getSelectedVersion() + "]":null);
+ MainUIRefreshHelper.UpdateButton(ui.getDownloadElement(), enabled, enabled ? detail == null ? node.getUserObject() : detail.getName() + " [" + model.getSelectedVersion() + "]" : null);
}
protected static void refreshDeleteAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
boolean enabled = EntityHelper.Action.DELETE.accept(detail);
- MainUIRefreshHelper.UpdateButton(ui.getDeleteElement(), enabled, enabled?detail.getName() + " [" + model.getSelectedVersion() + "]":null);
+ MainUIRefreshHelper.UpdateButton(ui.getDeleteElement(), enabled, enabled ? detail.getName() + " [" + model.getSelectedVersion() + "]" : null);
}
public static void refreshDownloadAttachmentAction(JDetailTab ui, DetailTabModel model) {
Attachment attachment = model.getSelectedAttachment();
boolean enabled = model.getDetail() != null && attachment != null;
- MainUIRefreshHelper.UpdateButton(ui.getDownloadAttachment(), enabled, enabled?attachment:null);
+ MainUIRefreshHelper.UpdateButton(ui.getDownloadAttachment(), enabled, enabled ? attachment : null);
}
public static void refreshDetailToTreeAction(JDetailTab ui, DetailTabModel model) {
@@ -123,26 +123,20 @@
}
boolean enabled = !(detail.getName().equals(data.getName()) && data.getVersion().equals(version));
- MainUIRefreshHelper.UpdateButton(ui.getDetailToTree(), enabled, enabled?detail.getName() + " [" + version + "]":null);
+ MainUIRefreshHelper.UpdateButton(ui.getDetailToTree(), enabled, enabled ? detail.getName() + " [" + version + "]" : null);
}
public static void refreshSynchroniseAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
boolean enabled = detail != null && SimExplorer.getContext().isConnected();
- MainUIRefreshHelper.UpdateButton(ui.getShowTab_synchronize(), enabled, enabled?detail.getName() + " [" + model.getSelectedVersion() + "]":null);
+ MainUIRefreshHelper.UpdateButton(ui.getShowTab_synchronize(), enabled, enabled ? detail.getName() + " [" + model.getSelectedVersion() + "]" : null);
}
public static void refreshExportAction(JDetailTab ui, DetailTabModel model) {
- MetaData detail = model.getDetail();
LoggableElement sNode = model.getSelectedNode();
- boolean enabled = SimExplorer.getContext().isConnected() && EntityHelper.Action.EXPORT.accept(sNode);
-
- String text = null;
- if (enabled) {
- text = detail.getName() + " [" + model.getSelectedVersion() + "]";
- }
- MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),enabled,model.isRemote(), text );
-
+ MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),
+ model.isRemote(),
+ sNode);
}
public static void resetHistory(JDetailTab ui, DetailTabModel model, DefaultComboBoxModel historyModel) {
@@ -185,7 +179,7 @@
// push it in tree model
((DefaultTreeModel) ui.getNavigationTree().getModel()).setRoot(model.getCurrent());
// by default select the root node
- if (ui.getNavigationTree().getModel().getRoot()!=null) {
+ if (ui.getNavigationTree().getModel().getRoot() != null) {
ui.getNavigationTree().setSelectionRow(0);
}
boolean enabled;
@@ -198,7 +192,7 @@
public static void updateDetailPanel(Integer index, final JDetailTab ui, DetailTabModel model, LoggableElement selectedNode) {
MetaData detail = model.getDetail();
ui.getDetailVersions().setVisible(true);
- if (ui.getDetailVersions().getItemCount()>0) {
+ if (ui.getDetailVersions().getItemCount() > 0) {
ui.getDetailVersions().setSelectedIndex(index);
}
ui.getDetailHeader().setText(selectedNode.getMetaData().getName());
@@ -212,7 +206,7 @@
ui.getDetailDescription().setText(s);
if (!s.equals(tooltip)) {
ui.getDetailDescription().setToolTipText(tooltip);
- }
+ }
ui.getDetailCreationDate().setText(DATE_FORMAT.format(detail.getCreationDate()));
ui.getDetail().setVisible(true);
JTable table = ui.getDetailTable();
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-19 20:50:34 UTC (rev 1130)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-19 21:10:23 UTC (rev 1131)
@@ -101,7 +101,7 @@
boolean isConnected = SimExplorer.getContext().isConnected();
boolean enabled = isConnected && EntityHelper.Action.EXPORT.accept(data);
- MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),enabled, model.isRemote(),text );
+ MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),enabled, model.isRemote(),data.getName(),data.getVersion().toString());
MainUIRefreshHelper.UpdateButton(ui.getShowTab_detail(), true, text);
MainUIRefreshHelper.UpdateButton(ui.getShowTab_synchronize(), isConnected, text);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-19 20:50:34 UTC (rev 1130)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-19 21:10:23 UTC (rev 1131)
@@ -45,33 +45,16 @@
public static void refreshExportElement(AbstractButton button, boolean remote, LoggableElement sNode) {
boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
- String text = null;
- if (enabled) {
- text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
- }
- button.setEnabled(enabled);
- if (!enabled) {
- button.setToolTipText(null);
- } else {
-
- }
- ExportElementAction action = (ExportElementAction) button.getAction();
- String t = _(action.getI18nToolTipText(remote), text);
- button.setToolTipText(t);
+ refreshExportElement(button, enabled, remote, enabled ? sNode.getMetaData().getName() : null, enabled ? sNode.getMetaData().getVersion().toString() : null);
}
- public static void refreshExportElement(AbstractButton button, boolean enabled,boolean remote ,String text) {
- if (!enabled) {
- text = null;
- }
+ public static void refreshExportElement(AbstractButton button, boolean enabled, boolean remote, String name, String version) {
button.setEnabled(enabled);
- if (!enabled) {
- button.setToolTipText(null);
- } else {
-
+ String t = null;
+ if (enabled) {
+ ExportElementAction action = (ExportElementAction) button.getAction();
+ t = _(action.getI18nToolTipText(remote), name, version);
}
- ExportElementAction action = (ExportElementAction) button.getAction();
- String t = _(action.getI18nToolTipText(remote), text);
button.setToolTipText(t);
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 20:50:34 UTC (rev 1130)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 21:10:23 UTC (rev 1131)
@@ -40,7 +40,6 @@
simexplorer.action.expandAll.tooltip=Expand all nodes of ''{0}''
simexplorer.action.exportElement=export
simexplorer.action.exportElement.help=
-simexplorer.action.exportElement.tooltip=Export element ''{0}''
simexplorer.action.exportElementToLocal=export to local
simexplorer.action.exportElementToLocal.help=
simexplorer.action.exportElementToLocal.tooltip=Export element ''{0}'' to locale database
@@ -71,12 +70,18 @@
simexplorer.action.hideTab_remote=List (remote)
simexplorer.action.hideTab_remote.help=
simexplorer.action.hideTab_remote.tooltip=Hide the list of remote elements
+simexplorer.action.historyDelete=
+simexplorer.action.historyDelete.help=
+simexplorer.action.historyDelete.tooltip=
simexplorer.action.historyNext=Next in history
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Display next element ''{0}''
simexplorer.action.historyPrevious=Previous in history
simexplorer.action.historyPrevious.help=
simexplorer.action.historyPrevious.tooltip=Display previous element ''{0}''
+simexplorer.action.historyUnconnect=
+simexplorer.action.historyUnconnect.help=
+simexplorer.action.historyUnconnect.tooltip=
simexplorer.action.i18n.en=English
simexplorer.action.i18n.en.help=
simexplorer.action.i18n.en.tooltip=Change to english language
@@ -115,7 +120,6 @@
simexplorer.action.site=Site
simexplorer.action.site.help=
simexplorer.action.site.tooltip=Go to SimExplorer SI site
-simexplorer.action.synchronize.tooltip=Launch synchronization of ''{0}''
simexplorer.action.unconnect=Unconnect
simexplorer.action.unconnect.help=
simexplorer.action.unconnect.tooltip=Disconnect from remote server
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 20:50:34 UTC (rev 1130)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 21:10:23 UTC (rev 1131)
@@ -40,7 +40,6 @@
simexplorer.action.expandAll.tooltip=\u00E9taler tous les noeuds de ''{0}''
simexplorer.action.exportElement=Exporter
simexplorer.action.exportElement.help=
-#simexplorer.action.exportElement.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}''
simexplorer.action.exportElementToLocal=Exporter vers le serveur local
simexplorer.action.exportElementToLocal.help=
simexplorer.action.exportElementToLocal.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}'' vers la base locale
@@ -71,12 +70,18 @@
simexplorer.action.hideTab_remote=Liste distante
simexplorer.action.hideTab_remote.help=
simexplorer.action.hideTab_remote.tooltip=Cacher la liste des \u00E9l\u00E9ments du serveur distant
+simexplorer.action.historyDelete=Suprimer de l'historique
+simexplorer.action.historyDelete.help=
+simexplorer.action.historyDelete.tooltip=Supprimer un élément de l'historique
simexplorer.action.historyNext=El\u00E9ment suivant
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Afficher l''\u00E9l\u00E9ment suivant ''{0}''
simexplorer.action.historyPrevious=El\u00E9ment pr\u00E9c\u00E9dent
simexplorer.action.historyPrevious.help=
simexplorer.action.historyPrevious.tooltip=Afficher l''\u00E9l\u00E9ment pr\u00E9c\u00E9dent ''{0}''
+simexplorer.action.historyUnconnect=Supprimer les éléments distants
+simexplorer.action.historyUnconnect.help=
+simexplorer.action.historyUnconnect.tooltip=Supprimer les éléments distants de l'historique
simexplorer.action.i18n.en=Anglais
simexplorer.action.i18n.en.help=
simexplorer.action.i18n.en.tooltip=Traduire l'application en anglais
@@ -111,11 +116,10 @@
simexplorer.action.showTab_remote.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur distant
simexplorer.action.showTab_synchronize=Synchroniser
simexplorer.action.showTab_synchronize.help=
-simexplorer.action.showTab_synchronize.tooltip=Afficher l''\u00E9cran de synchronisation de l''élément ''{0}''
+simexplorer.action.showTab_synchronize.tooltip=Afficher l''\u00E9cran de synchronisation de l''\u00E9l\u00E9ment ''{0}''
simexplorer.action.site=Site
simexplorer.action.site.help=
simexplorer.action.site.tooltip=Acc\u00E9der dans votre navigateur au site de SimExplorer-SI
-simexplorer.action.synchronize.tooltip=Lancer la synchronisation de ''{0}''
simexplorer.action.unconnect=D\u00E9connexion
simexplorer.action.unconnect.help=
simexplorer.action.unconnect.tooltip=Se d\u00E9connecter du serveur distant
1
0
r1130 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 20:50:34 +0000 (Tue, 19 Feb 2008)
New Revision: 1130
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java
Log:
tooltip automatique
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java 2008-02-19 20:50:06 UTC (rev 1129)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java 2008-02-19 20:50:34 UTC (rev 1130)
@@ -1,135 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.service.StorageService;
-import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
-import fr.cemagref.simexplorer.is.ui.swing.JListTab;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.SimExplorerTabModel;
-import jaxx.runtime.builder.TabModel;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action pour exporter une application
- *
- * @author chemit
- */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "exportApplication",
- name = "simexplorer.action.export",
- shortDescription = "simexplorer.action.export.tooltip",
- longDescription = "simexplorer.action.export.help",
- smallIcon = "action/export-element.png",
- mnemonic = 'x',
- hideActionText = true
-)
-public class ExportAction extends SimExplorerAbstractTabAction {
-
- private static final long serialVersionUID = 7535647131305304738L;
-
- protected DataEntityModel selected;
-
- protected StorageService fromService, toService;
-
- public ExportAction(String name) {
- super(name);
- }
-
- @Override
- protected boolean beforeAction(ActionEvent e) throws Exception {
- if (!super.beforeAction(e)) {
- return false;
- }
-
- // on retrouve l'onglet concerné à partir de son model
- TabModel tabModel = getModel();
-
- if (tabModel instanceof DetailTabModel) {
- DetailTabModel model = (DetailTabModel) tabModel;
- selected = model.getSelectedItem();
- } else if (tabModel instanceof ListTabModel) {
- ListTabModel model = (ListTabModel) getModel();
- selected = model.getSelectedItem();
- } else if (tabModel instanceof SimExplorerTabModel) {
- // on doit traiter ça dans les classes étendues
- // car cela ne depend pas uniquement du model mais aussi de l'action
- // choisie
- return true;
- }
- boolean result;
- result = selected != null && selected.getUuid() != null;
- if (result) {
- // on garde toujours une copie, pas l'original
- selected = selected.clone();
- }
- //TODO normalement pas besoin de tester l'accessibilite ici
- //result = selected != null && selected.getUuid() != null && EntityHelper.Action.EXPORT.accept(selected.getMeta());
- return result;
- }
-
- @Override
- protected void doAction(ActionEvent e) throws Exception {
- boolean remote = selected.isRemote();
- StorageService fromService = StorageServiceHelper.getService(getContext(), remote);
- StorageService toService = StorageServiceHelper.getService(getContext(), !remote);
- log.info("fromService : " + fromService);
- log.info("toService : " + toService);
- log.info("selected : " + selected);
- fr.cemagref.simexplorer.is.service.StorageServiceHelper.exportElementTo(getContext().getToken(), fromService, toService, selected.getUuid(), selected.getVersion().toString());
- }
-
- @Override
- public void updateUI() {
- // on doit invalider les données apres un export
- ListTabModel model;
- JListTab ui;
- SimExplorerTab tab;
- if (selected.isRemote()) {
- // reinit de la liste locale
- tab = SimExplorerTab.local;
- model = (ListTabModel) tab.getModel();
- ui = (JListTab) tab.getUI();
- } else {
- // reninit de la liste remote
- tab = SimExplorerTab.remote;
- model = (ListTabModel) tab.getModel();
- ui = (JListTab) tab.getUI();
- }
- // pour reforcer le calcul de la liste
- model.setPagination(null);
- model.updateTabModel(getContext(), (ListTableModel) ui.getTable().getModel());
- tab.updateUI();
- }
-
- @Override
- protected void clear() {
- selected = null;
- fromService = toService = null;
- // l'action est multi-tab, et est stateless!
- // on doit recalculer le tab a chaque visite
- setTab(null);
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java 2008-02-19 20:50:06 UTC (rev 1129)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java 2008-02-19 20:50:34 UTC (rev 1130)
@@ -1,72 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action pour exporter une application
- *
- * @author chemit
- */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "exportToLocal",
- name = "simexplorer.action.exportToLocal",
- shortDescription = "simexplorer.action.exportToLocal.tooltip",
- longDescription = "simexplorer.action.exportToLocal.help",
- smallIcon = "action/export-to-local.png",
- mnemonic = 'x',
- hideActionText = true
-)
-public class ExportToLocalAction extends ExportAction {
-
- private static final long serialVersionUID = 7535647131305304738L;
-
- public ExportToLocalAction(String name) {
- super(name);
- }
-
- @Override
- protected boolean beforeAction(ActionEvent e) throws Exception {
- if (!super.beforeAction(e)) {
- return false;
- }
- SynchronizeTabModel model = (SynchronizeTabModel) getModel();
- LoggableElement element = model.getRemoteSelectedNode();
- boolean result;
- if (result = EntityHelper.Action.EXPORT.accept(element)) {
- selected = new DataEntityModel();
- selected.synch(true,element);
- }
- return result;
- }
-
- @Override
- public void updateUI() {
- super.updateUI();
- // reinit de l'onglet synchronize
- SimExplorerActionManager.fireAction("showTab_synchronize",e.getSource());
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java 2008-02-19 20:50:06 UTC (rev 1129)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java 2008-02-19 20:50:34 UTC (rev 1130)
@@ -1,73 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action pour exporter une application
- *
- * @author chemit
- */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "exportToRemote",
- name = "simexplorer.action.exportToRemote",
- shortDescription = "simexplorer.action.exportToRemote.tooltip",
- longDescription = "simexplorer.action.exportToRemote.help",
- smallIcon = "action/export-to-remote.png",
- mnemonic = 'x',
- hideActionText = true
-)
-public class ExportToRemoteAction extends ExportAction {
-
- private static final long serialVersionUID = 7535647131305304738L;
-
- public ExportToRemoteAction(String name) {
- super(name);
- }
-
- @Override
- protected boolean beforeAction(ActionEvent e) throws Exception {
- if (!super.beforeAction(e)) {
- return false;
- }
- SynchronizeTabModel model = (SynchronizeTabModel) getModel();
- LoggableElement element = model.getLocalSelectedNode();
- boolean result;
- if (result = EntityHelper.Action.EXPORT.accept(element)) {
- selected = new DataEntityModel();
- selected.synch(false,element);
- }
- return result;
- }
-
- @Override
- public void updateUI() {
- super.updateUI();
- // reinit de l'onglet synchronize
- SimExplorerActionManager.fireAction("showTab_synchronize",e.getSource());
- //synchronizeAction.actionPerformed((new ActionEvent(e.getSource(), ActionEvent.ACTION_FIRST, "showTab_synchronize")));
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java 2008-02-19 20:50:06 UTC (rev 1129)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java 2008-02-19 20:50:34 UTC (rev 1130)
@@ -1,108 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
-import fr.cemagref.simexplorer.is.ui.swing.ImportDialog;
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Map;
-import java.util.TreeMap;
-
-import static org.codelutin.i18n.I18n.*;
-
-/**
- * Action de base pour importer une application
- *
- * @author tony
- */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "importElement",
- name = "simexplorer.action.import",
- longDescription = "simexplorer.action.import.help",
- smallIcon = "action/import-element.png",
- mnemonic = 'I',
- hideActionText = false
-)
-public class ImportAction extends SimExplorerAbstractTabAction {
-
- protected ImportDialog ui;
-
- protected File f;
- protected Boolean remote;
- private static final long serialVersionUID = 3377670691203328711L;
- private Map<String, String[]> filters;
-
- public ImportAction(String name) {
- super(name);
- filters = new TreeMap<String,String[]>();
- filters.put("ApplicationExploration",new String[]{".*.zip$",_("simexplorer.choose.applicationexploration")});
- filters.put("Library",new String[]{".*.zip$",_("simexplorer.choose.library")});
- }
-
- public void disposeUI() {
- ui = null;
- }
-
- @Override
- protected boolean beforeAction(ActionEvent e) throws Exception {
- if (!super.beforeAction(e)) {
- return false;
- }
- ListTabModel model = (ListTabModel) getModel();
- remote = model.isRemote();
- f = getUi(remote).getFile();
-
- return f != null;
- }
-
- @Override
- protected void doAction(ActionEvent e) throws Exception {
- StorageServiceHelper.importElement(getContext(), remote, f);
- }
-
- @Override
- public void updateUI() {
- super.updateUI();
- //TODO should invalidate the 'remote' list
- //TODO look if detail history is touch by this modification
- //TODO look if synchronize is touched by this modification
- }
-
- @Override
- protected void clear() {
- f = null;
- remote = null;
- // this is a multi-tab action, must reset tab after each action
- setTab(null);
- }
-
- protected ImportDialog getUi(Boolean remote) {
- if (ui == null) {
- ui = new ImportDialog(getMainUI(),filters);
- }
- ui.setTitle(remote? _("simexplorer.action.import.remote.tooltip"):_("simexplorer.action.import.local.tooltip"));
- ui.getTypeImport().setSelected(ui.getSelected().getModel(),true);
- ui.getTypeImport().updateSelectedValue();
- return ui;
- }
-}
\ No newline at end of file
1
0
r1129 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing java/fr/cemagref/simexplorer/is/ui/swing/actions java/fr/cemagref/simexplorer/is/ui/swing/actions/util java/fr/cemagref/simexplorer/is/ui/swing/model resources/i18n resources/jaxx uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 20:50:06 +0000 (Tue, 19 Feb 2008)
New Revision: 1129
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToLocalAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToRemoteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportElementAction.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/EntityTreeNodeHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadElementAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowLocalTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowRemoteTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowSynchronizeTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleLocalTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleRemoteTabAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx
Log:
creation paquetagepour les actions d'historique
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/DetailTabRefreshHelper.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -95,22 +95,19 @@
public static void refreshDownloadElementAction(JDetailTab ui, DetailTabModel model, EntityTreeNode node) {
MetaData detail = model.getDetail();
boolean enabled = EntityHelper.Action.DOWNLOAD.accept(node);
- String tooltip = !enabled ? null : _("simexplorer.action.downloadLoggableElement.tooltip", detail == null ? node.getUserObject() : detail.getName() + " [" + model.getSelectedVersion() + "]");
- MainUIRefreshHelper.updateButton(ui.getDownloadElement(), enabled, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDownloadElement(), enabled, enabled?detail == null ? node.getUserObject() : detail.getName() + " [" + model.getSelectedVersion() + "]":null);
}
protected static void refreshDeleteAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
boolean enabled = EntityHelper.Action.DELETE.accept(detail);
- String tooltip = !enabled ? null : _("simexplorer.action.deleteLoggableElement.tooltip", detail.getName() + " [" + model.getSelectedVersion() + "]");
- MainUIRefreshHelper.updateButton(ui.getDeleteElement(), enabled, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDeleteElement(), enabled, enabled?detail.getName() + " [" + model.getSelectedVersion() + "]":null);
}
public static void refreshDownloadAttachmentAction(JDetailTab ui, DetailTabModel model) {
Attachment attachment = model.getSelectedAttachment();
boolean enabled = model.getDetail() != null && attachment != null;
- String tooltip = !enabled ? null : _("simexplorer.action.downloadAttachment.tooltip", attachment);
- MainUIRefreshHelper.updateButton(ui.getDownloadAttachment(), enabled, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDownloadAttachment(), enabled, enabled?attachment:null);
}
public static void refreshDetailToTreeAction(JDetailTab ui, DetailTabModel model) {
@@ -126,28 +123,25 @@
}
boolean enabled = !(detail.getName().equals(data.getName()) && data.getVersion().equals(version));
- String tooltip = !enabled ? null : _("simexplorer.action.detailToTree.tooltip", detail.getName() + " [" + version + "]");
- MainUIRefreshHelper.updateButton(ui.getDetailToTree(), enabled, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDetailToTree(), enabled, enabled?detail.getName() + " [" + version + "]":null);
}
public static void refreshSynchroniseAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
boolean enabled = detail != null && SimExplorer.getContext().isConnected();
- String tooltip = !enabled ? null : _("simexplorer.action.synchronize.tooltip", detail.getName() + " [" + model.getSelectedVersion() + "]");
- MainUIRefreshHelper.updateButton(ui.getShowTab_synchronize(), enabled, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getShowTab_synchronize(), enabled, enabled?detail.getName() + " [" + model.getSelectedVersion() + "]":null);
}
public static void refreshExportAction(JDetailTab ui, DetailTabModel model) {
MetaData detail = model.getDetail();
LoggableElement sNode = model.getSelectedNode();
- //boolean enabled = sNode != null && SimExplorer.getContext().isConnected() && sNode instanceof ExplorationApplication;
boolean enabled = SimExplorer.getContext().isConnected() && EntityHelper.Action.EXPORT.accept(sNode);
String text = null;
if (enabled) {
text = detail.getName() + " [" + model.getSelectedVersion() + "]";
}
- MainUIRefreshHelper.refreshExportAction(enabled, model.isRemote(), text, ui.getExportElement());
+ MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),enabled,model.isRemote(), text );
}
@@ -171,7 +165,7 @@
ui.getDetailVersions().setToolTipText(text);
}
// can not synchronize to tree
- MainUIRefreshHelper.updateButton(ui.getDetailToTree(), false, null);
+ MainUIRefreshHelper.UpdateButton(ui.getDetailToTree(), false);
}
public static void resetDetailPanel(final JDetailTab ui) {
@@ -196,9 +190,9 @@
}
boolean enabled;
enabled = model.size() > 1 && model.hasPrevious();
- MainUIRefreshHelper.updateButton(ui.getHistoryPrevious(), enabled, !enabled ? null : _("simexplorer.action.historyPrevious.tooltip", model.getPrevious()));
+ MainUIRefreshHelper.UpdateButton(ui.getHistoryPrevious(), enabled, !enabled ? null : model.getPrevious());
enabled = model.size() > 1 && model.hasNext();
- MainUIRefreshHelper.updateButton(ui.getHistoryNext(), enabled, !enabled ? null : _("simexplorer.action.historyNext.tooltip", model.getNext()));
+ MainUIRefreshHelper.UpdateButton(ui.getHistoryNext(), enabled, !enabled ? null : model.getNext());
}
public static void updateDetailPanel(Integer index, final JDetailTab ui, DetailTabModel model, LoggableElement selectedNode) {
@@ -218,8 +212,7 @@
ui.getDetailDescription().setText(s);
if (!s.equals(tooltip)) {
ui.getDetailDescription().setToolTipText(tooltip);
- }
- //ui.getDetailName().setText(detail.getName());
+ }
ui.getDetailCreationDate().setText(DATE_FORMAT.format(detail.getCreationDate()));
ui.getDetail().setVisible(true);
JTable table = ui.getDetailTable();
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/EntityTreeNodeHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/EntityTreeNodeHelper.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/EntityTreeNodeHelper.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -39,7 +39,6 @@
import fr.cemagref.simexplorer.is.entities.data.Structure;
import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import static org.codelutin.i18n.I18n._;
import javax.swing.AbstractButton;
import javax.swing.JTree;
@@ -118,12 +117,10 @@
}
public static void refreshTreeActions(AbstractButton collapseButton, AbstractButton expandButton, EntityTreeNode node) {
- String tooltip;
boolean enabled = node != null && !node.isLeaf() && node.getChildCount() > 0;
- tooltip = !enabled ? null : _("simexplorer.action.collapseAll.tooltip", node.getUserObject());
- MainUIRefreshHelper.updateButton(collapseButton, enabled, tooltip);
- tooltip = !enabled ? null : _("simexplorer.action.expandAll.tooltip", node.getUserObject());
- MainUIRefreshHelper.updateButton(expandButton, enabled, tooltip);
+ Object o = enabled?node.getUserObject():null;
+ MainUIRefreshHelper.UpdateButton(collapseButton, enabled, o );
+ MainUIRefreshHelper.UpdateButton(expandButton, enabled, o);
}
protected EntityTreeNodeHelper() {
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/ListTabRefreshHelper.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -24,7 +24,6 @@
import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.PaginationModel;
-import static org.codelutin.i18n.I18n._;
import javax.swing.JComboBox;
import javax.swing.SwingUtilities;
@@ -95,22 +94,17 @@
String text = data.getName() + " [" + data.getVersion() + "]";
- String tooltip = _("simexplorer.action.downloadLoggableElement.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getDownloadElement(), EntityHelper.Action.DOWNLOAD.accept(data), tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDownloadElement(), EntityHelper.Action.DOWNLOAD.accept(data), text);
- tooltip = _("simexplorer.action.deleteLoggableElement.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getDeleteElement(), EntityHelper.Action.DELETE.accept(data), tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getDeleteElement(), EntityHelper.Action.DELETE.accept(data), text);
boolean isConnected = SimExplorer.getContext().isConnected();
boolean enabled = isConnected && EntityHelper.Action.EXPORT.accept(data);
- MainUIRefreshHelper.refreshExportAction(enabled, model.isRemote(), text, ui.getExportElement());
+ MainUIRefreshHelper.refreshExportElement(ui.getExportElement(),enabled, model.isRemote(),text );
- tooltip = _("simexplorer.action.show.detail.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getShowTab_detail(), true, tooltip);
-
- tooltip = _("simexplorer.action.synchronize.tooltip", text);
- MainUIRefreshHelper.updateButton(ui.getShowTab_synchronize(), isConnected, tooltip);
+ MainUIRefreshHelper.UpdateButton(ui.getShowTab_detail(), true, text);
+ MainUIRefreshHelper.UpdateButton(ui.getShowTab_synchronize(), isConnected, text);
}
/**
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/MainUIRefreshHelper.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -18,6 +18,12 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.ui.swing.actions.ExportElementAction;
+import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
+import static org.codelutin.i18n.I18n._;
+
import javax.swing.AbstractButton;
/**
@@ -37,24 +43,51 @@
public class MainUIRefreshHelper {
- public static void refreshExportAction(boolean enabled, boolean remote, String text, AbstractButton button) {
- String tooltip = null;
+ public static void refreshExportElement(AbstractButton button, boolean remote, LoggableElement sNode) {
+ boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
+ String text = null;
if (enabled) {
- if (remote) {
- tooltip = org.codelutin.i18n.I18n._("simexplorer.action.exportToLocal.tooltip", text);
- } else {
- tooltip = org.codelutin.i18n.I18n._("simexplorer.action.exportToRemote.tooltip", text);
- }
+ text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
}
- updateButton(button, enabled, tooltip);
+ button.setEnabled(enabled);
+ if (!enabled) {
+ button.setToolTipText(null);
+ } else {
+
+ }
+ ExportElementAction action = (ExportElementAction) button.getAction();
+ String t = _(action.getI18nToolTipText(remote), text);
+ button.setToolTipText(t);
}
- protected static void updateButton(AbstractButton button, boolean enabled, String tooltip) {
+ public static void refreshExportElement(AbstractButton button, boolean enabled,boolean remote ,String text) {
+ if (!enabled) {
+ text = null;
+ }
button.setEnabled(enabled);
+ if (!enabled) {
+ button.setToolTipText(null);
+ } else {
- button.setToolTipText(enabled ? tooltip : null);
+ }
+ ExportElementAction action = (ExportElementAction) button.getAction();
+ String t = _(action.getI18nToolTipText(remote), text);
+ button.setToolTipText(t);
}
+ protected static void UpdateButton(AbstractButton button, boolean enabled, Object... params) {
+ button.setEnabled(enabled);
+ if (!enabled) {
+ button.setToolTipText(null);
+ } else {
+
+ }
+ SimExplorerAbstractAction action = (SimExplorerAbstractAction) button.getAction();
+ String t = _(action.getI18nToolTipText(), params);
+ button.setToolTipText(t);
+ }
+
+
protected MainUIRefreshHelper() {
// do not instanciate me please
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SynchronizeTabRefreshHelper.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -18,7 +18,6 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing;
-import fr.cemagref.simexplorer.is.entities.EntityHelper;
import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
@@ -46,8 +45,8 @@
protected static void refreshSynchronizeTab(JSynchronizeTab ui, SynchronizeTabModel model) {
SynchronizeTabRefreshHelper.refreshTreeLocalActions(ui, null);
SynchronizeTabRefreshHelper.refreshTreeRemoteActions(ui, null);
- SynchronizeTabRefreshHelper.refreshExportElementToLocalAction(ui, model);
- SynchronizeTabRefreshHelper.refreshExportElementToRemoteAction(ui, model);
+ SynchronizeTabRefreshHelper.refreshExportElement(ui, model, true);
+ SynchronizeTabRefreshHelper.refreshExportElement(ui, model, false);
SynchronizeTabRefreshHelper.refreshRootNodes(ui, model);
}
@@ -84,26 +83,11 @@
}
}
- public static void refreshExportElementToRemoteAction(JSynchronizeTab ui, SynchronizeTabModel model) {
- LoggableElement sNode = model.getLocalSelectedNode();
- boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
- String text = null;
- if (enabled) {
- text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
- }
- MainUIRefreshHelper.refreshExportAction(enabled, false, text, ui.getExportElementToRemote());
+ public static void refreshExportElement(JSynchronizeTab ui, SynchronizeTabModel model, boolean remote) {
+ LoggableElement sNode = model.getSelectedNode(remote);
+ MainUIRefreshHelper.refreshExportElement(remote ? ui.getExportElementToLocal() : ui.getExportElementToRemote(), remote, sNode);
}
- public static void refreshExportElementToLocalAction(JSynchronizeTab ui, SynchronizeTabModel model) {
- LoggableElement sNode = model.getRemoteSelectedNode();
- boolean enabled = EntityHelper.Action.EXPORT.accept(sNode);
- String text = null;
- if (enabled) {
- text = sNode.getMetaData().getName() + " [" + sNode.getMetaData().getVersion() + "]";
- }
- MainUIRefreshHelper.refreshExportAction(enabled, true, text, ui.getExportElementToLocal());
- }
-
public static void refreshTreeLocalActions(JSynchronizeTab ui, EntityTreeNode node) {
EntityTreeNodeHelper.refreshTreeActions(ui.getCollapseAllLocal(), ui.getExpandAllLocal(), node);
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CollapseAllAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -52,6 +52,11 @@
}
@Override
+ public String getI18nToolTipText() {
+ return "simexplorer.action.collapseAll.tooltip";
+ }
+
+ @Override
protected boolean beforeAction(ActionEvent e) throws Exception {
if (!super.beforeAction(e)) {
return false;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DeleteElementAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -41,10 +41,10 @@
* @author chemit
*/
@jaxx.runtime.builder.ActionConfig(
- actionCommand = "deleteLoggableElement",
- name = "simexplorer.action.deleteLoggableElement",
- shortDescription = "simexplorer.action.deleteLoggableElement.tooltip",
- longDescription = "simexplorer.action.deleteLoggableElement.help",
+ actionCommand = "deleteElement",
+ name = "simexplorer.action.deleteElement",
+ shortDescription = "simexplorer.action.deleteElement.tooltip",
+ longDescription = "simexplorer.action.deleteElement.help",
smallIcon = "action/delete.png",
mnemonic = 'x',
hideActionText = true
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadElementAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadElementAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/DownloadElementAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -33,10 +33,10 @@
* @author chemit
*/
@jaxx.runtime.builder.ActionConfig(
- actionCommand = "downloadLoggableElement",
- name = "simexplorer.action.downloadLoggableElement",
- shortDescription = "simexplorer.action.downloadLoggableElement.tooltip",
- longDescription = "simexplorer.action.downloadLoggableElement.help",
+ actionCommand = "downloadElement",
+ name = "simexplorer.action.downloadElement",
+ shortDescription = "simexplorer.action.downloadElement.tooltip",
+ longDescription = "simexplorer.action.downloadElement.help",
smallIcon = "action/download-element.png",
mnemonic = 'x',
hideActionText = true
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExpandAllAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -18,11 +18,11 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
+import fr.cemagref.simexplorer.is.ui.swing.EntityTreeNodeHelper;
import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
import fr.cemagref.simexplorer.is.ui.swing.JSynchronizeTab;
import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.EntityTreeNodeHelper;
import javax.swing.JTree;
import java.awt.event.ActionEvent;
@@ -53,6 +53,11 @@
}
@Override
+ public String getI18nToolTipText() {
+ return "simexplorer.action.expandAll.tooltip";
+ }
+
+ @Override
protected boolean beforeAction(ActionEvent e) throws Exception {
if (!super.beforeAction(e)) {
return false;
@@ -69,7 +74,7 @@
JSynchronizeTab ui = (JSynchronizeTab) getUI();
tree = ui.getContentTreeRemote();
}
- if (tree==null) {
+ if (tree == null) {
// arbre non trouvé (cela devrait souleve une exception !)
return false;
}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java (from rev 1122, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -0,0 +1,157 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.service.StorageService;
+import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
+import fr.cemagref.simexplorer.is.ui.swing.JListTab;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
+import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.SimExplorerTabModel;
+import jaxx.runtime.builder.TabModel;
+
+import java.awt.event.ActionEvent;
+
+import static org.codelutin.i18n.I18n.n_;
+
+/**
+ * Action pour exporter une application
+ *
+ * @author chemit
+ */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "exportElement",
+ name = "simexplorer.action.exportElement",
+ //shortDescription = "simexplorer.action.exportElement.tooltip",
+ longDescription = "simexplorer.action.exportElement.help",
+ smallIcon = "action/export-element.png",
+ mnemonic = 'x',
+ hideActionText = true
+)
+public class ExportElementAction extends SimExplorerAbstractTabAction {
+
+ private static final long serialVersionUID = 7535647131305304738L;
+
+ protected DataEntityModel selected;
+
+ protected StorageService fromService, toService;
+
+ public ExportElementAction(String name) {
+ super(name);
+ }
+
+ @Override
+ public String getI18nToolTipText() {
+
+ return getI18nToolTipText(selected != null && selected.isRemote());
+ }
+
+ public String getI18nToolTipText(Boolean remote) {
+ String result;
+ if (remote != null && remote) {
+ result = n_("simexplorer.action.exportElementToLocal.tooltip");
+ } else {
+ result = n_("simexplorer.action.exportElementToRemote.tooltip");
+ }
+ return result;
+ }
+
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ if (!super.beforeAction(e)) {
+ return false;
+ }
+
+ // on retrouve l'onglet concerné à partir de son model
+ TabModel tabModel = getModel();
+
+ if (tabModel instanceof DetailTabModel) {
+ DetailTabModel model = (DetailTabModel) tabModel;
+ selected = model.getSelectedItem();
+ } else if (tabModel instanceof ListTabModel) {
+ ListTabModel model = (ListTabModel) getModel();
+ selected = model.getSelectedItem();
+ } else if (tabModel instanceof SimExplorerTabModel) {
+ // on doit traiter ça dans les classes étendues
+ // car cela ne depend pas uniquement du model mais aussi de l'action
+ // choisie
+ return true;
+ }
+ boolean result;
+ result = selected != null && selected.getUuid() != null;
+ if (result) {
+ // on garde toujours une copie, pas l'original
+ selected = selected.clone();
+ }
+ //TODO normalement pas besoin de tester l'accessibilite ici
+ //result = selected != null && selected.getUuid() != null && EntityHelper.Action.EXPORT.accept(selected.getMeta());
+ return result;
+ }
+
+ @Override
+ protected void doAction(ActionEvent e) throws Exception {
+ boolean remote = selected.isRemote();
+ StorageService fromService = StorageServiceHelper.getService(getContext(), remote);
+ StorageService toService = StorageServiceHelper.getService(getContext(), !remote);
+ log.info("fromService : " + fromService);
+ log.info("toService : " + toService);
+ log.info("selected : " + selected);
+ fr.cemagref.simexplorer.is.service.StorageServiceHelper.exportElementTo(getContext().getToken(), fromService, toService, selected.getUuid(), selected.getVersion().toString());
+ }
+
+ @Override
+ public void updateUI() {
+ // on doit invalider les données apres un export
+ ListTabModel model;
+ JListTab ui;
+ SimExplorerTab tab;
+ if (selected.isRemote()) {
+ // reinit de la liste locale
+ tab = SimExplorerTab.local;
+ model = (ListTabModel) tab.getModel();
+ ui = (JListTab) tab.getUI();
+ } else {
+ // reninit de la liste remote
+ tab = SimExplorerTab.remote;
+ model = (ListTabModel) tab.getModel();
+ ui = (JListTab) tab.getUI();
+ }
+ // pour reforcer le calcul de la liste
+ model.setPagination(null);
+ model.updateTabModel(getContext(), (ListTableModel) ui.getTable().getModel());
+ tab.updateUI();
+
+ // reinit de l'onglet synchronize
+ SimExplorerActionManager.fireAction("showTab_synchronize",e.getSource());
+ }
+
+ @Override
+ protected void clear() {
+ selected = null;
+ fromService = toService = null;
+ // l'action est multi-tab, et est stateless!
+ // on doit recalculer le tab a chaque visite
+ setTab(null);
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToLocalAction.java (from rev 1115, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToLocalAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToLocalAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -0,0 +1,63 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Action pour exporter une application
+ *
+ * @author chemit
+ */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "exportElementToLocal",
+ name = "simexplorer.action.exportElementToLocal",
+ longDescription = "simexplorer.action.exportElementToLocal.help",
+ smallIcon = "action/export-to-local.png",
+ mnemonic = 'x',
+ hideActionText = true
+)
+public class ExportElementToLocalAction extends ExportElementAction {
+
+ private static final long serialVersionUID = 7535647131305304738L;
+
+ public ExportElementToLocalAction(String name) {
+ super(name);
+ }
+
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ if (!super.beforeAction(e)) {
+ return false;
+ }
+ SynchronizeTabModel model = (SynchronizeTabModel) getModel();
+ LoggableElement element = model.getSelectedNode(true);
+ boolean result;
+ if (result = EntityHelper.Action.EXPORT.accept(element)) {
+ selected = new DataEntityModel();
+ selected.synch(true,element);
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToRemoteAction.java (from rev 1115, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToRemoteAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportElementToRemoteAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -0,0 +1,63 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.entities.EntityHelper;
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.ui.swing.model.SynchronizeTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Action pour exporter une application
+ *
+ * @author chemit
+ */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "exportElementToRemote",
+ name = "simexplorer.action.exportElementToRemote",
+ longDescription = "simexplorer.action.exportElementToRemote.help",
+ smallIcon = "action/export-to-remote.png",
+ mnemonic = 'x',
+ hideActionText = true
+)
+public class ExportElementToRemoteAction extends ExportElementAction {
+
+ private static final long serialVersionUID = 7535647131305304738L;
+
+ public ExportElementToRemoteAction(String name) {
+ super(name);
+ }
+
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ if (!super.beforeAction(e)) {
+ return false;
+ }
+ SynchronizeTabModel model = (SynchronizeTabModel) getModel();
+ LoggableElement element = model.getSelectedNode(false);
+ boolean result;
+ if (result = EntityHelper.Action.EXPORT.accept(element)) {
+ selected = new DataEntityModel();
+ selected.synch(false,element);
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportElementAction.java (from rev 1113, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportElementAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ImportElementAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -0,0 +1,123 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.ui.StorageServiceHelper;
+import fr.cemagref.simexplorer.is.ui.swing.ImportDialog;
+import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
+import static org.codelutin.i18n.I18n._;
+import static org.codelutin.i18n.I18n.n_;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Action de base pour importer une application
+ *
+ * @author tony
+ */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "importElement",
+ name = "simexplorer.action.importElement",
+ longDescription = "simexplorer.action.importElement.help",
+ smallIcon = "action/import-element.png",
+ mnemonic = 'I',
+ hideActionText = false
+)
+public class ImportElementAction extends SimExplorerAbstractTabAction {
+
+ protected ImportDialog ui;
+
+ protected File f;
+ protected Boolean remote;
+ private static final long serialVersionUID = 3377670691203328711L;
+ private Map<String, String[]> filters;
+
+ public ImportElementAction(String name) {
+ super(name);
+ filters = new TreeMap<String, String[]>();
+ filters.put("ApplicationExploration", new String[]{".*.zip$", _("simexplorer.choose.applicationexploration")});
+ filters.put("Library", new String[]{".*.zip$", _("simexplorer.choose.library")});
+ }
+
+ public void disposeUI() {
+ ui = null;
+ }
+
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ if (!super.beforeAction(e)) {
+ return false;
+ }
+ ListTabModel model = (ListTabModel) getModel();
+ remote = model.isRemote();
+ f = getUi().getFile();
+
+ return f != null;
+ }
+
+ @Override
+ protected void doAction(ActionEvent e) throws Exception {
+ StorageServiceHelper.importElement(getContext(), remote, f);
+ }
+
+ @Override
+ public void updateUI() {
+ super.updateUI();
+ //TODO should invalidate the 'remote' list
+ //TODO look if detail history is touch by this modification
+ //TODO look if synchronize is touched by this modification
+ }
+
+ @Override
+ protected void clear() {
+ f = null;
+ remote = null;
+ // this is a multi-tab action, must reset tab after each action
+ setTab(null);
+ }
+
+ @Override
+ public String getI18nToolTipText() {
+ return getI18nToolTipText(remote);
+ }
+
+ public String getI18nToolTipText(Boolean remote) {
+ String result;
+ if (remote != null && remote) {
+ result = n_("simexplorer.action.importElementToRemote.tooltip");
+ } else {
+ result = n_("simexplorer.action.importElementToLocal.tooltip");
+ }
+ return result;
+ }
+
+ protected ImportDialog getUi() {
+ if (ui == null) {
+ ui = new ImportDialog(getMainUI(), filters);
+ }
+ ui.setTitle(_(getI18nToolTipText()));
+ ui.getTypeImport().setSelected(ui.getSelected().getModel(), true);
+ ui.getTypeImport().updateSelectedValue();
+ return ui;
+ }
+}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowDetailTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -54,9 +54,9 @@
*/
@jaxx.runtime.builder.ActionConfig(
actionCommand = "showTab_detail",
- name = "simexplorer.action.show.detail",
- shortDescription = "simexplorer.action.show.detail.tooltip",
- longDescription = "simexplorer.action.show.detail.help",
+ name = "simexplorer.action.showTab_detail",
+ shortDescription = "simexplorer.action.showTab_detail.tooltip",
+ longDescription = "simexplorer.action.showTab_detail.help",
smallIcon = "action/show-tab-detail.png",
mnemonic = 'd',
hideActionText = false
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowLocalTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowLocalTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowLocalTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -26,10 +26,10 @@
* @author chemit
*/
@jaxx.runtime.builder.ActionConfig(
- actionCommand = "showtag_local",
- name = "simexplorer.action.show.local",
- shortDescription = "simexplorer.action.show.local.tooltip",
- longDescription = "simexplorer.action.show.local.help",
+ actionCommand = "showTab_local",
+ name = "simexplorer.action.showTab_local",
+ shortDescription = "simexplorer.action.showTab_local.tooltip",
+ longDescription = "simexplorer.action.showTab_local.help",
smallIcon = "action/local.png",
mnemonic = 'L',
hideActionText = false
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowRemoteTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowRemoteTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowRemoteTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -26,10 +26,10 @@
* @author chemit
*/
@jaxx.runtime.builder.ActionConfig(
- actionCommand = "showtag_remote",
- name = "simexplorer.action.show.remote",
- shortDescription = "simexplorer.action.show.remote.tooltip",
- longDescription = "simexplorer.action.show.remote.help",
+ actionCommand = "showTab_remote",
+ name = "simexplorer.action.showTab_remote",
+ shortDescription = "simexplorer.action.showTab_remote.tooltip",
+ longDescription = "simexplorer.action.showTab_remote.help",
smallIcon = "action/remote.png",
mnemonic = 'i',
hideActionText = false
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowSynchronizeTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowSynchronizeTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ShowSynchronizeTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -43,9 +43,9 @@
*/
@jaxx.runtime.builder.ActionConfig(
actionCommand = "showTab_synchronize",
- name = "simexplorer.action.show.synchronize",
- shortDescription = "simexplorer.action.show.synchronize.tooltip",
- longDescription = "simexplorer.action.show.synchronize.help",
+ name = "simexplorer.action.showTab_synchronize",
+ shortDescription = "simexplorer.action.showTab_synchronize.tooltip",
+ longDescription = "simexplorer.action.showTab_synchronize.help",
smallIcon = "action/reload.png",
mnemonic = 'S',
hideActionText = true
@@ -177,7 +177,7 @@
*/
public void propertyChange(PropertyChangeEvent evt) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- SynchronizeTabRefreshHelper.refreshExportElementToRemoteAction(getTabUI(), getTabModel());
+ SynchronizeTabRefreshHelper.refreshExportElement(getTabUI(), getTabModel(),false);
}
}
@@ -222,7 +222,7 @@
*/
public void propertyChange(PropertyChangeEvent evt) {
log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- SynchronizeTabRefreshHelper.refreshExportElementToLocalAction(getTabUI(), getTabModel());
+ SynchronizeTabRefreshHelper.refreshExportElement(getTabUI(), getTabModel(),true);
}
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleLocalTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleLocalTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleLocalTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -23,14 +23,14 @@
/** @author chemit */
@jaxx.runtime.builder.ToggleActionConfig(
actionCommand = "toggleTab_local",
- name = "simexplorer.action.show.local",
- shortDescription = "simexplorer.action.show.local.tooltip",
- longDescription = "simexplorer.action.show.local.help",
+ name = "simexplorer.action.showTab_local",
+ shortDescription = "simexplorer.action.showTab_local.tooltip",
+ longDescription = "simexplorer.action.showTab_local.help",
smallIcon = "action/local.png",
mnemonic = 'L',
- name2 = "simexplorer.action.hide.local",
- shortDescription2 = "simexplorer.action.hide.local.tooltip",
- longDescription2 = "simexplorer.action.hide.local.help",
+ name2 = "simexplorer.action.hideTab_local",
+ shortDescription2 = "simexplorer.action.hideTab_local.tooltip",
+ longDescription2 = "simexplorer.action.hideTab_local.help",
//smallIcon = "action/hide-local.png",
mnemonic2 = 'L',
selected = true,
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleRemoteTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleRemoteTabAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ToggleRemoteTabAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -23,14 +23,14 @@
/** @author chemit */
@jaxx.runtime.builder.ToggleActionConfig(
actionCommand = "toggleTab_remote",
- name = "simexplorer.action.show.remote",
- shortDescription = "simexplorer.action.show.remote.tooltip",
- longDescription = "simexplorer.action.show.remote.help",
+ name = "simexplorer.action.showTab_remote",
+ shortDescription = "simexplorer.action.showTab_remote.tooltip",
+ longDescription = "simexplorer.action.showTab_remote.help",
smallIcon = "action/remote.png",
mnemonic = 'S',
- name2 = "simexplorer.action.hide.remote",
- shortDescription2 = "simexplorer.action.hide.remote.tooltip",
- longDescription2 = "simexplorer.action.hide.remote.help",
+ name2 = "simexplorer.action.hideTab_remote",
+ shortDescription2 = "simexplorer.action.hideTab_remote.tooltip",
+ longDescription2 = "simexplorer.action.hideTab_remote.help",
//smallIcon = "action/hide-remote.png",
mnemonic2 = 'S',
selected = true,
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/ShowListTabAbstractAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -23,11 +23,11 @@
import fr.cemagref.simexplorer.is.ui.swing.JListTab;
import fr.cemagref.simexplorer.is.ui.swing.ListTabRefreshHelper;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
+import fr.cemagref.simexplorer.is.ui.swing.actions.ImportElementAction;
import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTabModel;
import fr.cemagref.simexplorer.is.ui.swing.model.ListTableModel;
import jaxx.runtime.swing.JAXXTab;
-import static org.codelutin.i18n.I18n._;
import javax.swing.AbstractButton;
import javax.swing.JTabbedPane;
@@ -41,6 +41,8 @@
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import static org.codelutin.i18n.I18n._;
+
/** @author chemit */
public class ShowListTabAbstractAction extends ShowTabAbstractAction<JListTab, ListTabModel> {
private static final long serialVersionUID = 3813479850648257169L;
@@ -84,7 +86,8 @@
//FIXME : when we change locale, this is no more enabled ?
ui.getImportElement().setEnabled(true);
ui.getImportElement().getAction().setEnabled(true);
- ui.getImportElement().setToolTipText(model.isRemote() ? _("simexplorer.action.import.remote.tooltip") : _("simexplorer.action.import.local.tooltip"));
+ ImportElementAction action = (ImportElementAction) ui.getImportElement().getAction();
+ ui.getImportElement().setToolTipText(_(action.getI18nToolTipText(model.isRemote())));
listMetaSelectionListener = new ListMetaSelectionListener(ui, model);
ui.getTable().getSelectionModel().addListSelectionListener(listMetaSelectionListener);
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/SimExplorerAbstractAction.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -35,10 +35,10 @@
*/
public abstract class SimExplorerAbstractAction extends javax.swing.AbstractAction {
+ protected static Log log = LogFactory.getLog(SimExplorerAbstractAction.class);
+
private static final long serialVersionUID = -810023044364620841L;
- static protected Log log = LogFactory.getLog(SimExplorerAbstractAction.class);
-
protected ActionEvent e;
public void actionPerformed(java.awt.event.ActionEvent e) {
@@ -46,14 +46,14 @@
log.debug("------------------------------------------------------------");
log.debug("event : " + e);
log.debug("source : " + e.getSource());
- this.e=e;
+ this.e = e;
try {
boolean accepted = beforeAction(e);
log.debug("action : " + this);
if (accepted) {
- log.info(getActionName()+" (treate:" + accepted + ") : " + this);
+ log.info(getActionName() + " (treate:" + accepted + ") : " + this);
} else {
- log.debug(getActionName()+" (treate:" + accepted + ") : " + this);
+ log.debug(getActionName() + " (treate:" + accepted + ") : " + this);
}
if (accepted) {
setStatus(toString());
@@ -63,7 +63,7 @@
} catch (Exception e1) {
SimExplorer.showError(e1);
} finally {
- this.e=null;
+ this.e = null;
// always clear action after use : actions are staless
clear();
}
@@ -109,7 +109,7 @@
public void disposeUI() {
// nothing by default
}
-
+
protected void clear() {
// nothing by default
}
@@ -120,4 +120,8 @@
}
return (JComponent) container.getObjectById(name);
}
+
+ public String getI18nToolTipText() {
+ return "simexplorer.action." + getActionName() + ".tooltip";
+ }
}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/SynchronizeTabModel.java 2008-02-19 20:50:06 UTC (rev 1129)
@@ -61,8 +61,20 @@
return remoteSelectedNode;
}
+ public LoggableElement getSelectedNode(boolean remote) {
+ return remote ? getRemoteSelectedNode() : getLocalSelectedNode();
+ }
+
+ public LoggableElement getRootNode(boolean remote) {
+ if (remote) {
+ return isRemote() ? getLocalSelectedNode() : getRemoteSelectedNode();
+ } else {
+ return isRemote() ? getRemoteSelectedNode() : getLocalSelectedNode();
+ }
+ }
+
public void setSource(LoggableElement source) {
- this.source = source;
+ this.source = source;
}
public void setDestination(LoggableElement destination) {
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-en_GB.properties 2008-02-19 20:50:06 UTC (rev 1129)
@@ -21,9 +21,9 @@
simexplorer.action.connect.help=
simexplorer.action.connect.tooltip=Connect to remote server
simexplorer.action.currentPage=page
-simexplorer.action.deleteLoggableElement=Delete element
-simexplorer.action.deleteLoggableElement.help=
-simexplorer.action.deleteLoggableElement.tooltip=Delete element ''{0}''
+simexplorer.action.deleteElement=Delete element
+simexplorer.action.deleteElement.help=
+simexplorer.action.deleteElement.tooltip=Delete element ''{0}''
simexplorer.action.detailToTree=Synchronize detail to tree
simexplorer.action.detailToTree.help=
simexplorer.action.detailToTree.tooltip=Synchronize element ''{0}'' as navigation root node
@@ -32,21 +32,21 @@
simexplorer.action.downloadAttachment=Download Attachment
simexplorer.action.downloadAttachment.help=
simexplorer.action.downloadAttachment.tooltip=Download attachment ''{0}''
-simexplorer.action.downloadLoggableElement=Download element
-simexplorer.action.downloadLoggableElement.help=
-simexplorer.action.downloadLoggableElement.tooltip=Download element ''{0}''
+simexplorer.action.downloadElement=Download element
+simexplorer.action.downloadElement.help=
+simexplorer.action.downloadElement.tooltip=Download element ''{0}''
simexplorer.action.expandAll=expandAll
simexplorer.action.expandAll.help=Expand all nodes
simexplorer.action.expandAll.tooltip=Expand all nodes of ''{0}''
-simexplorer.action.export=export
-simexplorer.action.export.help=
-simexplorer.action.export.tooltip=Export element ''{0}''
-simexplorer.action.exportToLocal=export to local
-simexplorer.action.exportToLocal.help=
-simexplorer.action.exportToLocal.tooltip=Export element ''{0}'' to locale database
-simexplorer.action.exportToRemote=export to remote
-simexplorer.action.exportToRemote.help=
-simexplorer.action.exportToRemote.tooltip=Export element ''{0}'' to remote database
+simexplorer.action.exportElement=export
+simexplorer.action.exportElement.help=
+simexplorer.action.exportElement.tooltip=Export element ''{0}''
+simexplorer.action.exportElementToLocal=export to local
+simexplorer.action.exportElementToLocal.help=
+simexplorer.action.exportElementToLocal.tooltip=Export element ''{0}'' to locale database
+simexplorer.action.exportElementToRemote=export to remote
+simexplorer.action.exportElementToRemote.help=
+simexplorer.action.exportElementToRemote.tooltip=Export element ''{0}'' to remote database
simexplorer.action.goFirstPage=First page
simexplorer.action.goFirstPage.help=
simexplorer.action.goFirstPage.tooltip=Access to first page in the list of results
@@ -65,12 +65,12 @@
simexplorer.action.help=Help
simexplorer.action.help.help=
simexplorer.action.help.tooltip=Show help dialog
-simexplorer.action.hide.local=List (local)
-simexplorer.action.hide.local.help=
-simexplorer.action.hide.local.tooltip=hide the list of local elements
-simexplorer.action.hide.remote=List (remote)
-simexplorer.action.hide.remote.help=
-simexplorer.action.hide.remote.tooltip=Hide the list of remote elements
+simexplorer.action.hideTab_local=List (local)
+simexplorer.action.hideTab_local.help=
+simexplorer.action.hideTab_local.tooltip=hide the list of local elements
+simexplorer.action.hideTab_remote=List (remote)
+simexplorer.action.hideTab_remote.help=
+simexplorer.action.hideTab_remote.tooltip=Hide the list of remote elements
simexplorer.action.historyNext=Next in history
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Display next element ''{0}''
@@ -83,10 +83,10 @@
simexplorer.action.i18n.fr=French
simexplorer.action.i18n.fr.help=
simexplorer.action.i18n.fr.tooltip=Change to french language
-simexplorer.action.import=import
-simexplorer.action.import.help=
-simexplorer.action.import.local.tooltip=Import into local database
-simexplorer.action.import.remote.tooltip=Import into remote database
+simexplorer.action.importElement=import
+simexplorer.action.importElement.help=
+simexplorer.action.importElementToLocal.tooltip=Import into local database
+simexplorer.action.importElementToRemote.tooltip=Import into remote database
simexplorer.action.quit=Quit
simexplorer.action.quit.help=
simexplorer.action.quit.tooltip=Quit SimExplorer SI
@@ -100,18 +100,18 @@
simexplorer.action.search.help=
simexplorer.action.search.tooltip=Launch search
simexplorer.action.searchText.tooltip=Text to search in applications
-simexplorer.action.show.detail=Show details
-simexplorer.action.show.detail.help=
-simexplorer.action.show.detail.tooltip=show Detail of element ''{0}''
-simexplorer.action.show.local=List (local)
-simexplorer.action.show.local.help=
-simexplorer.action.show.local.tooltip=Show the list of local elements
-simexplorer.action.show.remote=List (remote)
-simexplorer.action.show.remote.help=
-simexplorer.action.show.remote.tooltip=Show the list of remote elements (need connexion)
-simexplorer.action.show.synchronize=Synchronize
-simexplorer.action.show.synchronize.help=
-simexplorer.action.show.synchronize.tooltip=Show synchronize screen (need connexion)
+simexplorer.action.showTab_detail=Show details
+simexplorer.action.showTab_detail.help=
+simexplorer.action.showTab_detail.tooltip=show Detail of element ''{0}''
+simexplorer.action.showTab_local=List (local)
+simexplorer.action.showTab_local.help=
+simexplorer.action.showTab_local.tooltip=Show the list of local elements
+simexplorer.action.showTab_remote=List (remote)
+simexplorer.action.showTab_remote.help=
+simexplorer.action.showTab_remote.tooltip=Show the list of remote elements (need connexion)
+simexplorer.action.showTab_synchronize=Synchronize
+simexplorer.action.showTab_synchronize.help=
+simexplorer.action.showTab_synchronize.tooltip=Show synchronize screen for element ''{0}''
simexplorer.action.site=Site
simexplorer.action.site.help=
simexplorer.action.site.tooltip=Go to SimExplorer SI site
@@ -158,7 +158,7 @@
simexplorer.config.main.userMail.description=User email adress
simexplorer.config.main.version.description=Version of application
simexplorer.config.menu=Configuration
-simexplorer.confirm.delete=
+simexplorer.confirm.delete=Confirm delete of ''{0}''
simexplorer.entities.applicationExploration=Exploration Application
simexplorer.entities.library=Library
simexplorer.error.dialog.message=An error was found
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/i18n/simexplorer-is-swing-fr_FR.properties 2008-02-19 20:50:06 UTC (rev 1129)
@@ -21,9 +21,9 @@
simexplorer.action.connect.help=
simexplorer.action.connect.tooltip=Se connecter au serveur distant
simexplorer.action.currentPage=page
-simexplorer.action.deleteLoggableElement=Supprimer
-simexplorer.action.deleteLoggableElement.help=
-simexplorer.action.deleteLoggableElement.tooltip=Supprimer l''\u00E9l\u00E9ment ''{0}''
+simexplorer.action.deleteElement=Supprimer
+simexplorer.action.deleteElement.help=
+simexplorer.action.deleteElement.tooltip=Supprimer l''\u00E9l\u00E9ment ''{0}''
simexplorer.action.detailToTree=Afficher dans l'arbre
simexplorer.action.detailToTree.help=
simexplorer.action.detailToTree.tooltip=Positionne l''\u00E9l\u00E9ment ''{0}'' comme racine de l''arbre de navigation
@@ -32,21 +32,21 @@
simexplorer.action.downloadAttachment=T\u00E9l\u00E9charger le fichier attach\u00E9
simexplorer.action.downloadAttachment.help=
simexplorer.action.downloadAttachment.tooltip=T\u00E9l\u00E9charger le fichier attach\u00E9 ''{0}''
-simexplorer.action.downloadLoggableElement=T\u00E9l\u00E9charger le zip
-simexplorer.action.downloadLoggableElement.help=
-simexplorer.action.downloadLoggableElement.tooltip=T\u00E9l\u00E9charger le zip de l''\u00E9l\u00E9ment ''{0}''
+simexplorer.action.downloadElement=T\u00E9l\u00E9charger le zip
+simexplorer.action.downloadElement.help=
+simexplorer.action.downloadElement.tooltip=T\u00E9l\u00E9charger le zip de l''\u00E9l\u00E9ment ''{0}''
simexplorer.action.expandAll=tout d\u00E9rouler
simexplorer.action.expandAll.help=
simexplorer.action.expandAll.tooltip=\u00E9taler tous les noeuds de ''{0}''
-simexplorer.action.export=Exporter
-simexplorer.action.export.help=
-simexplorer.action.export.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}''
-simexplorer.action.exportToLocal=Exporter localement
-simexplorer.action.exportToLocal.help=
-simexplorer.action.exportToLocal.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}'' vers la base locale
-simexplorer.action.exportToRemote=Exporter \u00E0 distante
-simexplorer.action.exportToRemote.help=
-simexplorer.action.exportToRemote.tooltip=Export l''\u00E9l\u00E9ment ''{0}'' vers la base distante
+simexplorer.action.exportElement=Exporter
+simexplorer.action.exportElement.help=
+#simexplorer.action.exportElement.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}''
+simexplorer.action.exportElementToLocal=Exporter vers le serveur local
+simexplorer.action.exportElementToLocal.help=
+simexplorer.action.exportElementToLocal.tooltip=Exporter l''\u00E9l\u00E9ment ''{0}'' vers la base locale
+simexplorer.action.exportElementToRemote=Exporter vers le serveur distant
+simexplorer.action.exportElementToRemote.help=
+simexplorer.action.exportElementToRemote.tooltip=Export l''\u00E9l\u00E9ment ''{0}'' vers la base distante
simexplorer.action.goFirstPage=Premi\u00E8re page
simexplorer.action.goFirstPage.help=
simexplorer.action.goFirstPage.tooltip=Acc\u00E9der \u00E0 la premi\u00E8re page de la liste des r\u00E9sultats
@@ -65,12 +65,12 @@
simexplorer.action.help=Aide
simexplorer.action.help.help=
simexplorer.action.help.tooltip=Acc\u00E9der \u00E0 l'aide
-simexplorer.action.hide.local=Liste locale
-simexplorer.action.hide.local.help=
-simexplorer.action.hide.local.tooltip=Cacher la liste des \u00E9lements du serveur local
-simexplorer.action.hide.remote=Liste distante
-simexplorer.action.hide.remote.help=
-simexplorer.action.hide.remote.tooltip=Cacher la liste des \u00E9l\u00E9ments du serveur distant
+simexplorer.action.hideTab_local=Liste locale
+simexplorer.action.hideTab_local.help=
+simexplorer.action.hideTab_local.tooltip=Cacher la liste des \u00E9lements du serveur local
+simexplorer.action.hideTab_remote=Liste distante
+simexplorer.action.hideTab_remote.help=
+simexplorer.action.hideTab_remote.tooltip=Cacher la liste des \u00E9l\u00E9ments du serveur distant
simexplorer.action.historyNext=El\u00E9ment suivant
simexplorer.action.historyNext.help=
simexplorer.action.historyNext.tooltip=Afficher l''\u00E9l\u00E9ment suivant ''{0}''
@@ -83,10 +83,10 @@
simexplorer.action.i18n.fr=Fran\u00E7ais
simexplorer.action.i18n.fr.help=
simexplorer.action.i18n.fr.tooltip=Traduire l'application en fran\u00E7ais
-simexplorer.action.import=importer
-simexplorer.action.import.help=
-simexplorer.action.import.local.tooltip=Importer dans la base locale
-simexplorer.action.import.remote.tooltip=Importer dans la base distante
+simexplorer.action.importElement=importer
+simexplorer.action.importElement.help=
+simexplorer.action.importElementToLocal.tooltip=Importer dans la base locale
+simexplorer.action.importElementToRemote.tooltip=Importer dans la base distante
simexplorer.action.quit=Quitter
simexplorer.action.quit.help=
simexplorer.action.quit.tooltip=Pour quitter l'application
@@ -100,21 +100,21 @@
simexplorer.action.search.help=
simexplorer.action.search.tooltip=Lancer la recherche
simexplorer.action.searchText.tooltip=Le texte de recherche
-simexplorer.action.show.detail=Voir les d\u00E9tails
-simexplorer.action.show.detail.help=
-simexplorer.action.show.detail.tooltip=Afficher les d\u00E9tails de l''\u00E9l\u00E9ment ''{0}''
-simexplorer.action.show.local=Liste locale
-simexplorer.action.show.local.help=
-simexplorer.action.show.local.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur local
-simexplorer.action.show.remote=Liste distante
-simexplorer.action.show.remote.help=
-simexplorer.action.show.remote.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur distant
-simexplorer.action.show.synchronize=Synchroniser
-simexplorer.action.show.synchronize.help=
-simexplorer.action.show.synchronize.tooltip=Afficher l'\u00E9cran de synchronisation des applications
+simexplorer.action.showTab_detail=Voir les d\u00E9tails
+simexplorer.action.showTab_detail.help=
+simexplorer.action.showTab_detail.tooltip=Afficher les d\u00E9tails de l''\u00E9l\u00E9ment ''{0}''
+simexplorer.action.showTab_local=Liste locale
+simexplorer.action.showTab_local.help=
+simexplorer.action.showTab_local.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur local
+simexplorer.action.showTab_remote=Liste distante
+simexplorer.action.showTab_remote.help=
+simexplorer.action.showTab_remote.tooltip=Afficher la liste des \u00E9l\u00E9ments du serveur distant
+simexplorer.action.showTab_synchronize=Synchroniser
+simexplorer.action.showTab_synchronize.help=
+simexplorer.action.showTab_synchronize.tooltip=Afficher l''\u00E9cran de synchronisation de l''élément ''{0}''
simexplorer.action.site=Site
simexplorer.action.site.help=
-simexplorer.action.site.tooltip=Acc\u00E9der \u00E0 l'aide
+simexplorer.action.site.tooltip=Acc\u00E9der dans votre navigateur au site de SimExplorer-SI
simexplorer.action.synchronize.tooltip=Lancer la synchronisation de ''{0}''
simexplorer.action.unconnect=D\u00E9connexion
simexplorer.action.unconnect.help=
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties 2008-02-19 20:50:06 UTC (rev 1129)
@@ -70,10 +70,10 @@
action.historyPrevious=fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryPreviousAction
# import- export actions
-action.exportElement=fr.cemagref.simexplorer.is.ui.swing.actions.ExportAction
-action.exportElementToLocal=fr.cemagref.simexplorer.is.ui.swing.actions.ExportToLocalAction
-action.exportElementToRemote=fr.cemagref.simexplorer.is.ui.swing.actions.ExportToRemoteAction
-action.importElement=fr.cemagref.simexplorer.is.ui.swing.actions.ImportAction
+action.exportElement=fr.cemagref.simexplorer.is.ui.swing.actions.ExportElementAction
+action.exportElementToLocal=fr.cemagref.simexplorer.is.ui.swing.actions.ExportElementToLocalAction
+action.exportElementToRemote=fr.cemagref.simexplorer.is.ui.swing.actions.ExportElementToRemoteAction
+action.importElement=fr.cemagref.simexplorer.is.ui.swing.actions.ImportElementAction
# help actions
action.site=fr.cemagref.simexplorer.is.ui.swing.actions.SiteAction
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx 2008-02-19 18:37:50 UTC (rev 1128)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ImportDialog.jaxx 2008-02-19 20:50:06 UTC (rev 1129)
@@ -73,7 +73,7 @@
<row fill='horizontal'>
<cell columns='2'>
<JPanel layout='{new GridLayout(1, 0, 2, 2)}'>
- <JButton id='ok' text='simexplorer.action.import' enabled='false' onActionPerformed='dispose();'/>
+ <JButton id='ok' text='simexplorer.action.importElement' enabled='false' onActionPerformed='dispose();'/>
<JButton id='cancel' text='simexplorer.common.cancel' action='{cancelAction}'/>
</JPanel>
</cell>
1
0
r1128 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui/swing/actions java/fr/cemagref/simexplorer/is/ui/swing/actions/history java/fr/cemagref/simexplorer/is/ui/swing/actions/util resources/jaxx
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 18:37:50 +0000 (Tue, 19 Feb 2008)
New Revision: 1128
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryAbstractAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryDeleteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryNextAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryPreviousAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryUnconnectAction.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryDeleteAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryNextAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryPreviousAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryUnconnectAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/HistoryAbstractAction.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties
Log:
creation paquetagepour les actions d'historique
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryDeleteAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryDeleteAction.java 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryDeleteAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -1,109 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.HistoryAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-
-import java.util.Iterator;
-import java.util.List;
-
-/** @author chemit */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "historyDelete",
- name = "simexplorer.action.historyDelete",
- shortDescription = "simexplorer.action.historyDelete.tooltip",
- longDescription = "simexplorer.action.historyDelete.help",
- //smallIcon = "action/history-next.png",
- //mnemonic = 'N',
- hideActionText = true
-)
-public class HistoryDeleteAction extends HistoryAbstractAction {
-
- private static final long serialVersionUID = 2165684159831076054L;
-
- protected DataEntityModel selected;
-
- public HistoryDeleteAction(String name) {
- super(name);
- }
-
- protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
- if (model.isEmpty()) {
- return false;
- }
- if (selected == null) {
- // le modele est statique pour le moment
- //setTab(findTab(e));
- // on doit retrouver l'élément à traiter à partir de la source
- selected = findSelectedItem(e);
- }
- return selected != null && selected.getUuid() != null;
- }
-
- protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
- int pos = 0;
- int currentPos = model.getCurrentIndex();
- List<EntityTreeNode> datas = model.getData();
- boolean remote = selected.isRemote();
- String uuid = selected.getUuid();
- boolean wasRemove = false;
- if (log.isDebugEnabled()) {
- log.debug("----- search entry to remove :" + selected + ", " + selected.isRemote());
- }
- for (Iterator<EntityTreeNode> it = datas.iterator(); it.hasNext();) {
- EntityTreeNode node = it.next();
- boolean remote2 = node.isRemote();
- LoggableElement le = node.getLoggableElement();
- if (le != null && remote == remote2 && uuid.equals(le.getMetaData().getUuid())) {
- it.remove();
- if (log.isDebugEnabled()) {
- log.debug("----- found entry to remove :" + node + ", " + node.isRemote());
- }
- wasRemove = true;
- break;
- }
- pos++;
- }
- if (datas.isEmpty()) {
- // supprime la selection
- model.setCurrentIndex(null);
- return null;
- }
-
- if (wasRemove) {
- if (pos > 0 && currentPos >= pos) {
- // decrementsonly if currentPos was higher but not in 0 case.
- model.setCurrentIndex(currentPos - 1);
- }
- }
- EntityTreeNode node;
- node = model.getCurrent();
- return node;
- }
-
- @Override
- protected void clear() {
- super.clear();
- selected = null;
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryNextAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryNextAction.java 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryNextAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -1,52 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.HistoryAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-
-/** @author chemit */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "historyNext",
- name = "simexplorer.action.historyNext",
- shortDescription = "simexplorer.action.historyNext.tooltip",
- longDescription = "simexplorer.action.historyNext.help",
- smallIcon = "action/history-next.png",
- mnemonic = 'N',
- hideActionText = true
-)
-public class HistoryNextAction extends HistoryAbstractAction {
-
- private static final long serialVersionUID = 2165684159831076054L;
-
- public HistoryNextAction(String name) {
- super(name);
- }
-
- protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
- return model.hasNext();
- }
-
- protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
- EntityTreeNode node;
- node = model.gotoNext();
- return node;
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryPreviousAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryPreviousAction.java 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryPreviousAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -1,53 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.HistoryAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-
-/** @author chemit */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "historyPrevious",
- name = "simexplorer.action.historyPrevious",
- shortDescription = "simexplorer.action.historyPrevious.tooltip",
- longDescription = "simexplorer.action.historyPrevious.help",
- smallIcon = "action/history-previous.png",
- mnemonic = 'N',
- hideActionText = true
-)
-public class HistoryPreviousAction extends HistoryAbstractAction {
-
- private static final long serialVersionUID = 2165684159831076054L;
-
- public HistoryPreviousAction(String name) {
- super(name);
- }
-
- protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
- return model.hasPrevious();
- }
-
- protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
- EntityTreeNode node;
- node = model.gotoPrevious();
- return node;
- }
-
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryUnconnectAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryUnconnectAction.java 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryUnconnectAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -1,78 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.HistoryAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-
-import java.util.Iterator;
-import java.util.List;
-
-/** @author chemit */
- at jaxx.runtime.builder.ActionConfig(
- actionCommand = "historyUnconnect",
- name = "simexplorer.action.historyUnconnect",
- shortDescription = "simexplorer.action.historyUnconnect.tooltip",
- longDescription = "simexplorer.action.historyUnconnect.help",
- //smallIcon = "action/history-next.png",
- //mnemonic = 'N',
- hideActionText = true
-)
-public class HistoryUnconnectAction extends HistoryAbstractAction {
-
- private static final long serialVersionUID = 2165684159831076054L;
-
- public HistoryUnconnectAction(String name) {
- super(name);
- }
-
- protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
- return !model.isEmpty();
- }
-
- protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
- EntityTreeNode current = model.getCurrent();
- List<EntityTreeNode> datas = model.getData();
- for (Iterator<EntityTreeNode> it = datas.iterator(); it.hasNext();) {
- if (it.next().isRemote()) {
- it.remove();
- }
- }
- if (datas.isEmpty()) {
- // pas de position
- model.setCurrentIndex(null);
- return null;
- }
- Integer pos;
- if (!current.isRemote()) {
- // on doit repositionner sur l'élément local courant
- pos = datas.indexOf(current);
- } else {
- // on se met sur le dernier element
- pos = datas.size() - 1;
- }
- // on repositionne sur le dernier element de l'historique
- model.setCurrentIndex(pos);
- EntityTreeNode node;
- node = model.getCurrent();
- return node;
- }
-
-}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryAbstractAction.java (from rev 1123, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/HistoryAbstractAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryAbstractAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryAbstractAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -0,0 +1,106 @@
+/*
+* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions.history;
+
+import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
+import fr.cemagref.simexplorer.is.ui.swing.DetailTabRefreshHelper;
+import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
+import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Action de base pour les actions d'historique
+ *
+ * @author chemit
+ */
+public abstract class HistoryAbstractAction extends SimExplorerAbstractTabAction {
+
+ protected HistoryModel<EntityTreeNode> history;
+
+ private static final long serialVersionUID = -2880632145083173463L;
+
+ /**
+ * @param model le model d'historique non null
+ * @return <code>true</code> if il existe une entree adequate a l'action
+ * dans l'historique
+ */
+ protected abstract boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model);
+
+ /**
+ * @param model le model d'historique, non null
+ * @return le noeud à partir de l'historique
+ */
+ protected abstract EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model);
+
+ protected HistoryAbstractAction(String name) {
+ super(name);
+ }
+
+ @Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ if (!super.beforeAction(e)) {
+ return false;
+ }
+ // le modele est statique pour le moment
+ setTab(SimExplorerTab.detail);
+ DetailTabModel model = (DetailTabModel) getModel();
+ if (model == null) {
+ return false;
+ }
+ history = model.getHistory();
+ return history != null && hasHistoryEntry(history);
+ }
+
+ @Override
+ protected void doAction(ActionEvent e) throws Exception {
+ EntityTreeNode node = getHistoryEntry(history);
+ if (log.isDebugEnabled()) {
+ log.debug("current history entry " + node);
+ }
+ DetailTabModel model = (DetailTabModel) getModel();
+ if (node == null) {
+ model.synch(model.isRemote(), (MetaData) null);
+ } else {
+ model.synch(node);
+ }
+ }
+
+ @Override
+ public void updateUI() {
+ if (!history.isEmpty()) {
+ // select current history element
+ DetailTabRefreshHelper.updateDetailNavigationTree((JDetailTab) getUI(), history);
+ } else if (getTab().isTabVisible(getTabContainer())) {
+ // close tab, no more history
+ getTab().closeTab(getTabContainer());
+ }
+ }
+
+ @Override
+ protected void clear() {
+ super.clear();
+ history = null;
+ // should be a multi-tab
+ setTab(null);
+ }
+}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryDeleteAction.java (from rev 1120, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryDeleteAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryDeleteAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryDeleteAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -0,0 +1,109 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions.history;
+
+import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
+import fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.DataEntityModel;
+import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
+
+import java.util.Iterator;
+import java.util.List;
+
+/** @author chemit */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "historyDelete",
+ name = "simexplorer.action.historyDelete",
+ shortDescription = "simexplorer.action.historyDelete.tooltip",
+ longDescription = "simexplorer.action.historyDelete.help",
+ //smallIcon = "action/history-next.png",
+ //mnemonic = 'N',
+ hideActionText = true
+)
+public class HistoryDeleteAction extends HistoryAbstractAction {
+
+ private static final long serialVersionUID = 2165684159831076054L;
+
+ protected DataEntityModel selected;
+
+ public HistoryDeleteAction(String name) {
+ super(name);
+ }
+
+ protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ if (model.isEmpty()) {
+ return false;
+ }
+ if (selected == null) {
+ // le modele est statique pour le moment
+ //setTab(findTab(e));
+ // on doit retrouver l'élément à traiter à partir de la source
+ selected = findSelectedItem(e);
+ }
+ return selected != null && selected.getUuid() != null;
+ }
+
+ protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ int pos = 0;
+ int currentPos = model.getCurrentIndex();
+ List<EntityTreeNode> datas = model.getData();
+ boolean remote = selected.isRemote();
+ String uuid = selected.getUuid();
+ boolean wasRemove = false;
+ if (log.isDebugEnabled()) {
+ log.debug("----- search entry to remove :" + selected + ", " + selected.isRemote());
+ }
+ for (Iterator<EntityTreeNode> it = datas.iterator(); it.hasNext();) {
+ EntityTreeNode node = it.next();
+ boolean remote2 = node.isRemote();
+ LoggableElement le = node.getLoggableElement();
+ if (le != null && remote == remote2 && uuid.equals(le.getMetaData().getUuid())) {
+ it.remove();
+ if (log.isDebugEnabled()) {
+ log.debug("----- found entry to remove :" + node + ", " + node.isRemote());
+ }
+ wasRemove = true;
+ break;
+ }
+ pos++;
+ }
+ if (datas.isEmpty()) {
+ // supprime la selection
+ model.setCurrentIndex(null);
+ return null;
+ }
+
+ if (wasRemove) {
+ if (pos > 0 && currentPos >= pos) {
+ // decrementsonly if currentPos was higher but not in 0 case.
+ model.setCurrentIndex(currentPos - 1);
+ }
+ }
+ EntityTreeNode node;
+ node = model.getCurrent();
+ return node;
+ }
+
+ @Override
+ protected void clear() {
+ super.clear();
+ selected = null;
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryNextAction.java (from rev 1119, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryNextAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryNextAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryNextAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -0,0 +1,52 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions.history;
+
+import fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
+
+/** @author chemit */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "historyNext",
+ name = "simexplorer.action.historyNext",
+ shortDescription = "simexplorer.action.historyNext.tooltip",
+ longDescription = "simexplorer.action.historyNext.help",
+ smallIcon = "action/history-next.png",
+ mnemonic = 'N',
+ hideActionText = true
+)
+public class HistoryNextAction extends HistoryAbstractAction {
+
+ private static final long serialVersionUID = 2165684159831076054L;
+
+ public HistoryNextAction(String name) {
+ super(name);
+ }
+
+ protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ return model.hasNext();
+ }
+
+ protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ EntityTreeNode node;
+ node = model.gotoNext();
+ return node;
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryPreviousAction.java (from rev 1119, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryPreviousAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryPreviousAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryPreviousAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -0,0 +1,53 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions.history;
+
+import fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
+
+/** @author chemit */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "historyPrevious",
+ name = "simexplorer.action.historyPrevious",
+ shortDescription = "simexplorer.action.historyPrevious.tooltip",
+ longDescription = "simexplorer.action.historyPrevious.help",
+ smallIcon = "action/history-previous.png",
+ mnemonic = 'N',
+ hideActionText = true
+)
+public class HistoryPreviousAction extends HistoryAbstractAction {
+
+ private static final long serialVersionUID = 2165684159831076054L;
+
+ public HistoryPreviousAction(String name) {
+ super(name);
+ }
+
+ protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ return model.hasPrevious();
+ }
+
+ protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ EntityTreeNode node;
+ node = model.gotoPrevious();
+ return node;
+ }
+
+}
\ No newline at end of file
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryUnconnectAction.java (from rev 1119, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/HistoryUnconnectAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryUnconnectAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/history/HistoryUnconnectAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -0,0 +1,78 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions.history;
+
+import fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryAbstractAction;
+import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
+import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
+
+import java.util.Iterator;
+import java.util.List;
+
+/** @author chemit */
+ at jaxx.runtime.builder.ActionConfig(
+ actionCommand = "historyUnconnect",
+ name = "simexplorer.action.historyUnconnect",
+ shortDescription = "simexplorer.action.historyUnconnect.tooltip",
+ longDescription = "simexplorer.action.historyUnconnect.help",
+ //smallIcon = "action/history-next.png",
+ //mnemonic = 'N',
+ hideActionText = true
+)
+public class HistoryUnconnectAction extends HistoryAbstractAction {
+
+ private static final long serialVersionUID = 2165684159831076054L;
+
+ public HistoryUnconnectAction(String name) {
+ super(name);
+ }
+
+ protected boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ return !model.isEmpty();
+ }
+
+ protected EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model) {
+ EntityTreeNode current = model.getCurrent();
+ List<EntityTreeNode> datas = model.getData();
+ for (Iterator<EntityTreeNode> it = datas.iterator(); it.hasNext();) {
+ if (it.next().isRemote()) {
+ it.remove();
+ }
+ }
+ if (datas.isEmpty()) {
+ // pas de position
+ model.setCurrentIndex(null);
+ return null;
+ }
+ Integer pos;
+ if (!current.isRemote()) {
+ // on doit repositionner sur l'élément local courant
+ pos = datas.indexOf(current);
+ } else {
+ // on se met sur le dernier element
+ pos = datas.size() - 1;
+ }
+ // on repositionne sur le dernier element de l'historique
+ model.setCurrentIndex(pos);
+ EntityTreeNode node;
+ node = model.getCurrent();
+ return node;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/HistoryAbstractAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/HistoryAbstractAction.java 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/util/HistoryAbstractAction.java 2008-02-19 18:37:50 UTC (rev 1128)
@@ -1,105 +0,0 @@
-/*
-* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions.util;
-
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.ui.swing.DetailTabRefreshHelper;
-import fr.cemagref.simexplorer.is.ui.swing.JDetailTab;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
-import fr.cemagref.simexplorer.is.ui.swing.model.DetailTabModel;
-import fr.cemagref.simexplorer.is.ui.swing.model.EntityTreeNode;
-import fr.cemagref.simexplorer.is.ui.swing.model.HistoryModel;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action de base pour les actions d'historique
- *
- * @author chemit
- */
-public abstract class HistoryAbstractAction extends SimExplorerAbstractTabAction {
-
- protected HistoryModel<EntityTreeNode> history;
-
- private static final long serialVersionUID = -2880632145083173463L;
-
- /**
- * @param model le model d'historique non null
- * @return <code>true</code> if il existe une entree adequate a l'action
- * dans l'historique
- */
- protected abstract boolean hasHistoryEntry(HistoryModel<EntityTreeNode> model);
-
- /**
- * @param model le model d'historique, non null
- * @return le noeud à partir de l'historique
- */
- protected abstract EntityTreeNode getHistoryEntry(HistoryModel<EntityTreeNode> model);
-
- protected HistoryAbstractAction(String name) {
- super(name);
- }
-
- @Override
- protected boolean beforeAction(ActionEvent e) throws Exception {
- if (!super.beforeAction(e)) {
- return false;
- }
- // le modele est statique pour le moment
- setTab(SimExplorerTab.detail);
- DetailTabModel model = (DetailTabModel) getModel();
- if (model == null) {
- return false;
- }
- history = model.getHistory();
- return history != null && hasHistoryEntry(history);
- }
-
- @Override
- protected void doAction(ActionEvent e) throws Exception {
- EntityTreeNode node = getHistoryEntry(history);
- if (log.isDebugEnabled()) {
- log.debug("current history entry " + node);
- }
- DetailTabModel model = (DetailTabModel) getModel();
- if (node == null) {
- model.synch(model.isRemote(), (MetaData) null);
- } else {
- model.synch(node);
- }
- }
-
- @Override
- public void updateUI() {
- if (!history.isEmpty()) {
- // select current history element
- DetailTabRefreshHelper.updateDetailNavigationTree((JDetailTab) getUI(), history);
- } else if (getTab().isTabVisible(getTabContainer())) {
- // close tab, no more history
- getTab().closeTab(getTabContainer());
- }
- }
-
- @Override
- protected void clear() {
- super.clear();
- history = null;
- // should be a multi-tab
- setTab(null);
- }
-}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties 2008-02-19 18:35:31 UTC (rev 1127)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/jaxx/simexplorer-is-swing-actions.properties 2008-02-19 18:37:50 UTC (rev 1128)
@@ -64,10 +64,10 @@
action.detailToTree=fr.cemagref.simexplorer.is.ui.swing.actions.DetailToTreeAction
# navigation history actions
-action.historyDelete=fr.cemagref.simexplorer.is.ui.swing.actions.HistoryDeleteAction
-action.historyUnconnect=fr.cemagref.simexplorer.is.ui.swing.actions.HistoryUnconnectAction
-action.historyNext=fr.cemagref.simexplorer.is.ui.swing.actions.HistoryNextAction
-action.historyPrevious=fr.cemagref.simexplorer.is.ui.swing.actions.HistoryPreviousAction
+action.historyDelete=fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryDeleteAction
+action.historyUnconnect=fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryUnconnectAction
+action.historyNext=fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryNextAction
+action.historyPrevious=fr.cemagref.simexplorer.is.ui.swing.actions.history.HistoryPreviousAction
# import- export actions
action.exportElement=fr.cemagref.simexplorer.is.ui.swing.actions.ExportAction
1
0
r1127 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
by tchemit@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: tchemit
Date: 2008-02-19 18:35:31 +0000 (Tue, 19 Feb 2008)
New Revision: 1127
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CloseTabAction.java
Log:
am?\195?\169lioration action fermeture d'onglet
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CloseTabAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CloseTabAction.java 2008-02-19 18:04:28 UTC (rev 1126)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/CloseTabAction.java 2008-02-19 18:35:31 UTC (rev 1127)
@@ -49,7 +49,20 @@
}
@Override
+ protected boolean beforeAction(ActionEvent e) throws Exception {
+ return super.beforeAction(e) && getTabContainer().getTabCount() > 0 && getTab().isTabVisible(getTabContainer());
+ }
+
+ @Override
protected void doAction(ActionEvent e) throws Exception {
getTab().closeTab(getTabContainer());
}
+
+ @Override
+ protected void clear() {
+ super.clear();
+ if (getParam().equals("closeTab")) {
+ setTab(null);
+ }
+ }
}
1
0
r1126 - trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene
by glandais@users.labs.libre-entreprise.org 19 Feb '08
by glandais@users.labs.libre-entreprise.org 19 Feb '08
19 Feb '08
Author: glandais
Date: 2008-02-19 18:04:28 +0000 (Tue, 19 Feb 2008)
New Revision: 1126
Modified:
trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
Log:
Metadata descriptor bugfix
Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-19 18:03:42 UTC (rev 1125)
+++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/LuceneDatabase.java 2008-02-19 18:04:28 UTC (rev 1126)
@@ -74,7 +74,7 @@
public class LuceneDatabase extends Database {
/** The Constant log. */
- private static final Log log = LogFactory.getLog(Config.class);
+ private static final Log log = LogFactory.getLog(LuceneDatabase.class);
/** DB folder. */
private static String dbFolder = Config.getProperties().getProperty("simexplorer.db");
@@ -757,7 +757,7 @@
Map<String, String> finalDescriptors = new HashMap<String, String>();
for (Map.Entry<Integer, KeyValue> entry : descriptors.entrySet()) {
- finalDescriptors.put(entry.getValue().getKey(), entry.getValue().getKey());
+ finalDescriptors.put(entry.getValue().getKey(), entry.getValue().getValue());
}
element.setDescriptors(finalDescriptors);
1
0