r1130 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions
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
participants (1)
-
tchemit@users.labs.libre-entreprise.org