Author: tchemit Date: 2008-02-12 01:40:17 +0000 (Tue, 12 Feb 2008) New Revision: 855 Added: 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 Log: actions d'export (?\195?\160 finir) Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java (from rev 843, 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 (rev 0) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToLocalAction.java 2008-02-12 01:40:17 UTC (rev 855) @@ -0,0 +1,95 @@ +/* +* ##% 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.entities.metadata.Version; +import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction; +import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper; +import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode; +import fr.cemagref.simexplorer.is.ui.swing.JDetailTab; +import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException; + +import javax.swing.JTree; +import java.awt.event.ActionEvent; +import java.io.File; + +/** + * 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 SimExplorerAbstractTabAction { + + private static final long serialVersionUID = 7535647131305304738L; + + JTree tree; + LoggableElementTreeNode node; + File file; + LoggableElement element; + String uuid; + Version version; + + public ExportToLocalAction(String name) { + super(name); + } + + @Override + protected boolean beforeAction(ActionEvent e) throws Exception { + if (!super.beforeAction(e)) { + return false; + } + JDetailTab ui = (JDetailTab) getUI(); + tree = ui.getNavigationTree(); + node = LoggableElementTreeHelper.getSelectedNodeOrRootNode(tree); + boolean result; + result = LoggableElementTreeHelper.canExport(node); + if (result) { + element = (LoggableElement) node.getUserObject(); + uuid = element.getMetaData().getUuid(); + version = element.getMetaData().getVersion(); + } + return result; + } + + @Override + protected void doAction(ActionEvent e) throws Exception { + throw new SimExplorerRuntimeException(this+" is not implemented yet!"); + } + + @Override + protected void clear() { + super.clear(); + tree = null; + node = null; + file = null; + element = null; + version = null; + uuid = null; + } +} \ No newline at end of file Added: 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 (rev 0) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/ExportToRemoteAction.java 2008-02-12 01:40:17 UTC (rev 855) @@ -0,0 +1,95 @@ +/* +* ##% 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.entities.metadata.Version; +import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractTabAction; +import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeHelper; +import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode; +import fr.cemagref.simexplorer.is.ui.swing.JDetailTab; +import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException; + +import javax.swing.JTree; +import java.awt.event.ActionEvent; +import java.io.File; + +/** + * 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 SimExplorerAbstractTabAction { + + private static final long serialVersionUID = 7535647131305304738L; + + JTree tree; + LoggableElementTreeNode node; + File file; + LoggableElement element; + String uuid; + Version version; + + public ExportToRemoteAction(String name) { + super(name); + } + + @Override + protected boolean beforeAction(ActionEvent e) throws Exception { + if (!super.beforeAction(e)) { + return false; + } + JDetailTab ui = (JDetailTab) getUI(); + tree = ui.getNavigationTree(); + node = LoggableElementTreeHelper.getSelectedNodeOrRootNode(tree); + boolean result; + result = LoggableElementTreeHelper.canExport(node); + if (result) { + element = (LoggableElement) node.getUserObject(); + uuid = element.getMetaData().getUuid(); + version = element.getMetaData().getVersion(); + } + return result; + } + + @Override + protected void doAction(ActionEvent e) throws Exception { + throw new SimExplorerRuntimeException(this+" is not implemented yet!"); + } + + @Override + protected void clear() { + super.clear(); + tree = null; + node = null; + file = null; + element = null; + version = null; + uuid = null; + } +} \ No newline at end of file