Author: chatellier Date: 2011-01-21 14:06:14 +0000 (Fri, 21 Jan 2011) New Revision: 534 Log: Refactoring Object[] to RSufiResultPath pour les resultats a uploaded (equals/hashcode). Modification d'un resultat existant. Added: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResultPath.java trunk/coser-business/src/main/java/fr/ifremer/coser/bean/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/command/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/control/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/services/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/storage/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/util/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/validators/package-info.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTableModel.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionEditResultDialog.jaxx Removed: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/package-info.java trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressMonitor.java trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionRsufiView.jaxx trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties Added: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResultPath.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResultPath.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResultPath.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,119 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.coser.bean; + +/** + * Object utilitaire represantant un path vers un résultat (projet / selection + * / rsufiresult) utilisé par l'interface d'admin et l'upload de resultat + * vers l'interface web. + * + * L'egalité et le hashcode sont basé sur les {@link Project#name}, + * {@link Selection#name}, et {@link RSufiResult#name}. + * + * Les attribut sont finaux car le hashcode est basé dessus. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RSufiResultPath { + + /** Final project. */ + protected final Project project; + + /** Final selection. */ + protected final Selection selection; + + /** Final rsufiresult. */ + protected final RSufiResult rsufiResult; + + /** + * Constructor with full path. + * + * @param project project (can't be null) + * @param selection selection (can't be null) + * @param rsufiResult rsufiresult (can't be null) + */ + public RSufiResultPath(Project project, Selection selection, RSufiResult rsufiResult) { + this.project = project; + this.selection = selection; + this.rsufiResult = rsufiResult; + } + + /** + * Get project. + * + * @return project + */ + public Project getProject() { + return project; + } + + /** + * Get selection. + * + * @return selection + */ + public Selection getSelection() { + return selection; + } + + /** + * Get result. + * + * @return result + */ + public RSufiResult getRsufiResult() { + return rsufiResult; + } + + @Override + public int hashCode() { + int result = 31 + project.getName().hashCode(); + result = 31 * result + selection.getName().hashCode(); + result = 31 * result + rsufiResult.getName().hashCode(); + return result; + } + + @Override + public boolean equals(Object obj) { + boolean result = true; + + if (!(obj instanceof RSufiResultPath)) { + result = false; + } + else { + RSufiResultPath other = (RSufiResultPath)obj; + result &= project.getName().equals(other.project.getName()); + result &= selection.getName().equals(other.selection.getName()); + result &= rsufiResult.getName().equals(other.rsufiResult.getName()); + } + + return result; + } +} Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResultPath.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Storage stucture classes. + */ +package fr.ifremer.coser.bean; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-business/src/main/java/fr/ifremer/coser/command/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/command/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Control specific classes. + */ +package fr.ifremer.coser.command; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/command/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-business/src/main/java/fr/ifremer/coser/control/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/control/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Command specific classes. + */ +package fr.ifremer.coser.control; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/control/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/data/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/data/package-info.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/data/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2011-01-21 14:06:14 UTC (rev 534) @@ -820,6 +820,7 @@ if (log.isDebugEnabled()) { log.debug("Saving control properties file : " + propertiesFile); } + } catch (IOException ex) { throw new CoserBusinessException("Can't save control properties file", ex); } @@ -1098,14 +1099,39 @@ } /** - * Save rsufi result (only property file). + * Save existing rsufi result (just save property file) * + * @param project project + * @param selection selection + * @param rsufiResult new result to save + * @throws CoserBusinessException + */ + public void saveRsufiResults(Project project, Selection selection, RSufiResult rsufiResult) throws CoserBusinessException { + + File projectsDirectory = config.getProjectsDirectory(); + File projectDirectory = new File(projectsDirectory, project.getName()); + File selectionsDirectory = new File(projectDirectory, CoserConstants.STORAGE_SELECTION_DIRECTORY); + File selectionDirectory = new File(selectionsDirectory, selection.getName()); + File resultsDirectory = new File(selectionDirectory, CoserConstants.STORAGE_RESULTS_DIRECTORY); + File rsufiResultDirectory = new File(resultsDirectory, rsufiResult.getName()); + + // property file + saveRSufiResult(rsufiResultDirectory, rsufiResult); + + List<RSufiResult> results = selection.getRsufiResults(); + // this way to fire change event (do not remove) + selection.setRsufiResults(results); + } + + /** + * Save rsufi result (only properties file). + * * @param rsufiResultDirectory rsufiresult directory * @param rsufiResult rsufi result * @throws CoserBusinessException */ public void saveRSufiResult(File rsufiResultDirectory, RSufiResult rsufiResult) throws CoserBusinessException { - + OutputStream outputStream = null; try { // sauvegarde des informations du resultat (properties) @@ -1113,7 +1139,7 @@ Properties props = rsufiResult.toProperties(); outputStream = new FileOutputStream(propertiesFile); props.store(outputStream, null); - + if (log.isDebugEnabled()) { log.debug("Saving result properties file : " + propertiesFile); } Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-21 14:06:14 UTC (rev 534) @@ -83,6 +83,7 @@ import fr.ifremer.coser.CoserUtils; import fr.ifremer.coser.bean.Project; import fr.ifremer.coser.bean.RSufiResult; +import fr.ifremer.coser.bean.RSufiResultPath; import fr.ifremer.coser.bean.Selection; import fr.ifremer.coser.storage.DataStorage; import fr.ifremer.coser.storage.MemoryDataStorage; @@ -237,11 +238,11 @@ * @param endDate end date (can be null) * @param onlyPubliableResult select only publiable results * - * @return results path + * @return results paths * @throws CoserBusinessException */ - public List<Object[]> findAllProjectWithResult(Date beginDate, Date endDate, boolean onlyPubliableResult) throws CoserBusinessException { - List<Object[]> results = new ArrayList<Object[]>(); + public List<RSufiResultPath> findAllProjectWithResult(Date beginDate, Date endDate, boolean onlyPubliableResult) throws CoserBusinessException { + List<RSufiResultPath> results = new ArrayList<RSufiResultPath>(); // loop on projets File projectsDirectory = config.getProjectsDirectory(); @@ -273,7 +274,7 @@ boolean candidate = isCandidateResult(r, beginDate, endDate, onlyPubliableResult); if (candidate) { - Object[] result = new Object[] {p, s, r}; + RSufiResultPath result = new RSufiResultPath(p, s, r); results.add(result); } } @@ -327,20 +328,20 @@ * @return extracted file (no automatically deleted) * @throws CoserBusinessException */ - public File performResultExtract(Collection<Object[]> selectedResults, File extractDirectory, boolean exportWithData) throws CoserBusinessException { + public File performResultExtract(Collection<RSufiResultPath> selectedResults, File extractDirectory, boolean exportWithData) throws CoserBusinessException { File prepareZip = null; try { prepareZip = File.createTempFile("coserextract-", ".zip", extractDirectory); // copy selectively all data to target directory MultipleFileFilter mFileFilters = new MultipleFileFilter(); - for (Object[] path : selectedResults) { + for (RSufiResultPath path : selectedResults) { // load projet, needed to known source data file name - Project project = (Project)path[0]; + Project project = path.getProject(); project = projectService.openProject(project.getName()); OneResultFileFilter oneRFF = new OneResultFileFilter(config, - project, (Selection)path[1], (RSufiResult)path[2], exportWithData); + project, path.getSelection(), path.getRsufiResult(), exportWithData); mFileFilters.add(oneRFF); } @@ -374,8 +375,8 @@ * @return upload error status or {@code null} if no error * @throws CoserBusinessException */ - public String performResultUpload(Collection<Object[]> selectedResults, - Collection<Object[]> mapResults, Collection<Object[]> publishDataResults, + public String performResultUpload(Collection<RSufiResultPath> selectedResults, + Collection<RSufiResultPath> mapResults, Collection<RSufiResultPath> publishDataResults, String login, String password, ProgressMonitor progress) throws CoserBusinessException { String uploadStatus = null; @@ -448,8 +449,8 @@ * @param publishDataResults publish data results * @throws CoserBusinessException */ - protected void modifyRSufiResults(Collection<Object[]> selectedResults, Collection<Object[]> mapResults, - Collection<Object[]> publishDataResults) throws CoserBusinessException { + protected void modifyRSufiResults(Collection<RSufiResultPath> selectedResults, Collection<RSufiResultPath> mapResults, + Collection<RSufiResultPath> publishDataResults) throws CoserBusinessException { // TODO echatellier 20110117 revoir ce code @@ -457,29 +458,29 @@ // decochage de type map / publish result ne seront pas pris en compte // reset type map and data source for all - for (Object[] selectedResult : selectedResults) { - RSufiResult rsufiResult = (RSufiResult)selectedResult[2]; + for (RSufiResultPath selectedResult : selectedResults) { + RSufiResult rsufiResult = selectedResult.getRsufiResult(); rsufiResult.setMapsReferenceResult(false); rsufiResult.setDataAllowed(false); } // set map type - for (Object[] mapResult : mapResults) { - RSufiResult rsufiResult = (RSufiResult)mapResult[2]; + for (RSufiResultPath mapResult : mapResults) { + RSufiResult rsufiResult = mapResult.getRsufiResult(); rsufiResult.setMapsReferenceResult(true); } // set data type - for (Object[] publishDataResult : publishDataResults) { - RSufiResult rsufiResult = (RSufiResult)publishDataResult[2]; + for (RSufiResultPath publishDataResult : publishDataResults) { + RSufiResult rsufiResult = publishDataResult.getRsufiResult(); rsufiResult.setDataAllowed(true); } // save all selected results - for (Object[] selectedResult : selectedResults) { - Project project = (Project)selectedResult[0]; - Selection selection = (Selection)selectedResult[1]; - RSufiResult rsufiResult = (RSufiResult)selectedResult[2]; + for (RSufiResultPath selectedResult : selectedResults) { + Project project = selectedResult.getProject(); + Selection selection = selectedResult.getSelection(); + RSufiResult rsufiResult = selectedResult.getRsufiResult(); File projectDirectory = new File(config.getProjectsDirectory(), project.getName()); File selectionsDirectory = new File(projectDirectory, CoserConstants.STORAGE_SELECTION_DIRECTORY); @@ -498,14 +499,14 @@ * @param selectedResults result id to check * @throws CoserBusinessException */ - protected void checkDataCollision(Collection<Object[]> selectedResults) throws CoserBusinessException { + protected void checkDataCollision(Collection<RSufiResultPath> selectedResults) throws CoserBusinessException { Collection<String> resultZoneTypeIds = new ArrayList<String>(); - for (Object[] selectedResult : selectedResults) { - Project project = (Project)selectedResult[0]; - Selection selection = (Selection)selectedResult[1]; - RSufiResult rsufiResult = (RSufiResult)selectedResult[2]; + for (RSufiResultPath selectedResult : selectedResults) { + Project project = selectedResult.getProject(); + Selection selection = selectedResult.getSelection(); + RSufiResult rsufiResult = selectedResult.getRsufiResult(); // on creer une clé composé pour l'id du resultat String resultZoneTypeId = rsufiResult.getZone() + String.valueOf(rsufiResult.isMapsReferenceResult()); Added: trunk/coser-business/src/main/java/fr/ifremer/coser/services/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Services classes. + */ +package fr.ifremer.coser.services; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/services/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * CSV storage classes. + */ +package fr.ifremer.coser.storage; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressMonitor.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressMonitor.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressMonitor.java 2011-01-21 14:06:14 UTC (rev 534) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java 2011-01-21 14:06:14 UTC (rev 534) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -39,12 +39,13 @@ */ public class ProgressStream extends InputStream { + /** Delegate stream/ */ protected InputStream delegateStream; + /** Progress monitor notified. */ protected ProgressMonitor delegateProgress; public ProgressStream(InputStream delegateStream, ProgressMonitor delegateProgress) { - super(); this.delegateStream = delegateStream; this.delegateProgress = delegateProgress; } Added: trunk/coser-business/src/main/java/fr/ifremer/coser/util/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/util/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Utility classes. + */ +package fr.ifremer.coser.util; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/util/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/package-info.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/validators/package-info.java (rev 0) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/validators/package-info.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,28 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * Xwork validators. + */ +package fr.ifremer.coser.validators; Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/validators/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java 2011-01-21 14:06:14 UTC (rev 534) @@ -43,6 +43,7 @@ import fr.ifremer.coser.CoserBusinessException; import fr.ifremer.coser.CoserException; +import fr.ifremer.coser.bean.RSufiResultPath; import fr.ifremer.coser.services.WebService; import fr.ifremer.coser.ui.common.CommonHandler; import fr.ifremer.coser.ui.util.CoserProgressBar; @@ -74,7 +75,7 @@ // initialise les données avec les filtres par default updateAvailableResultsFilter(view); - view.getSelectedResultTableModel().setResultPath(new ArrayList<Object[]>()); + view.getSelectedResultTableModel().setResultPath(new ArrayList<RSufiResultPath>()); } @@ -95,7 +96,7 @@ WebService webService = view.getContextValue(WebService.class); try { - List<Object[]> results = webService.findAllProjectWithResult(beginDate, endDate, onlyPubliable); + List<RSufiResultPath> results = webService.findAllProjectWithResult(beginDate, endDate, onlyPubliable); view.getAvailableResultTableModel().setResultPath(results); } catch (CoserBusinessException ex) { throw new CoserException("Can't get results", ex); @@ -108,21 +109,20 @@ * @param view view */ public void addAvailableResult(SelectUploadResultView view) { - + // get new result to add - List<Object[]> newResult = new ArrayList<Object[]>(); + List<RSufiResultPath> currentResult = view.getSelectedResultTableModel().getResultPath(); int[] selectedAvailableRows = view.getAvailableResultTable().getSelectedRows(); for (int selectedAvailableRow : selectedAvailableRows) { - Object[] resultData = view.getAvailableResultTableModel().getResultPath().get(selectedAvailableRow); - newResult.add(resultData); + RSufiResultPath resultData = view.getAvailableResultTableModel().getResultPath().get(selectedAvailableRow); + if (!currentResult.contains(resultData)) { + currentResult.add(resultData); + } } // les collisions ne peuvent pas être détecté a ce moment. // seulement lors du clic sur le bouton export/upload - // add new results - List<Object[]> currentResult = view.getSelectedResultTableModel().getResultPath(); - currentResult.addAll(newResult); view.getSelectedResultTableModel().setResultPath(currentResult); } @@ -132,7 +132,7 @@ * @param view view */ public void removeSelectedResult(SelectUploadResultView view) { - List<Object[]> currentResult = view.getSelectedResultTableModel().getResultPath(); + List<RSufiResultPath> currentResult = view.getSelectedResultTableModel().getResultPath(); int[] selectedSelectedRows = view.getSelectedResultTable().getSelectedRows(); // need to remove reverse order for (int index = selectedSelectedRows.length - 1 ; index >= 0 ; --index) { @@ -155,9 +155,9 @@ // get result selected by user SelectUploadResultView parentView = view.getContextValue(SelectUploadResultView.class, JAXXUtil.PARENT); - final Collection<Object[]> selectedResult = parentView.getSelectedResultTableModel().getResultPath(); - final Collection<Object[]> mapResult = parentView.getSelectedResultTableModel().getMapResult(); - final Collection<Object[]> publishDataResult = parentView.getSelectedResultTableModel().getPublishDataResult(); + final Collection<RSufiResultPath> selectedResult = parentView.getSelectedResultTableModel().getResultPath(); + final Collection<RSufiResultPath> mapResult = parentView.getSelectedResultTableModel().getMapResult(); + final Collection<RSufiResultPath> publishDataResult = parentView.getSelectedResultTableModel().getPublishDataResult(); if (CollectionUtils.isNotEmpty(selectedResult)) { SwingWorker<String, Void> task = new SwingWorker<String, Void>() { @@ -215,7 +215,7 @@ boolean withData = view.getSourceDataExport().isSelected(); SelectUploadResultView parentView = view.getContextValue(SelectUploadResultView.class, JAXXUtil.PARENT); - Collection<Object[]> selectedResult = parentView.getSelectedResultTableModel().getResultPath(); + Collection<RSufiResultPath> selectedResult = parentView.getSelectedResultTableModel().getResultPath(); WebService webService = view.getContextValue(WebService.class); try { webService.performResultExtract(selectedResult, extractDirectory, withData); Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2011-01-21 14:06:14 UTC (rev 534) @@ -101,7 +101,7 @@ public Object getValueAt(int rowIndex, int columnIndex) { Object result = null; - RSufiResult rsufiResult = selection.getRsufiResults().get(rowIndex); + RSufiResult rsufiResult = getValue(rowIndex); switch (columnIndex) { case 0: result = rsufiResult.getName(); @@ -120,6 +120,17 @@ return result; } + /** + * Get value for wall row. + * + * @param rowIndex row index + * @return rsufi result at row index + */ + public RSufiResult getValue(int rowIndex) { + RSufiResult result = selection.getRsufiResults().get(rowIndex); + return result; + } + /* * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java 2011-01-21 14:06:14 UTC (rev 534) @@ -28,9 +28,7 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; -import fr.ifremer.coser.bean.Project; -import fr.ifremer.coser.bean.RSufiResult; -import fr.ifremer.coser.bean.Selection; +import fr.ifremer.coser.bean.RSufiResultPath; /** * Available and selected result path renderer. @@ -51,12 +49,11 @@ boolean isSelected, boolean hasFocus, int row, int column) { Object localValue = value; - if (value instanceof Object[]) { - Object[] arrayValue = (Object[])value; - //localValue = StringUtils.join(arrayValue, '/'); - localValue = ((Project)arrayValue[0]).getName() + "/" + - ((Selection)arrayValue[1]).getName() + "/" + - ((RSufiResult)arrayValue[2]).getName(); + if (value instanceof RSufiResultPath) { + RSufiResultPath rsufiResultPath = (RSufiResultPath)value; + localValue = rsufiResultPath.getProject().getName() + "/" + + rsufiResultPath.getSelection().getName() + "/" + + rsufiResultPath.getRsufiResult().getName(); } return super.getTableCellRendererComponent(table, localValue, isSelected, hasFocus, row, column); Copied: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTableModel.java (from rev 532, trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java) =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTableModel.java (rev 0) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTableModel.java 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,223 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 - 2011 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 + * 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.coser.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.swing.table.AbstractTableModel; + +import fr.ifremer.coser.bean.RSufiResult; +import fr.ifremer.coser.bean.RSufiResultPath; + +/** + * Model represantant la liste de tous les resultats rsufi present + * dans le dossier de stockage de coser, tous projets confondu. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RsufiResultTableModel extends AbstractTableModel { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6404018386062830677L; + + /** Les données de la table. */ + protected List<RSufiResultPath> resultPath; + + /** Les résultats marqué comme étant des données de map. */ + protected Set<RSufiResultPath> mapResult; + + /** Les résultat dont la publication des données est autorisée. */ + protected Set<RSufiResultPath> publishDataResult; + + /** Selected table tablemodel (do not show all columns). */ + protected boolean selected; + + public RsufiResultTableModel(boolean selected) { + this.selected = selected; + } + + public void setResultPath(List<RSufiResultPath> resultPath) { + this.resultPath = resultPath; + mapResult = new HashSet<RSufiResultPath>(); + publishDataResult = new HashSet<RSufiResultPath>(); + fireTableDataChanged(); + } + + public List<RSufiResultPath> getResultPath() { + return resultPath; + } + + public Set<RSufiResultPath> getMapResult() { + return mapResult; + } + + public Set<RSufiResultPath> getPublishDataResult() { + return publishDataResult; + } + + /* + * @see javax.swing.table.TableModel#getRowCount() + */ + @Override + public int getRowCount() { + int result = 0; + if (resultPath != null) { + result = resultPath.size(); + } + return result; + } + + @Override + public String getColumnName(int column) { + String result = null; + switch(column) { + case 0: + result = _("coser.ui.uploadresult.creationDate"); + break; + case 1: + result = _("coser.ui.uploadresult.path"); + break; + case 2: + result = _("coser.ui.uploadresult.zone"); + break; + case 3: + result = _("coser.ui.uploadresult.mapResult"); + break; + case 4: + result = _("coser.ui.uploadresult.publishData"); + break; + } + return result; + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + Class<?> result = null; + switch(columnIndex) { + case 0: + result = Date.class; + break; + case 1: + result = String[].class; + break; + case 2: + result = String.class; + break; + case 3: + result = Boolean.class; + break; + case 4: + result = Boolean.class; + break; + } + return result; + } + + /* + * @see javax.swing.table.TableModel#getColumnCount() + */ + @Override + public int getColumnCount() { + int result = 3; + if (selected) { + result = 5; + } + return result; + } + + /* + * @see javax.swing.table.TableModel#getValueAt(int, int) + */ + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + + Object result = null; + + RSufiResultPath data = resultPath.get(rowIndex); + RSufiResult rsufiResult = data.getRsufiResult(); + switch (columnIndex) { + case 0: + result = rsufiResult.getCreationDate(); + break; + case 1: + result = data; + break; + case 2: + result = rsufiResult.getZone(); + break; + case 3: + // c'est pas tres safe tu les hashcode des tableaux + // mais bon... + result = mapResult.contains(data); + break; + case 4: + // c'est pas tres safe tu les hashcode des tableaux + // mais bon... + result = publishDataResult.contains(data); + break; + } + + return result; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex >= 3; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + + RSufiResultPath data = resultPath.get(rowIndex); + + if (columnIndex == 3) { + Boolean bValue = (Boolean)aValue; + if (bValue.booleanValue()) { + mapResult.add(data); + } + else { + mapResult.remove(data); + } + } + + else if (columnIndex == 4) { + Boolean bValue = (Boolean)aValue; + if (bValue.booleanValue()) { + publishDataResult.add(data); + } + else { + publishDataResult.remove(data); + } + } + } +} Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java 2011-01-21 14:06:14 UTC (rev 534) @@ -1,225 +0,0 @@ -/* - * #%L - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2010 - 2011 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 - * 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.coser.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.swing.table.AbstractTableModel; - -import fr.ifremer.coser.bean.RSufiResult; - -/** - * Model represantant la liste de tous les resultats rsufi present - * dans le dossier de stockage de coser, tous projets confondu. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class RsufiResultTreeModel extends AbstractTableModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = 6404018386062830677L; - - /** Les données de la table. */ - protected List<Object[]> resultPath; - - /** Les résultats marqué comme étant des données de map. */ - protected Set<Object[]> mapResult; - - /** Les résultat dont la publication des données est autorisée. */ - protected Set<Object[]> publishDataResult; - - /** Selected table tablemodel (do not show all columns). */ - protected boolean selected; - - public RsufiResultTreeModel(boolean selected) { - this.selected = selected; - } - - public void setResultPath(List<Object[]> resultPath) { - this.resultPath = resultPath; - mapResult = new HashSet<Object[]>(); - publishDataResult = new HashSet<Object[]>(); - fireTableDataChanged(); - } - - public List<Object[]> getResultPath() { - return resultPath; - } - - public Set<Object[]> getMapResult() { - return mapResult; - } - - public Set<Object[]> getPublishDataResult() { - return publishDataResult; - } - - /* - * @see javax.swing.table.TableModel#getRowCount() - */ - @Override - public int getRowCount() { - int result = 0; - if (resultPath != null) { - result = resultPath.size(); - } - return result; - } - - @Override - public String getColumnName(int column) { - String result = null; - switch(column) { - case 0: - result = _("coser.ui.uploadresult.creationDate"); - break; - case 1: - result = _("coser.ui.uploadresult.path"); - break; - case 2: - result = _("coser.ui.uploadresult.zone"); - break; - case 3: - result = _("coser.ui.uploadresult.mapResult"); - break; - case 4: - result = _("coser.ui.uploadresult.publishData"); - break; - } - return result; - } - - @Override - public Class<?> getColumnClass(int columnIndex) { - Class<?> result = null; - switch(columnIndex) { - case 0: - result = Date.class; - break; - case 1: - result = String[].class; - break; - case 2: - result = String.class; - break; - case 3: - result = Boolean.class; - break; - case 4: - result = Boolean.class; - break; - } - return result; - } - - /* - * @see javax.swing.table.TableModel#getColumnCount() - */ - @Override - public int getColumnCount() { - int result = 3; - if (selected) { - result = 5; - } - return result; - } - - /* - * @see javax.swing.table.TableModel#getValueAt(int, int) - */ - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - - Object result = null; - - Object[] data = resultPath.get(rowIndex); - switch (columnIndex) { - case 0: { - RSufiResult rsufiResult = (RSufiResult)data[2]; - result = rsufiResult.getCreationDate(); - break; - } - case 1: - result = data; - break; - case 2: { - RSufiResult rsufiResult = (RSufiResult)data[2]; - result = rsufiResult.getZone(); - break; - } - case 3: - // c'est pas tres safe tu les hashcode des tableaux - // mais bon... - result = mapResult.contains(data); - break; - case 4: - // c'est pas tres safe tu les hashcode des tableaux - // mais bon... - result = publishDataResult.contains(data); - break; - } - - return result; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return columnIndex >= 3; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - - Object[] data = resultPath.get(rowIndex); - - if (columnIndex == 3) { - Boolean bValue = (Boolean)aValue; - if (bValue.booleanValue()) { - mapResult.add(data); - } - else { - mapResult.remove(data); - } - } - - else if (columnIndex == 4) { - Boolean bValue = (Boolean)aValue; - if (bValue.booleanValue()) { - publishDataResult.add(data); - } - else { - publishDataResult.remove(data); - } - } - } -} Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx 2011-01-21 14:06:14 UTC (rev 534) @@ -67,7 +67,7 @@ <row> <cell weightx="1" weighty="1" fill="both"> <JScrollPane> - <RsufiResultTreeModel id="availableResultTableModel" initializer='new RsufiResultTreeModel(false)' /> + <RsufiResultTableModel id="availableResultTableModel" initializer='new RsufiResultTableModel(false)' /> <JTable id="availableResultTable" model="{getAvailableResultTableModel()}"/> <ListSelectionModel javaBean="availableResultTable.getSelectionModel()" onValueChanged="addResultButton.setEnabled(getAvailableResultTable().getSelectedRow() != -1)" /> @@ -88,7 +88,7 @@ <row> <cell weightx="1" weighty="1" fill="both"> <JScrollPane> - <RsufiResultTreeModel id="selectedResultTableModel" initializer='new RsufiResultTreeModel(true)' /> + <RsufiResultTableModel id="selectedResultTableModel" initializer='new RsufiResultTableModel(true)' /> <JTable id="selectedResultTable" model="{getSelectedResultTableModel()}" /> <ListSelectionModel javaBean="selectedResultTable.getSelectionModel()" onValueChanged="removeResultButton.setEnabled(getSelectedResultTable().getSelectedRow() != -1)" /> Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx 2011-01-21 14:06:14 UTC (rev 534) @@ -75,7 +75,8 @@ <JLabel text="coser.ui.result.zone" /> </cell> <cell fill="horizontal" columns="2"> - <JComboBox id="resultZoneCombo" model="{new ZoneComboBoxModel(this)}" + <ZoneComboBoxModel id="resultZoneComboModel" javaBean="new ZoneComboBoxModel(getContextValue(fr.ifremer.coser.services.WebService.class))" /> + <JComboBox id="resultZoneCombo" model="{getResultZoneComboModel()}" renderer="{new ZoneComboBoxRenderer()}" onActionPerformed='getRsufiResult().setZone((String)resultZoneCombo.getSelectedItem())'/> </cell> Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionEditResultDialog.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionEditResultDialog.jaxx (rev 0) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionEditResultDialog.jaxx 2011-01-21 14:06:14 UTC (rev 534) @@ -0,0 +1,87 @@ +<!-- + #%L + Coser :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 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 + 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 title="coser.ui.result.newResult" modal="true"> + <Table> + <fr.ifremer.coser.ui.selection.SelectionHandler id="handler" javaBean="null" /> + + <fr.ifremer.coser.bean.RSufiResult id="rsufiResult" javaBean="null" /> + + <row> + <cell anchor="west"> + <JLabel text="coser.ui.result.resultName" /> + </cell> + <cell fill="horizontal"> + <JTextField id="resultNameField" enabled="false" text="{getRsufiResult().getName()}"/> + </cell> + </row> + <row> + <cell anchor="west"> + <JLabel text="coser.ui.result.rsufiVersion" /> + </cell> + <cell fill="horizontal"> + <JTextField id="resultRsufiVersion" text="{getRsufiResult().getRsufiVersion()}" /> + <javax.swing.text.Document javaBean="resultRsufiVersion.getDocument()" + onInsertUpdate='getRsufiResult().setRsufiVersion(resultRsufiVersion.getText())' + onRemoveUpdate='getRsufiResult().setRsufiVersion(resultRsufiVersion.getText())' /> + </cell> + </row> + <row> + <cell anchor="west"> + <JLabel text="coser.ui.result.creationDate" /> + </cell> + <cell fill="horizontal"> + <JXDatePicker id="resultCreationDate" date="{getRsufiResult().getCreationDate()}" + onActionPerformed="getRsufiResult().setCreationDate(resultCreationDate.getDate())"/> + </cell> + </row> + <row> + <cell anchor="west"> + <JLabel text="coser.ui.result.zone" /> + </cell> + <cell fill="horizontal"> + <ZoneComboBoxModel id="resultZoneComboModel" javaBean="new ZoneComboBoxModel(getContextValue(fr.ifremer.coser.services.WebService.class))" + selectedItem="{getRsufiResult().getZone()}"/> + <JComboBox id="resultZoneCombo" model="{getResultZoneComboModel()}" + renderer="{new ZoneComboBoxRenderer()}" + onActionPerformed='getRsufiResult().setZone((String)resultZoneCombo.getSelectedItem())'/> + </cell> + </row> + <row> + <cell anchor="west"> + <JLabel text="coser.ui.result.publishResult" /> + </cell> + <cell fill="horizontal"> + <JCheckBox id="publishResultCheckBox" selected="{getRsufiResult().isPublishResult()}" + onActionPerformed="getRsufiResult().setPublishResult(publishResultCheckBox.isSelected())"/> + </cell> + </row> + <row> + <cell columns="2" anchor="east"> + <JButton id="saveResultButton" text="coser.ui.result.validEditResult" + onActionPerformed="getHandler().performEditResult(this)"/> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java 2011-01-21 14:06:14 UTC (rev 534) @@ -48,14 +48,9 @@ /** serialVersionUID. */ private static final long serialVersionUID = 4452070553401468762L; - protected SelectionAddResultDialog view; - protected DataStorage zonesMap; - public ZoneComboBoxModel(SelectionAddResultDialog view) { - this.view = view; - - WebService webService = view.getContextValue(WebService.class); + public ZoneComboBoxModel(WebService webService) { try { zonesMap = webService.getZonesMap(); } catch (CoserBusinessException ex) { Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-01-21 14:06:14 UTC (rev 534) @@ -73,6 +73,7 @@ import fr.ifremer.coser.services.PublicationService; import fr.ifremer.coser.ui.common.DataHandler; import fr.ifremer.coser.ui.result.SelectionAddResultDialog; +import fr.ifremer.coser.ui.result.SelectionEditResultDialog; import fr.ifremer.coser.ui.selection.model.OccurrenceDensitySpeciesListModel; import fr.ifremer.coser.ui.util.CoserListSelectionModel; @@ -1070,6 +1071,27 @@ } /** + * Show rsufi result edit dialog with selected rsufiresult. + * + * @param view view + */ + public void showEditResultDialog(SelectionRsufiView view) { + + // get selected rsufi result + int selectedRow = view.getSelectionResultsTable().getSelectedRow(); + RSufiResult result = view.getSelectionResultsTableModel().getValue(selectedRow); + + SelectionEditResultDialog editResultView = new SelectionEditResultDialog(view); + // TODO chatellier 20101121 il ne faudrait pas que ca soit le + // meme, sinon meme en annulant il est modifié + editResultView.setRsufiResult(result); + editResultView.setHandler(this); + editResultView.pack(); + editResultView.setLocationRelativeTo(view); + editResultView.setVisible(true); + } + + /** * Save new result after clicking "ok" button on SelectionAddResultDialog * opened by {@link #showAddResultDialog(SelectionRsufiView)}. * @@ -1094,6 +1116,27 @@ } /** + * Save edited result (only save properties file). + * + * @param view view + */ + public void performEditResult(SelectionEditResultDialog view) { + Project project = view.getContextValue(Project.class); + Selection selection = view.getContextValue(Selection.class); + ProjectService projectService = view.getContextValue(ProjectService.class); + + RSufiResult editedResult = view.getRsufiResult(); + try { + projectService.saveRsufiResults(project, selection, editedResult); + } + catch (CoserBusinessException ex) { + JOptionPane.showMessageDialog(view, ex.getMessage(), _("coser.ui.result.saveError"), JOptionPane.ERROR_MESSAGE); + throw new CoserException("Can't save result", ex); + } + view.dispose(); + } + + /** * Selectionne le dossier d'extraction. * * @param view view Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionRsufiView.jaxx =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionRsufiView.jaxx 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionRsufiView.jaxx 2011-01-21 14:06:14 UTC (rev 534) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric + Copyright (C) 2010 - 2011 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 @@ -58,14 +58,22 @@ <cell weightx="1" weighty="2" fill="both"> <Table border='{BorderFactory.createTitledBorder(_("coser.ui.result.availableDataTitle"))}'> <row> - <cell weightx="1" weighty="1" fill="both"> + <cell columns="2" weightx="1" weighty="1" fill="both"> <JScrollPane> - <JTable model="{new fr.ifremer.coser.ui.result.ResultTableModel(this)}"/> + <fr.ifremer.coser.ui.result.ResultTableModel id="selectionResultsTableModel" + javaBean="new fr.ifremer.coser.ui.result.ResultTableModel(this)" /> + <JTable id="selectionResultsTable" model="{getSelectionResultsTableModel()}"/> + <ListSelectionModel javaBean="selectionResultsTable.getSelectionModel()" + onValueChanged="editResultButton.setEnabled(getSelectionResultsTable().getSelectedRow() != -1)" /> </JScrollPane> </cell> </row> <row> - <cell anchor="east"> + <cell weightx="1" anchor="east"> + <JButton id="editResultButton" text="coser.ui.result.editResult" enabled="false" + onActionPerformed="getHandler().showEditResultDialog(this)" /> + </cell> + <cell> <JButton text="coser.ui.result.addNewResult" onActionPerformed="getHandler().showAddResultDialog(this)" /> </cell> Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2011-01-21 14:06:14 UTC (rev 534) @@ -130,6 +130,7 @@ coser.ui.result.availableDataTitle=Available results \: coser.ui.result.cancel=Cancel coser.ui.result.creationDate=Result date \: +coser.ui.result.editResult=Modify result coser.ui.result.estComIndFile=ESTCOMind file \: coser.ui.result.estPopIndFile=ESTPOPind file \: coser.ui.result.extractDataButton=Extract as Rsufi format @@ -138,7 +139,7 @@ coser.ui.result.mapsDirectory=Maps directory \: coser.ui.result.newResult=New Result coser.ui.result.otherDataFile=Other files \: -coser.ui.result.publishResult=Publish \: +coser.ui.result.publishResult=Publiable \: coser.ui.result.requiredestComIndPath=ESTCOMind file is required coser.ui.result.requiredestPopIndPath=ESTPOPind file is required coser.ui.result.requiredname=Result name is required @@ -150,6 +151,7 @@ coser.ui.result.table.estPopIndFile=ESTPOPind file coser.ui.result.table.resultName=Result name coser.ui.result.table.rsufiVersion=RSufi Version +coser.ui.result.validEditResult=Modify result coser.ui.result.validNewResult=Add this result coser.ui.result.zone=Zone \: coser.ui.selection.allSpecies=L1 \: All species (%d/%d) Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties =================================================================== --- trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2011-01-20 10:54:12 UTC (rev 533) +++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2011-01-21 14:06:14 UTC (rev 534) @@ -130,6 +130,7 @@ coser.ui.result.availableDataTitle=R\u00E9sultats disponibles coser.ui.result.cancel=Annuler coser.ui.result.creationDate=Date du r\u00E9sultats \: +coser.ui.result.editResult=Modifier le r\u00E9sultat coser.ui.result.estComIndFile=Fichier ESTCOMind \: coser.ui.result.estPopIndFile=Fichier ESTPOPind \: coser.ui.result.extractDataButton=Extraire au format RSufi @@ -138,7 +139,7 @@ coser.ui.result.mapsDirectory=R\u00E9pertoire des cartes \: coser.ui.result.newResult=Nouveau r\u00E9sultat coser.ui.result.otherDataFile=Autre fichiers \: -coser.ui.result.publishResult=Publication \: +coser.ui.result.publishResult=Publiable \: coser.ui.result.requiredestComIndPath=Le fichier ESTCOMind est requis coser.ui.result.requiredestPopIndPath=Le fichier ESTPOPind est requis coser.ui.result.requiredname=Le nom du r\u00E9sultat est requis @@ -150,6 +151,7 @@ coser.ui.result.table.estPopIndFile=Fichier ESTPOPind coser.ui.result.table.resultName=Nom du r\u00E9sultat coser.ui.result.table.rsufiVersion=Version de RSufi +coser.ui.result.validEditResult=Modifier le r\u00E9sultat coser.ui.result.validNewResult=Ajouter le r\u00E9sultat coser.ui.result.zone=Zone \: coser.ui.selection.allSpecies=L1 \: Toutes les esp\u00E8ces (%d/%d)