r4221 - in trunk/src/main/java/fr/ifremer/isisfish/ui: script util vcs
Author: echatellier Date: 2015-05-07 09:51:50 +0000 (Thu, 07 May 2015) New Revision: 4221 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/4221 Log: Remove unused code (UI deprecated code) Removed: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ExportDialogUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.css trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ trunk/src/main/java/fr/ifremer/isisfish/ui/util/IDialog.java trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisAction.java trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisActionWithBackup.java trunk/src/main/java/fr/ifremer/isisfish/ui/util/JaxxUtil.java trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ExportDialogUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/script/ExportDialogUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/script/ExportDialogUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,86 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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 3 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, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog modal="true" resizable='false' title='isisfish.script.export'> - <script> - -// public org.nuiton.vcs.ui.FieldModelUtil.ModuleFile model; - public Object model = null; - public boolean isOkEnabled() { - return !isEmpty(); // && model.getSelected(0).size() > 0; - } - public boolean isEmpty() { - return model == null; // || model.getRowCount() == 0; - } - - public void doCheckAll() { -// if (model!=null) model.checkAll(); - doRefresh(); - } - - public void doRefresh() { - fr.ifremer.isisfish.ui.util.JaxxUtil.refresh(this,"items.enabled", - "checkAll.enabled","ok.enabled","chooseDir.enabled", - "archivePath.enabled"); - } - - </script> - <Table anchor='center'> - <row weighty="2"> - <cell columns='2' fill='both'> - <JScrollPane id='table'> - <JTable id="items" autoResizeMode='3' - enabled='{!isEmpty()}' onMouseClicked="doRefresh()"/> - </JScrollPane> - </cell> - </row> - <row fill='horizontal'> - <cell weightx="1" fill='both'> - <JTextField id='archivePath' font-size='11' columns='30' height='25' enabled='{!isEmpty()}'/> - </cell> - <cell fill='both'> - <JButton id='chooseDir' - text='isisfish.script.export.chooseDir' - toolTipText='isisfish.script.export.tooltip.chooseDir' - enabled='{!isEmpty()}' - /> - <!-- onActionPerformed="fr.ifremer.isisfish.ui.UIHelper.openDirChooser(archivePath,ok)" --> - </cell> - </row> - <row fill='horizontal'> - <cell columns="2" fill='both'> - <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> - <JCheckBox id='checkAll' - text='isisfish.script.export.checkAll' - toolTipText='isisfish.script.export.tooltip.checkAll' - enabled='{!isEmpty()}' - onActionPerformed="doCheckAll()" /> - <JButton id='okButton' - enabled='{isOkEnabled()}'/> - <JButton id='cancelButton' /> - </JPanel> - </cell> - </row> - </Table> -</JDialog> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.css =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.css 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.css 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,31 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 3 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, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#newFilesLabel { - foreground: "{new java.awt.Color(051,102,225)}"; -} - -#conflictFilesLabel { - foreground: red; -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,127 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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 3 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, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog modal="true" resizable='false' title='isisfish.script.import'> - <import> - java.io.File - java.awt.Color - </import> - <style source="ImportDialogUI.css" /> - - <FileSelectionTableModel id='newFilesTableModel' javaBean='null' /> - <FileSelectionTableModel id='conflictFilesTableModel' javaBean='null' /> - - <Boolean id="okEnabled" javaBean='false' /> - <Boolean id="newItemEmpty" javaBean='false' /> - <Boolean id="conflictItemEmpty" javaBean='false' /> - <Boolean id="bothEmpty" javaBean='false' /> - - <script><![CDATA[ - - /*public boolean isOkEnabled() { - return (!isConflictItemEmpty() && !conflictFilesTableModel.getSelectedFiles().isEmpty()) || - (!isNewItemEmpty() && !newFilesTableModel.getSelectedFiles().isEmpty()); - }*/ - - public void refresh() { - setConflictItemEmpty(conflictFilesTableModel.getRowCount() == 0); - setNewItemEmpty(newFilesTableModel.getRowCount() == 0); - setBothEmpty(isConflictItemEmpty() && isNewItemEmpty()); - - setOkEnabled((!isConflictItemEmpty() && !conflictFilesTableModel.getSelectedFiles().isEmpty()) || - (!isNewItemEmpty() && !newFilesTableModel.getSelectedFiles().isEmpty())); - } - - public void doCheckAll() { - boolean selection = checkAllCheckbox.isSelected(); - newFilesTableModel.setAllChecked(selection); - conflictFilesTableModel.setAllChecked(selection); - } - - protected void performImport() { - File archiveFile = new File(archivePath.getText()); - getContextValue(ScriptAction.class).performImportScript(archiveFile, newFilesTableModel, conflictFilesTableModel); - } - - protected void cancel() { - dispose(); - } - ]]></script> - <Table> - <row weighty="1" fill='both'> - <cell weighty="1" weightx="1" fill="both"> - <Table> - <row> - <cell weightx="1"> - <JLabel id='newFilesLabel' font-size='12' visible='{!isNewItemEmpty()}' - text='isisfish.script.import.labelAdd' /> - </cell> - </row> - <row fill='both'> - <cell weighty="1"> - <JScrollPane visible='{!isNewItemEmpty()}'> - <JTable id="newFilesTable" autoResizeMode='{JTable.AUTO_RESIZE_LAST_COLUMN}' - onMouseClicked="refresh()" /> - </JScrollPane> - </cell> - </row> - <row> - <cell weightx="1"> - <JLabel id='conflictFilesLabel' font-size='12' visible='{!isConflictItemEmpty()}' - text='isisfish.script.import.labelOverwrite' /> - </cell> - </row> - <row fill='both' > - <cell weighty="1"> - <JScrollPane visible='{!isConflictItemEmpty()}'> - <JTable id="conflictFilesTable" autoResizeMode='{JTable.AUTO_RESIZE_LAST_COLUMN}' - onMouseClicked="refresh()" /> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row fill='horizontal'> - <cell weightx="1" fill='both'> - <JTextField id='archivePath' editable='false' height='25'/> - </cell> - </row> - <row fill='horizontal'> - <cell fill='both'> - <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> - <JCheckBox id='checkAllCheckbox' text='isisfish.script.import.checkAll' - toolTipText='isisfish.script.import.tooltip.checkAll' - enabled='{!isBothEmpty()}' - onActionPerformed='doCheckAll()' - selected='true' /> - <JButton id='okButton' text='isisfish.script.import.import' - enabled='{isOkEnabled()}'/> - <JButton id='cancelButton' text='isisfish.script.import.cancel' - onActionPerformed="cancel()" /> - </JPanel> - </cell> - </row> - </Table> -</JDialog> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2015-05-07 09:51:50 UTC (rev 4221) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2012 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric + * Copyright (C) 2006 - 2015 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -89,7 +89,6 @@ import fr.ifremer.isisfish.ui.script.model.ScriptTree; import fr.ifremer.isisfish.ui.script.model.ScriptTreeModel; import fr.ifremer.isisfish.ui.util.ErrorHelper; -import fr.ifremer.isisfish.ui.vcs.UpdateDialogUI; import fr.ifremer.isisfish.util.CompileHelper; import fr.ifremer.isisfish.util.JavadocHelper; import fr.ifremer.isisfish.vcs.VCSException; @@ -701,25 +700,6 @@ return scriptFileFilter; } - //public static Object updateScript() - public void updateScript() { - try { - log.debug("updateScript called for "); - //TODO Use VCS UI dialog - UpdateDialogUI ui = new UpdateDialogUI(); - ui.setVisible(true); - //TODO Use FileState new mechanism to obtain state - if (codeStorage != null) { - codeStorage.update(); - codeStorage.reload(); - } - } catch (VCSException ex) { - if (log.isErrorEnabled()) { - log.error("Error on script update", ex); - } - } - } - /** * Check script content. * @@ -862,167 +842,6 @@ } /** - * Show a improved script dialog with multiple selection support. - */ - public void importScript() { - - if (log.isDebugEnabled()) { - log.debug("importScript "); - } - - File root = IsisFish.config.getDatabaseDirectory(); - try { - // ask user form a .zip file - File file = FileUtil.getFile(".*.zip$", - t("isisfish.message.import.scripts.zipped")); - if (file != null) { - - //frame.setInfoText(t("isisfish.message.import.scripts.file", file)); - - // get two list of relative path (one for new files, - // one for exisiting files) - List<String>[] explode = scanZip(file, root); - List<String> newFiles = explode[0]; - List<String> conflictFiles = explode[1]; - - // build model for dialog (list of new items), (list of exisiting items) - FileSelectionTableModel modelNewItems = null; - FileSelectionTableModel modelItems = null; - - // si'il y a des nouveau fichiers - //if (!newFiles.isEmpty()) { - modelNewItems = new FileSelectionTableModel(newFiles); - //} - - // s'il y a des fichier en conflic - //if (!conflictFiles.isEmpty()) { - modelItems = new FileSelectionTableModel(conflictFiles); - //} - - // create import dialog - // TODO do a better code - ImportDialogUI dialog = new ImportDialogUI(); - dialog.setNewFilesTableModel(modelNewItems); - dialog.setConflictFilesTableModel(modelItems); - dialog.getConflictFilesTable().setModel(modelItems); - dialog.getNewFilesTable().setModel(modelNewItems); - // can't be in ui :( - dialog.getNewFilesTable().getColumnModel().getColumn(0) - .setWidth(30); - dialog.getConflictFilesTable().getColumnModel().getColumn(0) - .setWidth(30); - dialog.getArchivePath().setText(file.getAbsolutePath()); - dialog.refresh(); - dialog.pack(); - SwingUtil.center(dialog); - dialog.setVisible(true); - setStatusMessage(t("isisfish.message.import.scripts.file.done", file)); - } else { - setStatusMessage(t("isisfish.message.import.scripts.file.cancelled")); - } - } catch (Exception eee) { - returnError(t("isisfish.error.script.import", eee.getMessage()), - eee); - } - } - - /** - * Perform import script action called by {@link ImportDialogUI}. - * - * @param sourceScriptArchive source archive file - * @param selectedFiles selected non conflict files model - * @param selectedConflictFiles selected conflict files model - */ - public void performImportScript(File sourceScriptArchive, - FileSelectionTableModel selectedFiles, - FileSelectionTableModel selectedConflictFiles) { - - File sourceDirectory = IsisFish.config.getDatabaseDirectory(); - - List<String> filesToImports = new ArrayList<String>(); - if (selectedFiles != null) { - filesToImports.addAll(selectedFiles.getSelectedFiles()); - } - - if (selectedConflictFiles != null) { - // do backup stuff (only backup conflict files) - backupScripts(selectedConflictFiles.getSelectedFiles(), - sourceDirectory); - - filesToImports.addAll(selectedConflictFiles.getSelectedFiles()); - } - - // unflate files to destination (root) - try { - if (log.isInfoEnabled()) { - for (String newFile : filesToImports) { - log.info("unzip " + newFile); - } - } - ZipUtil.uncompress(sourceScriptArchive, sourceDirectory, - filesToImports, null, null); - - } catch (IOException e1) { - throw new RuntimeException(e1); - } - if (log.isInfoEnabled()) { - log.info("Unzip " + filesToImports.size() + " entry(ies) from '" - + sourceScriptArchive + "'"); - } - } - - /** - * Make a backup a given files to current isis backup directory. - * - * @param paths - */ - protected void backupScripts(List<String> paths, File destination) { - - File backupDirectory = IsisFish.config.getBackupSessionDirectory(); - - if (log.isDebugEnabled()) { - log.debug("Backup directory is : " + backupDirectory); - } - String suffix = "_" - + IsisFish.config.getBackupSessionDirectory().getName(); - try { - for (String path : paths) { - - //backup(new File(src, path), path, suffix); - - File sourceFile = new File(destination, path); - - if (!sourceFile.exists()) { - return; - } - if (sourceFile.isDirectory()) { - File dst = new File(backupDirectory, path); - dst.mkdirs(); - } else { - int extension = path.lastIndexOf("."); - if (extension != -1) { - path = path.substring(0, extension) + suffix + "." - + path.substring(extension + 1); - } else { - path += suffix; - } - File dst = new File(destination, path); - if (!dst.getParentFile().exists()) { - dst.getParentFile().mkdirs(); - } - if (log.isInfoEnabled()) { - log.info("Copying " + sourceFile.getName() + " to " - + dst); - } - FileUtils.copyFile(sourceFile, dst); - } - } - } catch (Exception ex) { - throw new IsisFishRuntimeException("Can't backup scripts", ex); - } - } - - /** * Copy a single file to destination directory. * * @param src file to copy Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2014 Ifremer, CodeLutin, Chatellier Eric + Copyright (C) 2009 - 2015 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -71,11 +71,6 @@ <JMenuItem id="miSave" text="isisfish.script.menu.save" onActionPerformed="getScriptAction().saveScript()" icon="script_save.png" enabled='{isSingleFileSelected()}' /> <JSeparator/> - <JMenuItem id="miImport" text="isisfish.script.menu.txtImport" - enabled="false" onActionPerformed="getScriptAction().importScript()" icon="page_white_compressed.png" /> - <JMenuItem id="miExport" text="isisfish.script.menu.txtExport" - onActionPerformed="getScriptAction().exportScript()" icon="page_white_compressed.png" enabled='{isFileSelected()}' /> - <JSeparator/> <JMenuItem id="miDelete" text="isisfish.script.menu.deleteLocaly" onActionPerformed='getScriptAction().deleteScript(false)' icon="script_delete.png" enabled='{isSingleFileSelected()}' /> </JMenu> @@ -92,8 +87,6 @@ onActionPerformed="getScriptAction().commitScript()" enabled='{isSingleFileSelected()}' /> <JMenuItem id="miDiffVCS" text="isisfish.script.menu.diff" accelerator="mnDiffVCS" onActionPerformed="getScriptAction().diffScript()" enabled='{isSingleFileSelected()}' /> - <JMenuItem id="miUpdateVCS" text="isisfish.script.menu.update" icon="database_refresh.png" - onActionPerformed="getScriptAction().updateScript()"/> <JSeparator/> <JMenuItem id="miDeleteVCS" text="isisfish.script.menu.deleteLocalyServer" onActionPerformed='getScriptAction().deleteScript(true)' icon="database_delete.png"/> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/util/IDialog.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/util/IDialog.java 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/util/IDialog.java 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,84 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 3 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, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.util; - -import javax.swing.AbstractAction; -import javax.swing.JButton; -import java.awt.Dimension; - -public interface IDialog { - /** - * @return the ok button (jaxx generated) - */ - JButton getOk(); - - /** - * @return the cancel button (jaxx generated) - */ - JButton getCancel(); - - /** - * to doRefresh dialog (use processDataBinding) - */ - void doRefresh(); - - /** - * @return <code>true</code> if ok button is enabled, <code>false</code> - * otherwise - */ - boolean isOkEnabled(); - - /** - * @return <code>true</code> if dialog has no data, <code>false</code> - * otherwise - */ - boolean isEmpty(); - - int computeWidth(); - - int computeHeight(); - - // ------------------ JDialog methods - void setVisible(boolean b); - - void setSize(int width, int height); - - void setMaximumSize(Dimension dimension); - - void setOkAction(AbstractAction okAction); - - void setCancelAction(AbstractAction cancelAction); - - void setMaxWidth(int maxWidth); - - void setMinHeight(int minHeight); - - void setMaxHeight(int maxHeight); - - void repaint(); - - void setTitle(String s); -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisAction.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisAction.java 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisAction.java 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,113 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 3 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, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.util; - -import javax.swing.AbstractAction; -import javax.swing.JDialog; -import java.awt.event.ActionEvent; - -public abstract class IsisAction extends AbstractAction { - /** - * flag to say if something has been done in this action (is init in - * {@link #prepare()} method) - */ - protected boolean used; - /** - * dialog source of the action (of <code>null</code> if none) - */ - protected JDialog dialog; - - private static final long serialVersionUID = -968662451138199001L; - - protected IsisAction() { - this(null); - } - - protected IsisAction(JDialog dialog) { - this.dialog = dialog; - } - - - public void actionPerformed(ActionEvent e) { - - try { - // just prepare action and set used field value - used = prepare(); - - // perform action if there is something to do - if (used) { - perform(e); - } - } finally { - //TODO Fix lock between few dialog - // after action perfored - finish(); - } - } - /** - * Prepare data for action, and find out if there is really something to - * do here. - * - * @return <code>true</code> if there is something to do here, - * <code>false</code> otherwise - */ - protected abstract boolean prepare(); - - /** - * perform safelly action after {@link #prepare()} was invoked - * This method is only called if used was <code>true</code> - * - * @param e event source - */ - protected abstract void perform(ActionEvent e); - - /** - * called inside {@link #actionPerformed(java.awt.event.ActionEvent)} after - * {@link #perform(java.awt.event.ActionEvent)} was invoked (so can't - * be come here is nothing was to be done in this action. - */ - protected void finish() { - if (dialog != null && needDispose()) { - dialog.dispose(); - } - } - - /** - * @return <code>true</code> if we have to dispose dialog, - * <code>false</code> otherwise - */ - protected boolean needDispose() { - return used; - } - - /** - * @return <code>true</code> if something was done in the action performed, - * <code>false</code> otherwise - */ - public boolean isUsed() { - return used; - } -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisActionWithBackup.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisActionWithBackup.java 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/util/IsisActionWithBackup.java 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,87 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 3 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, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.util; - -import java.awt.event.ActionEvent; -import java.io.File; -import java.util.List; - -import javax.swing.JDialog; - -import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.ui.script.action.BackupAction; - -/** - * This abstract action perform a backup action. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - * - * @deprecated C'est pas evident de faire des Actions swing avec jaxx - */ -public abstract class IsisActionWithBackup extends IsisAction { - - /** serialVersionUID. */ - private static final long serialVersionUID = -5498329861390316586L; - - /** Root directory of files to be backupped. */ - protected File root; - - /** - * Constructor. - * - * @param dialog dialog ??? - * @param root root directory of files to be backupped - */ - protected IsisActionWithBackup(JDialog dialog, File root) { - super(dialog); - this.root = root; - } - - /** - * obtain the list of relative path to {@link #root} directory needed - * to be backuped in {@code #backupRoot} directory - * - * @return the list of relative path to files to backup - */ - protected abstract List<String> getFilesToBackup(); - - /** - * Just perform a {@link BackupAction}. - * - * Need to be overridden and called by {@code super.perform(e)} - */ - @Override - protected void perform(ActionEvent e) { - // do backup stuff here - BackupAction backupAction = new BackupAction(root, IsisFish.config - .getBackupSessionDirectory(), getFilesToBackup()); - backupAction.actionPerformed(e); - } -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/util/JaxxUtil.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/util/JaxxUtil.java 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/util/JaxxUtil.java 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,70 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 3 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, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.util; - -import jaxx.runtime.JAXXObject; - -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JTextField; -import java.util.Map; - -/** some util generic algorithm for jaxx objects */ -public class JaxxUtil { - - public static void doReset(Map<String, ?> $objectMap) { - - if ($objectMap == null) return; - - for (Map.Entry<String, ?> o : $objectMap.entrySet()) { - Class aClass = o.getValue().getClass(); - Object val = o.getValue(); - if (JTextField.class.isAssignableFrom(aClass)) - ((JTextField) val).setText(""); - else if (JCheckBox.class.isAssignableFrom(aClass)) - ((JCheckBox) val).setSelected(false); - else if (JComboBox.class.isAssignableFrom(aClass)) - ((JComboBox) val).setSelectedIndex(-1); - } - } - - /** - * Refresh dialog and process data binding for given keys - * - * @param dial jaxx dialog - * @param keyFirst first to refresh - * @param keys keys to refresh - */ - public static void refresh(JAXXObject dial, String keyFirst, String... keys) { - if (!IDialog.class.isAssignableFrom(dial.getClass())) return; - - IDialog dialog = (IDialog) dial; - dialog.getOk().setEnabled(dialog.isOkEnabled()); - dial.processDataBinding(keyFirst); - for (String key : keys) dial.processDataBinding(key); - dialog.repaint(); - } -} - Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,88 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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 3 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, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog modal="true" title='isisfish.vcs.commit'> - <import> - java.awt.Color - </import> - <script><![CDATA[ - // FIXME a refaire - -// protected ModuleFile<VCSFileState> model; - protected Object model; - - public CommitDialogUI(Dialog owner, boolean modal) { - super(owner, modal); - - } - public boolean isEmpty() { - return items.getRowCount()==0; - } - public boolean isOkEnabled() { - return !isEmpty(); - } - public void doRefresh() { - fr.ifremer.isisfish.ui.util.JaxxUtil.refresh(this,"ok.enabled"); - } - protected void reSize(JTable table) { - // implements me... - } - ]]> - </script> - <Table weightx="1"> - <row> - <cell columns='2'> - <JLabel id='label' font-size='12' - foreground='{new Color(051,102,225)}' - text='isisfish.vcs.commit.label'/> - </cell> - </row> - <row> - <cell columns='2' weighty="1" weightx='1' fill='both'> - <JScrollPane id='scroll' verticalScrollBarPolicy='20' > - <JTable id="items" onComponentResized="reSize(items)"/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal'> - <JScrollPane height='50' verticalScrollBarPolicy='21' - horizontalScrollBarPolicy='30'> - <JTextArea id='message' rows='2' columns='80'/> - </JScrollPane> - </cell> - </row> - <row weightx="1" fill='horizontal'> - <cell> - <JButton id='ok' text='isisfish.vcs.commit.ok' - enabled='{isOkEnabled()}' - onActionPerformed='/*fr.ifremer.isisfish.versionning.ui.VCSUIHelper.COMMIT_MSG=message.getText();*/dispose()'/> - </cell> - <cell> - <JButton id='cancel' text='isisfish.vcs.commit.cancel' - onActionPerformed='dispose()'/> - </cell> - </row> - </Table> -</JDialog> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,94 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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 3 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, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog modal="true" title='isisfish.vcs.updateconfirm'> - <import> - java.awt.Color - </import> - <script><![CDATA[ - // FIXME a refaire - -// protected ModuleFile<VCSFileState> model; - protected Object model; - - public void doCheckAll() { -// if (model != null && model.getRowCount()>0) { -// model.checkAll(); -// doRefresh(); -// } - } - public boolean isEmpty() { - return model==null; // || model.getRowCount()==0; - } - public boolean isOkEnabled() { - return !isEmpty(); // && model.getSelectedSize(0)>0; - } - protected void reSize(JTable table) { - // implements me... - } - public void doRefresh() { - fr.ifremer.isisfish.ui.util.JaxxUtil.refresh(this,"checkAll.enabled","ok.enabled"); - } - ]]> - </script> - <Table weightx="1"> - <row> - <cell columns='4'> - <JLabel font-size='12' foreground='{new Color(051,102,225)}' - text='isisfish.vcs.updateconfirm.label'/> - </cell> - </row> - <row> - <cell columns='4'> - <JLabel id='label2' font-size='12' foreground='{Color.RED}' - text='isisfish.vcs.updateconfirm.label2'/> - </cell> - </row> - <row> - <cell columns='4' weighty="1" fill='both'> - <JScrollPane id='table'> - <JTable id="items" autoResizeMode='3' - rowSelectionAllowed="true" - onMouseClicked="doRefresh()" - onComponentResized="reSize(items)"/> - </JScrollPane> - </cell> - </row> - <row weightx="1" fill='horizontal'> - <cell columns="2" fill='both'> - <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> - <JCheckBox id='checkAll' - text='isisfish.vcs.updateconfirm.checkAll' - toolTipText='isisfish.vcs.updateconfirm.tooltip.checkAll' - enabled='{!isEmpty()}' - onActionPerformed="doCheckAll()"/> - <JButton id='ok' text='isisfish.vcs.updateconfirm.ok' - enabled='{isOkEnabled()}'/> - <JButton id='cancel' - text='isisfish.vcs.updateconfirm.cancel'/> - </JPanel> - </cell> - </row> - </Table> -</JDialog> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -1,187 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin - %% - 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 3 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, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog modal="true" title='isisfish.vcs.update'> - <script><![CDATA[ - // FIXME a refaire - -// protected org.nuiton.vcs.VCSRepositoryState model; - protected Object model; - - public void doCheckAll() { -// if (model!=null) { -// model.checkAll(checkAll.isSelected()); -// doRefresh(); -// } - } - - public boolean isEmpty() { - return model==null; // || model.isModelEmpty(); - } - - public boolean isOkEnabled() { - return !isEmpty(); // && model.getModelSelectedSize()>0; - } - - public void doRefresh() { - fr.ifremer.isisfish.ui.util.JaxxUtil.refresh(this,"checkAll.enabled","ok.enabled"); - } - -// protected void reSize(VCSState state,JTable table) { -// -// } - ]]> - </script> - <Table weightx="1"> - <row> - <cell columns='3' weighty="1" fill='both'> - <JSplitPane id='splitPane' orientation='vertical' - oneTouchExpandable='true'> - <JSplitPane id='splitPane2' orientation='horizontal' - oneTouchExpandable='true'> - <Table weightx="1" id='tableRemote'> - <row> - <cell columns="2" anchor='northwest'> - <JLabel text='isisfish.vcs.update.remote' - toolTipText='isisfish.vcs.update.tooltip.remote'/> - </cell> - </row> - <row> - <cell> - <JLabel id='label_missing' - text='isisfish.vcs.update.remote.missing' - toolTipText='isisfish.vcs.update.remote.tooltip.missing'/> - </cell> - </row> - <row> - <cell weighty="1" fill='both'> - <JScrollPane id='scroll_missing'> - <JTable id="table_missing" - autoResizeMode='3' - onMouseClicked="doRefresh()"/> - </JScrollPane> - </cell> - </row> - <row> - <cell> - <JLabel id='label_outofdate' - text='isisfish.vcs.update.remote.outofdate' - toolTipText='isisfish.vcs.update.remote.tooltip.outofdate'/> - </cell> - </row> - <row> - <cell weighty="1" fill='both'> - <JScrollPane id='scroll_outofdate'> - <JTable id="table_outofdate" - autoResizeMode='3' - onMouseClicked="doRefresh()" - rowSelectionAllowed="true"/> - </JScrollPane> - </cell> - </row> - </Table> - <Table weightx="1" id='tableLocal'> - <row> - <cell columns="2" anchor='west'> - <JLabel text='isisfish.vcs.update.local' - toolTipText='isisfish.vcs.update.tooltip.local'/> - </cell> - </row> - <row> - <cell> - <JLabel id='label_unversionned' - text='isisfish.vcs.update.local.unversionned' - toolTipText='isisfish.vcs.update.local.tooltip.unversionned'/> - </cell> - </row> - <row> - <cell weighty="1" fill='both'> - <JScrollPane id='scroll_unversionned'> - <JTable id="table_unversionned" - autoResizeMode='3' - rowSelectionAllowed="true" - onMouseClicked="doRefresh()"/> - </JScrollPane> - </cell> - </row> - <row> - <cell> - <JLabel id='label_modified' - text='isisfish.vcs.update.local.modified' - toolTipText='isisfish.vcs.update.local.tooltip.modified'/> - </cell> - </row> - <row> - <cell weighty="1" fill='both'> - <JScrollPane id='scroll_modified'> - <JTable id="table_modified" - autoResizeMode='3' - rowSelectionAllowed="true" - onMouseClicked="doRefresh()"/> - </JScrollPane> - </cell> - </row> - <row> - <cell> - <JLabel id='label_outofdateAndModified' - text='isisfish.vcs.update.local.outofdateAndModified' - toolTipText='isisfish.vcs.update.local.tooltip.outofdateAndModified'/> - </cell> - </row> - <row> - <cell weighty="1" fill='both'> - <JScrollPane id='scroll_outofdateAndModified'> - <JTable id="table_outofdateAndModified" - autoResizeMode='3' - rowSelectionAllowed="true" - onMouseClicked="doRefresh()"/> - </JScrollPane> - </cell> - </row> - </Table> - </JSplitPane> - <JScrollPane> - <JTextPane id="logText" editable="false" - focusable='false'/> - </JScrollPane> - </JSplitPane> - </cell> - </row> - <row weightx="1" fill='horizontal'> - <cell columns="3" fill='both'> - <JPanel layout='{new GridLayout(0, 3, 2, 2)}'> - <JCheckBox id='checkAll' - text='isisfish.vcs.update.checkAll' - toolTipText='isisfish.vcs.update.tooltip.checkAll' - enabled='{!isEmpty()}' - onActionPerformed="doCheckAll()"/> - <JButton id='ok' text='isisfish.vcs.update.ok' - enabled='{isOkEnabled()}' - onActionPerformed="dispose()"/> - <JButton id='cancel' text='isisfish.vcs.update.cancel'/> - </JPanel> - </cell> - </row> - </Table> -</JDialog> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2015 Ifremer, CodeLutin %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2015 Ifremer, CodeLutin %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx 2015-05-07 09:43:46 UTC (rev 4220) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx 2015-05-07 09:51:50 UTC (rev 4221) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2015 Ifremer, CodeLutin %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
participants (1)
-
echatellier@users.forge.codelutin.com