This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 0581284d42a7f6989b6c71bb5c8df329411dc9f7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Jul 19 17:56:39 2016 +0200 Suppression du code sur l'import gps --- .../main/java/fr/ird/observe/ui/ObserveMainUI.jaxx | 1 - .../main/java/fr/ird/observe/ui/ObserveMainUI.jcss | 4 - .../java/fr/ird/observe/ui/admin/AdminStep.java | 21 - .../java/fr/ird/observe/ui/admin/AdminUIModel.java | 41 -- .../fr/ird/observe/ui/admin/config/ConfigUI.jaxx | 6 - .../fr/ird/observe/ui/admin/config/ConfigUI.jcss | 6 - .../observe/ui/admin/gps/GPSAbleTableModel.java | 162 ------ .../ui/admin/gps/GPSActivityTableModel.java | 302 ---------- .../observe/ui/admin/gps/ImportGPSConfigUI.jaxx | 93 ---- .../observe/ui/admin/gps/ImportGPSConfigUI.jcss | 69 --- .../ird/observe/ui/admin/gps/ImportGPSModel.java | 105 ---- .../fr/ird/observe/ui/admin/gps/ImportGPSUI.jaxx | 145 ----- .../fr/ird/observe/ui/admin/gps/ImportGPSUI.jcss | 66 --- .../observe/ui/admin/gps/ImportGPSUIHandler.java | 607 --------------------- 14 files changed, 1628 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx index 9c5bbb9..e97816a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jaxx @@ -170,7 +170,6 @@ void $afterCompleteSetup() { <JMenuItem id='menuActionsSynchronize'/> <JMenuItem id='menuActionsValidateData'/> <JMenuItem id='menuActionsExportData'/> - <JMenuItem id='menuActionsImportGPS'/> <JMenuItem id='menuActionsReport'/> <JMenuItem id='menuActionsConsolidate'/> </JMenu> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jcss b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jcss index 40e16b7..50f53e1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jcss +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUI.jcss @@ -216,10 +216,6 @@ JSplitPane { action: {new fr.ird.observe.ui.actions.LaunchAdminAction(this, AdminStep.EXPORT_DATA)}; } -#menuActionsImportGPS { - action: {new fr.ird.observe.ui.actions.LaunchAdminAction(this, AdminStep.IMPORT_GPS)}; -} - #menuActionsReport { action: {new fr.ird.observe.ui.actions.LaunchAdminAction(this, AdminStep.REPORT)}; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminStep.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminStep.java index 39b1f08..41032c0 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminStep.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminStep.java @@ -29,8 +29,6 @@ import fr.ird.observe.ui.admin.consolidate.ConsolidateModel; import fr.ird.observe.ui.admin.consolidate.ConsolidateUI; import fr.ird.observe.ui.admin.export.ExportModel; import fr.ird.observe.ui.admin.export.ExportUI; -import fr.ird.observe.ui.admin.gps.ImportGPSModel; -import fr.ird.observe.ui.admin.gps.ImportGPSUI; import fr.ird.observe.ui.admin.report.ReportModel; import fr.ird.observe.ui.admin.report.ReportUI; import fr.ird.observe.ui.admin.resume.ShowResumeUI; @@ -161,25 +159,6 @@ public enum AdminStep implements WizardExtStep { DbMode.USE_SERVER ), - /** pour l'import GPS */ - IMPORT_GPS( - n("observe.synchro.step.importGPS"), - n("observe.synchro.step.importGPS.description"), - n("observe.title.importGPS"), - n("observe.title.importGPS.tip"), - "importGPS", - n("observe.synchro.operation.importGPS"), - n("observe.synchro.operation.importGPS.description"), - ImportGPSModel.class, - ImportGPSUI.class, - false, - false, - false, - false, - DbMode.USE_LOCAL, - DbMode.USE_REMOTE - ), - /** pour effectuer les modifications vers la base locale */ SAVE_LOCAL( n("observe.synchro.step.saveLocal"), diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminUIModel.java index d0af9d5..9e74a0d 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminUIModel.java @@ -45,7 +45,6 @@ import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.services.service.seine.TripSeineService; import fr.ird.observe.ui.admin.consolidate.ConsolidateModel; import fr.ird.observe.ui.admin.export.ExportModel; -import fr.ird.observe.ui.admin.gps.ImportGPSModel; import fr.ird.observe.ui.admin.report.ReportModel; import fr.ird.observe.ui.admin.save.SaveLocalModel; import fr.ird.observe.ui.admin.synchronize.SynchronizeModel; @@ -287,19 +286,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { } }; - PropertyChangeListener listenGPSModified = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("gps import model has changed [" + - evt.getPropertyName() + "] = " + - evt.getNewValue()); - } - validate(); - } - }; - PropertyChangeListener listenSaveLocalChanged = new PropertyChangeListener() { @Override @@ -551,13 +537,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { getSaveLocalModel().addPropertyChangeListener(listenSaveLocalChanged); } - if (containsOperation(AdminStep.IMPORT_GPS)) { - - getImportGPSModel().setImportGPSMaxDelay(config.getDefaultGpsMaxDelay()); - getImportGPSModel().setImportGPSMaxSpeed(config.getDefaultGpsMaxSpeed()); - getImportGPSModel().addPropertyChangeListener(listenGPSModified); - } - if (containsOperation(AdminStep.VALIDATE)) { getValidateModel().addPropertyChangeListener(listenValidationModified); @@ -913,10 +892,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { return (ValidateModel) getStepModel(AdminStep.VALIDATE); } - public ImportGPSModel getImportGPSModel() { - return (ImportGPSModel) getStepModel(AdminStep.IMPORT_GPS); - } - public SynchronizeModel getSynchronizeReferentielModel() { return (SynchronizeModel) getStepModel(AdminStep.SYNCHRONIZE); } @@ -1126,13 +1101,7 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { && centralSourceModel.getDataSourceInformation().canWriteData(); } - if (containsOperation(AdminStep.IMPORT_GPS)) { - // il faut le fichier d'import existe - File file = getImportGPSModel().getImportGPSFile(); - validate &= file != null && - file.exists(); - } if (containsOperation(AdminStep.REPORT)) { // il faut le fichier di'mport existe @@ -1210,11 +1179,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { case SYNCHRONIZE: validate = getStepState(s) == WizardState.SUCCESSED; break; - case IMPORT_GPS: - //FIXME - //validate &= getStepState(s) == - // WizardState.SUCCESSED; - break; case SAVE_LOCAL: // valide si l'action a ete executee avec success validate &= !getSaveLocalModel().isDoBackup() || @@ -1269,11 +1233,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { // pas de page de resume needResume = false; } - if (containsOperation(AdminStep.IMPORT_GPS)) { - - // ajout de l'onglet d'import GPS - universe.add(AdminStep.IMPORT_GPS); - } updateSaveLocalOperation(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jaxx index b040681..53ec2b9 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jaxx @@ -99,12 +99,6 @@ public void addMessage(AdminStep step, String text) { </row> <row> <cell> - <JCheckBox id='IMPORT_GPS' - onItemStateChanged='getHandler().updateOperationState((JCheckBox)event.getSource())'/> - </cell> - </row> - <row> - <cell> <JCheckBox id='CONSOLIDATE' onItemStateChanged='getHandler().updateOperationState((JCheckBox)event.getSource())'/> </cell> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jcss b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jcss index a1bf87f..772b991 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jcss +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/config/ConfigUI.jcss @@ -60,12 +60,6 @@ toolTipText:{AdminStep.EXPORT_DATA.getDescription()}; } -#IMPORT_GPS { - selected:{getHandler().isOperationSelected(model.getOperations(), IMPORT_GPS)}; - text:{AdminStep.IMPORT_GPS.getLabel()}; - toolTipText:{AdminStep.IMPORT_GPS.getDescription()}; -} - #CONSOLIDATE { selected:{getHandler().isOperationSelected(model.getOperations(), CONSOLIDATE)}; text:{AdminStep.CONSOLIDATE.getLabel()}; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSAbleTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSAbleTableModel.java deleted file mode 100644 index e09bdce..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSAbleTableModel.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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.ird.observe.ui.admin.gps; - -import fr.ird.observe.util.gps.GPSAble; -import org.nuiton.i18n.I18n; - -import javax.swing.table.AbstractTableModel; - -/** - * Le modèle pour la tableau dans l'import GPS qui contient les activités et les - * points gps calculés via le fichier gps importé. - * - * @author Tony Chemit - chemit@codelutin.com - */ -public class GPSAbleTableModel extends AbstractTableModel { - - protected static final String[] COLUMN_NAMES = { - I18n.n("observe.synchro.common.quadrant"), - I18n.n("observe.synchro.common.latitude"), - I18n.n("observe.synchro.common.longitude") -// I18n.n("observe.synchro.common.vitesse") - }; - - protected static final Class<?>[] COLUMN_CLASSES = { - Integer.class, - Float.class, - Float.class -// Float.class - }; - - private static final long serialVersionUID = 1L; - - protected final int columns; - - protected GPSAble[] data; - - public GPSAbleTableModel(int columns) { - this.columns = columns; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return false; - } - - public void init(GPSAble... gpsable) { - data = gpsable; - fireTableDataChanged(); - } - - public void clear() { - data = null; - } - - @Override - public int getRowCount() { - return COLUMN_CLASSES.length; - } - - @Override - public int getColumnCount() { - return columns; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - Object value = null; - GPSAble p = data == null ? null : data[columnIndex]; - if (p != null) { - switch (rowIndex) { - case 0: - value = p.getQuadrant(); - break; - case 1: - value = p.getLatitude() == null ? - null : Math.abs(p.getLatitude()); - break; - case 2: - value = p.getLongitude() == null ? - null : Math.abs(p.getLongitude()); - break; -// case 3: -// value = p.getVitesse(); -// break; - default: - throw new IllegalStateException( - "can not get value for row " + rowIndex + - ", col " + columnIndex); - } - } - return value; - } - - public String getTextValueAt(int rowIndex, int columnIndex) { - Object value = null; - - String text = ""; - switch (rowIndex) { - case 0: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Integer) value == 0) { - text = I18n.t("observe.common.undefined"); - } else { - text = I18n.t("observe.common.quadrant" + value); - } - break; - case 1: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; - case 2: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; -// case 3: -// value = getValueAt(rowIndex, columnIndex); -// if (value == null || ((Float) value) == 0.0f) { -// text = I18n.t("observe.common.undefined"); -// } else { -// text = value + ""; -// } -// break; - default: - throw new IllegalStateException("can not get value for " + - "column " + columnIndex); - } - return text; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - // no editable - } -} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSActivityTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSActivityTableModel.java deleted file mode 100644 index cd94a5e..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/GPSActivityTableModel.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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.ird.observe.ui.admin.gps; - -import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.util.gps.GPSPoint; -import fr.ird.observe.services.dto.seine.ActivitySeineDto; -import org.nuiton.decorator.Decorator; -import org.nuiton.i18n.I18n; - -import javax.swing.table.AbstractTableModel; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -/** - * Le modèle pour la tableau dans l'import GPS qui contient les activités et les - * points gps calculés via le fichier gps importé. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 1.0 - */ -public class GPSActivityTableModel extends AbstractTableModel { - - protected static final String[] COLUMN_NAMES = { - I18n.n("observe.synchro.common.select"), - I18n.n("observe.synchro.common.activity"), - I18n.n("observe.synchro.common.quadrant"), - I18n.n("observe.synchro.common.latitude"), - I18n.n("observe.synchro.common.longitude"), - I18n.n("observe.synchro.common.vitesse") - }; - - protected static final Class<?>[] COLUMN_CLASSES = { - Boolean.class, - ActivitySeineDto.class, - Integer.class, - Float.class, - Float.class, - Float.class - }; - - private static final long serialVersionUID = 1L; - - protected List<Entry<ActivitySeineDto, GPSPoint>> entries; - - protected Set<Integer> selected; - - protected boolean selectAll; - - protected Decorator<?> decorator; - - public GPSActivityTableModel() { - selected = new HashSet<>(); - decorator = ObserveSwingApplicationContext.get().getDecoratorService().getDecorator(ActivitySeineDto.class, - "gps-activity"); - } - - @Override - public Class<?> getColumnClass(int columnIndex) { - return COLUMN_CLASSES[columnIndex]; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return columnIndex == 0; - } - - public void init(Map<ActivitySeineDto, GPSPoint> entries) { - // on nettoye toujours le model lors de l'init d'une entité - this.entries = new ArrayList<>( - entries.entrySet()); - selected.clear(); - // par defaut, on selectionne toutes les references - setSelectAll(true); - //fireTableDataChanged(); - } - - public int[] getSelected() { - int[] result = new int[selected.size()]; - int i = 0; - for (Integer index : selected) { - result[i++] = index; - } - return result; - } - - public boolean hasSelection() { - return !selected.isEmpty(); - } - - @Override - public int getRowCount() { - return entries == null ? 0 : entries.size(); - } - - @Override - public int getColumnCount() { - return COLUMN_CLASSES.length; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - Object value = null; - GPSPoint p; - switch (columnIndex) { - case 0: - value = selected.contains(rowIndex); - break; - case 1: - value = getActivityAt(rowIndex); - break; - case 2: - p = getGPSPointAt(rowIndex); - value = p.getQuadrant(); - break; - case 3: - p = getGPSPointAt(rowIndex); - value = Math.abs(p.getLatitude()); - break; - case 4: - p = getGPSPointAt(rowIndex); - value = Math.abs(p.getLongitude()); - break; - case 5: - p = getGPSPointAt(rowIndex); - value = p.getVitesse(); - break; - default: - throw new IllegalStateException("can not get value for row " + - rowIndex + ", col " + - columnIndex); - } - return value; - } - - public String getTextValueAt(int rowIndex, int columnIndex) { - Object value = null; - - String text = ""; - GPSPoint p; - ActivitySeineDto a; - switch (columnIndex) { - case 0: - break; - case 1: - value = getValueAt(rowIndex, columnIndex); - text = decorator == null ? value + "" : - decorator.toString(value); - break; - case 2: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Integer) value == 0) { - text = I18n.t("observe.common.undefined"); - } else { - text = I18n.t("observe.common.quadrant" + value); - } - break; - case 3: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; - case 4: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; - case 5: - value = getValueAt(rowIndex, columnIndex); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = value + ""; - } - break; - case -2: - //FIXME -// value = getActivityAt(rowIndex).getQuadrant(); - if (value == null || (Integer) value == 0) { - text = I18n.t("observe.common.undefined"); - } else { - text = I18n.t("observe.common.quadrant" + value); - } - break; - case -3: - value = getActivityAt(rowIndex).getLatitude(); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; - case -4: - value = getActivityAt(rowIndex).getLongitude(); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = Math.abs((Float) value) + ""; - } - break; - case -5: - value = getActivityAt(rowIndex).getVesselSpeed(); - if (value == null || (Float) value == 0.0f) { - text = I18n.t("observe.common.undefined"); - } else { - text = value + ""; - } - break; - default: - throw new IllegalStateException("can not get value for " + - "column " + columnIndex); - } - return text; - } - - public ActivitySeineDto getActivityAt(int rowIndex) { - return entries.get(rowIndex).getKey(); - } - - public GPSPoint getGPSPointAt(int rowIndex) { - return entries.get(rowIndex).getValue(); - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - if (columnIndex == 0) { - Boolean value = (Boolean) aValue; - if (value) { - selected.add(rowIndex); - if (selected.size() == getRowCount()) { - selectAll = true; - } - } else { - selected.remove(rowIndex); - if (selected.isEmpty()) { - selectAll = false; - } - } - fireTableCellUpdated(rowIndex, columnIndex); - } - - // no edit for others columns - } - - public boolean isSelectAll() { - return selectAll; - } - - public void setSelectAll(boolean selectAll) { - this.selectAll = selectAll; - if (selectAll) { - for (int i = 0, max = getRowCount(); i < max; i++) { - selected.add(i); - } - } else { - selected.clear(); - } - fireTableDataChanged(); - } - - public void clear() { - selected.clear(); - if (entries != null) { - entries.clear(); - } - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - clear(); - } -} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jaxx deleted file mode 100644 index f33cc10..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jaxx +++ /dev/null @@ -1,93 +0,0 @@ -<!-- - #%L - ObServe :: Swing - %% - Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - %% - 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% - --> -<!-- ************************************************************* --> -<!-- La configuration de l'import GPS --> -<!-- ************************************************************* --> - -<Table id="importGPSConfig"> - - <import> - fr.ird.observe.configuration.ObserveSwingApplicationConfig - fr.ird.observe.ui.admin.AdminUIModel - - jaxx.runtime.swing.editor.NumberEditor - - java.io.File - - static fr.ird.observe.ui.UIHelper.getStringValue - </import> - - <ImportGPSUIHandler id='handler' - initializer='getContextValue(ImportGPSUIHandler.class)'/> - - <AdminUIModel id='model' initializer='getContextValue(AdminUIModel.class)'/> - - <ImportGPSModel id='gpsModel' initializer='model.getImportGPSModel()'/> - - <ObserveSwingApplicationConfig id='config' - initializer='getContextValue(ObserveSwingApplicationConfig.class)'/> - - <script><![CDATA[ -public void destroy() { - config = null; - model = null; - gpsModel = null; -} - -@Override -protected void finalize() throws Throwable { - super.finalize(); - destroy(); -} -]]> - </script> - - <row> - <cell anchor="west"> - <JLabel id='importGPSFileLabel'/> - </cell> - <cell weightx='1' fill="horizontal"> - <JTextField id="importGPSFile" - onKeyReleased='gpsModel.setImportGPSFile(new File(((JTextField)event.getSource()).getText()))'/> - </cell> - <cell anchor="east"> - <JButton id="importGPSGFileChooserAction" - onActionPerformed="getHandler().chooseImportGPSFile()"/> - </cell> - </row> - <row> - <cell anchor="east"> - <JLabel id='importGPSMaxDelayLabel'/> - </cell> - <cell weightx='1' fill="horizontal" columns="2"> - <NumberEditor id='importGPSMaxDelay' constructorParams='this'/> - </cell> - </row> - <row> - <cell anchor="east"> - <JLabel id='importGPSMaxSpeedLabel'/> - </cell> - <cell weightx='1' fill="horizontal" columns="2"> - <NumberEditor id='importGPSMaxSpeed' constructorParams='this'/> - </cell> - </row> -</Table> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jcss b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jcss deleted file mode 100644 index 475461b..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSConfigUI.jcss +++ /dev/null @@ -1,69 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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% - */ - -#importGPSConfig { - border:{new TitledBorder(t("observe.synchro.config.importGPS"))}; -} - -#importGPSFileLabel { - text:"observe.common.select.gps.import.file"; - toolTipText:"observe.common.select.gps.import.file.tip"; -} - -#importGPSFile { - text:{getStringValue(gpsModel.getImportGPSFile())}; -} - -#importGPSGFileChooserAction { - actionIcon:"fileChooser"; -} - -#importGPSMaxDelayLabel { - text:"observe.common.select.gps.maxDelay"; - toolTipText:"observe.common.select.gps.maxDelay.tip"; -} - -#importGPSMaxSpeedLabel { - text:"observe.common.select.gps.maxSpeed"; - toolTipText:"observe.common.select.gps.maxSpeed.tip"; -} - -#importGPSMaxDelay { - bean:{gpsModel}; - property:"importGPSMaxDelay"; - model:{gpsModel.getImportGPSMaxDelay()}; - autoPopup:{config.isAutoPopupNumberEditor()}; - showPopupButton:{config.isShowNumberEditorButton()}; - showReset:true; - numberPattern:{fr.ird.observe.ui.UIHelper.INT_6_DIGITS_PATTERN}; -} - -#importGPSMaxSpeed { - bean:{gpsModel}; - property:"importGPSMaxSpeed"; - model:{gpsModel.getImportGPSMaxSpeed()}; - autoPopup:{config.isAutoPopupNumberEditor()}; - showPopupButton:{config.isShowNumberEditorButton()}; - useFloat:true; - showReset:true; - numberPattern:{fr.ird.observe.ui.UIHelper.DECIMAL2_PATTERN}; -} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSModel.java deleted file mode 100644 index a4106c9..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSModel.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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.ird.observe.ui.admin.gps; - -import fr.ird.observe.ui.admin.AdminActionModel; -import fr.ird.observe.ui.admin.AdminStep; - -import java.io.File; - -/** - * Le modèle pour effectuer un import GPS. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 1.3 - */ -public class ImportGPSModel extends AdminActionModel { - - public static final String IMPORT_GPSFILE_PROPERTY_NAME = "importGPSFile"; - - public static final String IMPORT_GPSMAX_DELAY_PROPERTY_NAME = "importGPSMaxDelay"; - - public static final String IMPORT_GPSMAX_SPEED_PROPERTY_NAME = "importGPSMaxSpeed"; - - /** le temps (en minutes) maximum acceptable entre deux points GPS */ - protected Integer importGPSMaxDelay = 0; - - /** la vitesse (en noeud) maximale acceptable entre deux points GPS */ - protected Float importGPSMaxSpeed = 0.0f; - - /** le fichier d'import GPS */ - protected File importGPSFile = new File(""); - - /** les index des activités sélectionnées à modifier suite à import gps. */ - protected int[] importGPSSelectedIndex; - - public ImportGPSModel() { - super(AdminStep.IMPORT_GPS); - } - - public Integer getImportGPSMaxDelay() { - return importGPSMaxDelay; - } - - public void setImportGPSMaxDelay(Integer importGPSMaxDelay) { - Integer old = this.importGPSMaxDelay; - this.importGPSMaxDelay = importGPSMaxDelay; - firePropertyChange(IMPORT_GPSMAX_DELAY_PROPERTY_NAME, old, importGPSMaxDelay); - } - - public Float getImportGPSMaxSpeed() { - return importGPSMaxSpeed; - } - - public void setImportGPSMaxSpeed(Float importGPSMaxSpeed) { - Float old = this.importGPSMaxSpeed; - this.importGPSMaxSpeed = importGPSMaxSpeed; - firePropertyChange(IMPORT_GPSMAX_SPEED_PROPERTY_NAME, old, importGPSMaxSpeed); - } - - public File getImportGPSFile() { - return importGPSFile; - } - - public void setImportGPSFile(File importGPSFile) { - File old = this.importGPSFile; - this.importGPSFile = importGPSFile; - firePropertyChange(IMPORT_GPSFILE_PROPERTY_NAME, old, importGPSFile); - } - - public int[] getImportGPSSelectedIndex() { - return importGPSSelectedIndex; - } - - public void setImportGPSSelectedIndex(int[] importGPSSelectedIndex) { - this.importGPSSelectedIndex = importGPSSelectedIndex; - } - - public void destroy() { - super.destroy(); - importGPSFile = null; - importGPSMaxDelay = null; - importGPSMaxSpeed = null; - importGPSSelectedIndex = null; - } - -} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jaxx deleted file mode 100644 index bbc9ccc..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jaxx +++ /dev/null @@ -1,145 +0,0 @@ -<!-- - #%L - ObServe :: Swing - %% - Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - %% - 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% - --> - -<!-- ********************************************** --> -<!-- L'écran d'import GPS --> -<!-- ********************************************** --> - -<fr.ird.observe.ui.admin.AdminTabUI> - - <import> - fr.ird.observe.services.dto.seine.ActivitySeineDto - - fr.ird.observe.ui.admin.AdminUI - fr.ird.observe.ui.admin.AdminStep - - jaxx.runtime.swing.wizard.ext.WizardState - - java.awt.Dimension - - javax.swing.ListSelectionModel - javax.swing.JLabel - - static org.nuiton.i18n.I18n.t - </import> - - <ImportGPSUIHandler id='handler' constructorParams='this'/> - - <ActivitySeineDto id='selectedActivite' javaBean='new ActivitySeineDto()'/> - - <ImportGPSModel id='stepModel' - initializer='getModel().getImportGPSModel()'/> - - <!-- le modèle qui contient la liste des intervalles de point gps rejetés --> - <DefaultListModel id='invalidIntervalsModel'/> - - <!-- le modèles des activités dont on a pu calculé un point gps --> - <GPSActivityTableModel id='activitysModel' - onTableChanged='startAction.setEnabled(activitysModel.hasSelection())'/> - - <!-- le modèles du détail d'une activité dont on a pu calculé un point gps --> - <GPSAbleTableModel id='activityDetailModel' constructorParams='2'/> - - <!-- le modèle de sélection des activités --> - <DefaultListSelectionModel id='activitysSelectionModel' - onValueChanged='getHandler().updateDetail()'/> - - <script><![CDATA[ -public ImportGPSUI(AdminUI parentContext) { - super(AdminStep.IMPORT_GPS, parentContext); -} - -@Override -public void initUI(AdminUI ui) { - getHandler().initTabUI(ui, this); -} - -@Override -public void destroy() { - super.destroy(); - activitysModel.clear(); - activityDetailModel.clear(); - invalidIntervalsModel.removeAllElements(); -} - -@Override -public void updateState(WizardState newState) { - getHandler().updateState(this, newState); -} -]]> - </script> - - <JPanel id='PENDING_content' layout='{new BorderLayout()}'> - <Table constraints='BorderLayout.CENTER' fill='both' weightx='1' - weighty='1'> - <row> - <cell> - <JButton id="prepareAction" - onActionPerformed="getHandler().doPrepareAction()"/> - </cell> - </row> - </Table> - </JPanel> - - <JPanel id='NEED_FIX_content'> - - <Table fill='both' weightx='1' constraints='BorderLayout.CENTER'> - <row> - <cell weighty="0.8"> - <JSplitPane id="split"> - <Table fill='both' weightx='1' weighty='1'> - <row> - <cell> - - <!-- la liste des activitys qui ont un point gps calculé --> - <JScrollPane id="activitysPane"> - <JTable id='activitys'/> - </JScrollPane> - </cell> - </row> - </Table> - - <!-- détail d'une activité --> - <JScrollPane> - <JTable id='activityDetail'/> - </JScrollPane> - </JSplitPane> - </cell> - </row> - <row> - <cell weighty="0.2"> - - <!-- la liste des intervalles de points rejetés --> - <JScrollPane id='invalidIntervalsListPane'> - <JList id='invalidIntervalsList'/> - </JScrollPane> - </cell> - </row> - </Table> - - <JPanel constraints='BorderLayout.SOUTH' layout='{new BorderLayout()}'> - <JButton id='startAction' constraints='BorderLayout.CENTER' - onActionPerformed="getHandler().doStartAction()"/> - </JPanel> - </JPanel> - -</fr.ird.observe.ui.admin.AdminTabUI> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jcss b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jcss deleted file mode 100644 index 6229794..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUI.jcss +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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% - */ - -#activitysSelectionModel { - selectionMode:{ListSelectionModel.SINGLE_SELECTION}; -} - -#prepareAction { - actionIcon:"wizard-start"; -} - -#startAction { - actionIcon:"save"; -} - -#NEED_FIX_content { - layout:{new BorderLayout()}; -} - -#split { - orientation:{JSplitPane.VERTICAL_SPLIT}; - oneTouchExpandable:true; - resizeWeight:0.8; -} - -#activitysPane { - columnHeaderView:{activitys.getTableHeader()}; - verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#activitys { - model:{activitysModel}; - selectionModel:{activitysSelectionModel}; -} - -#activityDetail { - model:{activityDetailModel}; -} - -#invalidIntervalsListPane { - columnHeaderView:{new JLabel(t("observe.synchro.importGPS.invalidIntervals.list"))}; - minimumSize:{new Dimension(0,0)}; -} - -#invalidIntervalsList { - model:{invalidIntervalsModel}; -} diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUIHandler.java deleted file mode 100644 index 704490a..0000000 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/gps/ImportGPSUIHandler.java +++ /dev/null @@ -1,607 +0,0 @@ -/* - * #%L - * ObServe :: Swing - * %% - * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit - * %% - * 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.ird.observe.ui.admin.gps; - -import fr.ird.observe.util.gps.GPSPoint; -import fr.ird.observe.util.gps.GPSPointInterval; -import fr.ird.observe.util.gps.GPSRoute; -import fr.ird.observe.db.ObserveSwingDataSource; -import fr.ird.observe.services.dto.seine.ActivitySeineDto; -import fr.ird.observe.services.dto.seine.TripSeineDto; -import fr.ird.observe.ui.DecoratorService; -import fr.ird.observe.ui.UIHelper; -import fr.ird.observe.ui.admin.AdminStep; -import fr.ird.observe.ui.admin.AdminTabUIHandler; -import fr.ird.observe.ui.admin.AdminUI; -import fr.ird.observe.ui.admin.config.ConfigUI; -import jaxx.runtime.context.JAXXInitialContext; -import jaxx.runtime.swing.editor.MyDefaultCellEditor; -import jaxx.runtime.swing.renderer.BooleanCellRenderer; -import jaxx.runtime.swing.wizard.ext.WizardState; -import org.apache.commons.collections.primitives.ArrayIntList; -import org.apache.commons.collections.primitives.IntIterator; -import org.apache.commons.collections.primitives.IntList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.Decorator; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListSelectionModel; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JTable; -import javax.swing.table.DefaultTableCellRenderer; -import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.File; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * Le controleur des onglets. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 1.4 - */ -public class ImportGPSUIHandler extends AdminTabUIHandler { - - /** Logger */ - private static final Log log = LogFactory.getLog(ImportGPSUIHandler.class); - - - /** un drapeau pour savoir si on a deja initialise l'action */ - protected boolean wasInit; - - /** la route ouverte */ - protected TripSeineDto openTripSeine; - - /** la route gps */ - protected GPSRoute route; - - /** - * la correspondance des points gps sur les activités (si pas de point gps - * correspondant à une marée alors la valeur sera nulle - * (data.get(a)==null). - */ - protected Map<ActivitySeineDto, GPSPoint> data; - - protected ObserveSwingDataSource source; - - protected Decorator<ActivitySeineDto> dActivity; - - protected Decorator<GPSPoint> dGPSPoint; - - public ImportGPSUIHandler(ImportGPSUI ui) { - super(ui); - } - - @Override - public ImportGPSUI getUi() { - return (ImportGPSUI) super.getUi(); - } - - public void initTabUI(AdminUI ui, ImportGPSUI tabUI) { - - super.initTabUI(ui, tabUI); - - if (log.isDebugEnabled()) { - log.debug(" specialized for [" + tabUI.getStep() + "] for main ui " + ui.getClass().getName() + "@" + System.identityHashCode(ui)); - } - - tabUI.getPrepareAction().setText(t("observe.action.synchro.prepare.operation", t(tabUI.getStep().getOperationLabel()))); - tabUI.getStartAction().setText(t("observe.action.synchro.apply.modifications")); - - // initialisation de l'ui de configuration - if (log.isInfoEnabled()) { - log.info("Init extra configuration for " + tabUI.getName()); - } - - ConfigUI configUI = (ConfigUI) ui.getStepUI(AdminStep.CONFIG); - JAXXInitialContext tx = new JAXXInitialContext().add(configUI).add(this); - - ImportGPSConfigUI extraConfig = new ImportGPSConfigUI(tx); - - extraConfig.getImportGPSMaxDelay().init(); - extraConfig.getImportGPSMaxSpeed().init(); - - configUI.getExtraConfig().add(extraConfig); - - DefaultListCellRenderer listRenderer = new DefaultListCellRenderer() { - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - comp.setToolTipText(comp.getText()); - return comp; - } - }; - tabUI.getInvalidIntervalsList().setCellRenderer(listRenderer); - - // tableau de l'import GPS des activitys - - final JTable table2 = tabUI.getActivitys(); - table2.setRowHeight(24); - UIHelper.fixTableColumnWidth(table2, 0, 20); - UIHelper.fixTableColumnWidth(table2, 2, 75); - UIHelper.fixTableColumnWidth(table2, 3, 75); - UIHelper.fixTableColumnWidth(table2, 4, 75); - UIHelper.fixTableColumnWidth(table2, 5, 75); - - UIHelper.setI18nTableHeaderRenderer( - table2, - n("observe.synchro.table.importGPS.activity.select"), - n("observe.synchro.table.importGPS.activity.select.tip"), - n("observe.synchro.table.importGPS.activity.label"), - n("observe.synchro.table.importGPS.activity.label.tip"), - n("observe.synchro.table.importGPS.activity.quadrant"), - n("observe.synchro.table.importGPS.activity.quadrant.tip"), - n("observe.synchro.table.importGPS.activity.latitude"), - n("observe.synchro.table.importGPS.activity.latitude.tip"), - n("observe.synchro.table.importGPS.activity.longitude"), - n("observe.synchro.table.importGPS.activity.longitude.tip"), - n("observe.synchro.table.importGPS.activity.vitesse"), - n("observe.synchro.table.importGPS.activity.vitesse.tip")); - - DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer(); - - tabUI.setContextValue(renderer2, "defaultTableRenderer"); - - DefaultTableCellRenderer renderer3 = new DefaultTableCellRenderer() { - private static final long serialVersionUID = 1L; - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - int modelColumn = table.convertColumnIndexToModel(column); - int modelRow = table.convertRowIndexToModel(row); - Object o = table.getModel().getValueAt(modelRow, modelColumn); - String text = ((GPSActivityTableModel) table.getModel()).getTextValueAt(modelRow, modelColumn); - String text2 = text; - if (o == null) { - text2 = t("observe.common.undefined.tip"); - } - JComponent c = (JComponent) super.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); - String tip = null; - switch (modelColumn) { - case 0: - break; - case 1: - tip = t("observe.common.activity") + " : " + text; - break; - case 2: - tip = t("observe.synchro.table.importGPS.activity.quadrant.tip") + " : " + text2; - break; - case 3: - tip = t("observe.synchro.table.importGPS.activity.latitude.tip") + " : " + text2; - break; - case 4: - tip = t("observe.synchro.table.importGPS.activity.longitude.tip") + " : " + text2; - break; - case 5: - tip = t("observe.synchro.table.importGPS.activity.vitesse.tip") + " : " + text2; - break; - } - c.setToolTipText(tip); - return c; - } - }; - - UIHelper.setTableColumnRenderer(table2, 0, new BooleanCellRenderer(renderer2)); - UIHelper.setTableColumnRenderer(table2, 1, renderer3); - UIHelper.setTableColumnRenderer(table2, 2, renderer3); - UIHelper.setTableColumnRenderer(table2, 3, renderer3); - UIHelper.setTableColumnRenderer(table2, 4, renderer3); - UIHelper.setTableColumnRenderer(table2, 5, renderer3); - UIHelper.setTableColumnEditor(table2, 0, MyDefaultCellEditor.newBooleanEditor(false)); - - // pour tout selectionner - deselectionner dans l'entete du tableau - table2.getTableHeader().addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - - int colIndex = table2.getTableHeader().columnAtPoint(e.getPoint()); - colIndex = table2.convertColumnIndexToModel(colIndex); - if (colIndex == 0) { - GPSActivityTableModel model = (GPSActivityTableModel) table2.getModel(); - boolean oldValue = model.isSelectAll(); - // toggle selectAll - model.setSelectAll(!oldValue); - } - } - }); - - // tableau du detail d'un import GPS sur une activity - - JTable table3 = tabUI.getActivityDetail(); - UIHelper.setI18nTableHeaderRenderer( - table3, - n("observe.synchro.table.importGPS.data.label"), - n("observe.synchro.table.importGPS.data.label.tip"), - n("observe.synchro.table.importGPS.computed.label"), - n("observe.synchro.table.importGPS.computed.label.tip")); - DefaultTableCellRenderer renderer4 = new DefaultTableCellRenderer() { - private static final long serialVersionUID = 1L; - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - int modelColumn = table.convertColumnIndexToModel(column); - int modelRow = table.convertRowIndexToModel(row); - GPSAbleTableModel model = (GPSAbleTableModel) table.getModel(); - Object o = model.getValueAt(modelRow, modelColumn); - String text = model.getTextValueAt(modelRow, modelColumn); - String text2 = text; - if (o == null) { - text2 = t("observe.common.undefined.tip"); - } - JComponent c = (JComponent) super.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); - String tip = null; - switch (modelRow) { - case 0: - tip = t("observe.synchro.table.importGPS.activity.quadrant.tip") + " : " + text2; - break; - case 1: - tip = t("observe.synchro.table.importGPS.activity.latitude.tip") + " : " + text2; - break; - case 2: - tip = t("observe.synchro.table.importGPS.activity.longitude.tip") + " : " + text2; - break; -// case 3: -// tip = t("observe.synchro.table.importGPS.activity.vitesse.tip") + " : "+ text2; -// break; - } - c.setToolTipText(tip); - return c; - } - }; - UIHelper.setTableColumnRenderer(table3, 0, renderer4); - UIHelper.setTableColumnRenderer(table3, 1, renderer4); - } - - public void updateState(ImportGPSUI tabUI, WizardState newState) { - super.updateState(tabUI, newState); - if (newState == WizardState.NEED_FIX) { - // met a jour la liste des intervalles invalides - GPSRoute route = getRoute(); - tabUI.invalidIntervalsModel.removeAllElements(); - if (route.getRejectedInterval().isEmpty()) { - tabUI.invalidIntervalsModel.addElement(t("observe.message.importGPS.no.invalid.interval")); - } else { - for (GPSPointInterval i : route.getRejectedInterval()) { - tabUI.invalidIntervalsModel.addElement(i); - } - } - tabUI.activitysModel.init(getData()); - if (tabUI.activitysModel.getRowCount() > 0) { - // on sélectionne la premier activity choisi - tabUI.activitysSelectionModel.setSelectionInterval(0, 0); - } - tabUI.split.resetToPreferredSizes(); - return; - } - if (newState == WizardState.RUNNING) { - - } - } - - public void updateDetail() { - ImportGPSUI tabUI = getUi(); - DefaultListSelectionModel selectionModel = tabUI.activitysSelectionModel; - int row = selectionModel.getAnchorSelectionIndex(); - if (log.isDebugEnabled()) { - log.debug("row : " + row); - } - GPSAbleTableModel tableModel = tabUI.activityDetailModel; - if (row == -1) { - tableModel.clear(); - } else { - GPSActivityTableModel activityTableModel = tabUI.activitysModel; - //FIXME -// tableModel.init(activityTableModel.getActivityAt(row), activityTableModel.getGPSPointAt(row)); - } - } - - public void doPrepareAction() { - - addAdminWorker( - getUi().getPrepareAction().getToolTipText(), - new Callable<WizardState>() { - @Override - public WizardState call() throws Exception { - return prepareAction(); - } - }); - } - - public void doStartAction() { - - ImportGPSUI tabUI = getUi(); - - - int[] rows = tabUI.getActivitysModel().getSelected(); - tabUI.getStepModel().setImportGPSSelectedIndex(rows); - - addAdminWorker( - tabUI.getStartAction().getToolTipText(), - new Callable<WizardState>() { - @Override - public WizardState call() throws Exception { - return doAction(); - } - }); - } - - public WizardState prepareAction() throws Exception { - if (log.isDebugEnabled()) { - log.debug(this); - } - - DecoratorService dService = getDecoratorService(); - - dActivity = dService.getDecoratorByType(ActivitySeineDto.class, "activity-gps"); - dGPSPoint = dService.getDecoratorByType(GPSPoint.class, "gpsPoint-gps"); - - source = model.getSafeLocalSource(false); - - // ouverture de la base locale - openSource(source); - - // récuperation de la marée ouverte - //FIXME -// TopiaContext srcCtxt = beginTransaction(source, "beforeAction"); -// try { -// openTripSeine = OpenableEntities.getOpenTrip(srcCtxt); -// } catch (TopiaException e) { -// closeTransaction(source, srcCtxt, "beforeAction"); -// } - - if (openTripSeine == null) { - // pas de route ouverte - sendMessage(t("observe.message.no.open.maree.detected")); - return WizardState.FAILED; - } - - //FIXME -// if (openTripSeine.isRouteEmpty()) { -// // pas de route sur la maree ouverte -// sendMessage(t("observe.message.no.route.detected")); -// return WizardState.FAILED; -// } - //FIXME -// for (RouteDto r : openTripSeine.getRoute()) { -// if (!r.isActivitySeineEmpty()) { -// // on enregistre les actitives -// for (ActivitySeine a : r.getActivitySeine()) { -// data.put(a, null); -// } -// } -// } - - if (data.isEmpty()) { - // pas d'activity a traiter - sendMessage(t("observe.message.no.activity.detected")); - return WizardState.FAILED; - } - - ImportGPSModel gpsModel = model.getImportGPSModel(); - // construction de la route gps - sendMessage(t("observe.message.importGPS.prepare.importFile", - gpsModel.getImportGPSFile(), - gpsModel.getImportGPSMaxDelay(), - gpsModel.getImportGPSMaxSpeed())); - - // FIXME -// route = getGpsService().buildRoute( -// gpsModel.getImportGPSFile(), -// gpsModel.getImportGPSMaxDelay(), -// gpsModel.getImportGPSMaxSpeed()); - - List<GPSPointInterval> acceptedInterval = route.getAcceptedInterval(); - - if (acceptedInterval == null || acceptedInterval.isEmpty()) { - // pas d'intervalle acceptable - sendMessage(t("observe.message.no.accepted.intervalle.detected")); - return WizardState.FAILED; - } - - for (GPSPointInterval i : acceptedInterval) { - sendMessage(t("observe.message.detected.accepted.interval", i)); - } - - for (GPSPointInterval i : route.getRejectedInterval()) { - sendMessage(t("observe.message.detected.rejected.interval", i)); - } - - - // il s'agit de la première passe : detection des point gps - //des activitys - sendMessage(t("observe.message.importGPS.detect.points")); - - detectPoints(); - - if (data.isEmpty()) { - // aucune activity modifiable - sendMessage(t("observe.message.importGPS.nothing.to.do")); - sendMessage(t("observe.message.synchro.operation.done", new Date())); - return WizardState.SUCCESSED; - } - - sendMessage(t("observe.message.importGPS.operation.needFix", new Date())); - - return WizardState.NEED_FIX; - } - - public WizardState doAction() throws Exception { - - // seconde passe - // on applique les modifications suivant le choix de l'utilisateur - - sendMessage(t("observe.message.importGPS.apply.points")); - - ImportGPSModel importModel = model.getImportGPSModel(); - - if (importModel.getImportGPSSelectedIndex() == null || - importModel.getImportGPSSelectedIndex().length == 0) { - // aucune activity selectionnee - // rien selectionner, rien a faire - sendMessage(t("observe.message.importGPS.nothing.to.do")); - sendMessage(t("observe.message.importGPS.no.activity.selected")); - - } else { - - applyPoints(); - } - - sendMessage(t("observe.message.synchro.operation.done", new Date())); - - return WizardState.SUCCESSED; - } - - - public Map<ActivitySeineDto, GPSPoint> getData() { - return data; - } - - public GPSRoute getRoute() { - return route; - } - - /** detection des points gps pour les activitys trouvees. */ - protected void detectPoints() { - - Set<ActivitySeineDto> rejected = new HashSet<>(); - for (ActivitySeineDto a : data.keySet()) { - - Date time = a.getTime(); - sendMessage(t("observe.message.importGPS.detect.point", dActivity.toString(a))); - GPSPoint point = route.getPoint(time); - if (point == null) { - sendMessage(t("observe.message.importGPS.no.detected.point")); - rejected.add(a); - } else { - sendMessage(t("observe.message.importGPS.detected.point", dGPSPoint.toString(point))); - data.put(a, point); - } - } - - // on supprime toutes les activités qui n'ont pas été acceptées - for (ActivitySeineDto a : rejected) { - data.remove(a); - } - } - - protected void applyPoints() throws Exception { - - int[] selectedIndex = model.getImportGPSModel().getImportGPSSelectedIndex(); - - IntList lIndex = new ArrayIntList(selectedIndex.length); - - String txName = "applyPoints"; - //FIXME -// TopiaContext ctxt = beginTransaction(source, txName); - - try { - - for (int i : selectedIndex) { - lIndex.add(i); - } - IntIterator indexItr = lIndex.iterator(); - - int currentActivityIndex = 0; - int nextActivityIndex = indexItr.next(); - - //FIXME -// TopiaDAO<ActivitySeine> activityDAO = source.getDAO(ctxt, ActivitySeine.class); - for (ActivitySeineDto a : data.keySet()) { - if (currentActivityIndex == nextActivityIndex) { - // l'activity courante a ete selectionne - GPSPoint p = data.get(a); - - sendMessage(t("observe.message.importGPS.apply.point", dGPSPoint.toString(p), dActivity.toString(a))); -// sendMessage(t("observe.message.importGPS.apply.point", p, a.getVesselActivity().getLabel2())); - float latitude = Math.abs(p.getLatitude()); - float longitude = Math.abs(p.getLongitude()); - int quadrant = p.getQuadrant(); - // application de la position - - //FIXME -// ActivitySeineDto aa = activityDAO.findByTopiaId(a.getTopiaId()); -// aa.setLatitude(latitude); -// aa.setLongitude(longitude); -// aa.setQuadrant(quadrant); - //TODO appliquer la vitesse ? - //a.setVesselSpeed(p.getVitesse()); - - // mise a jour de l'activity - - //FIXME -// activityDAO.update(aa); -// a.update(); - - if (indexItr.hasNext()) { - // il reste au moins une activity a traiter - // recuperation du prochain index d'activity a traiter - nextActivityIndex = indexItr.next(); - } else { - // plus d'activity a traiter - break; - } - } - currentActivityIndex++; - } - - //FIXME -// commitTransaction(source, ctxt, txName); - } catch (Exception e) { - //FIXME -// rollbackTransaction(source, ctxt, txName); - throw e; - } finally { - - //FIXME -// closeTransaction(source, ctxt, txName); - lIndex.clear(); - } - } - - public void chooseImportGPSFile() { - ImportGPSModel gpsModel = getModel().getImportGPSModel(); - File f = UIHelper.chooseFile( - ui, - t("observe.title.choose.importGPS"), - t("observe.action.choose.importGPS"), - gpsModel.getImportGPSFile(), - "^.+\\.gpx$", - t("observe.action.choose.importGPS.description")); - gpsModel.setImportGPSFile(f); - } - -} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.