You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <de...@us...> - 2015-10-09 19:53:35
|
Revision: 9184 http://sourceforge.net/p/fudaa/svn/9184 Author: deniger Date: 2015-10-09 19:53:32 +0000 (Fri, 09 Oct 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java trunk/soft/fudaa-crue/ui-study/src/main/java/org/fudaa/fudaa/crue/study/services/TableExportCommentSupplier.java Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java 2015-10-09 19:53:24 UTC (rev 9183) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java 2015-10-09 19:53:32 UTC (rev 9184) @@ -203,6 +203,8 @@ toolbar.add(new CourbeVisibiltyUIAction(graphe).buildToolButton(EbliComponentFactory.INSTANCE)); EGTableAction tableAction = (EGTableAction) getActions("TABLE").get(0); tableAction.setAddOptions(false); + tableAction.setAddCheckbox(true); + tableAction.setShowColumnToExport(false); tableAction.setDisplayAll(true); PopupMenuReceiver popupTable = createLoiPoupReceiver(); popupTable.install(tableGraphePanel.getTable(), CtuluUIForNetbeans.DEFAULT); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-10-09 19:53:24 UTC (rev 9183) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-10-09 19:53:32 UTC (rev 9184) @@ -21,6 +21,8 @@ public ReportLongitudinalCourbesUiResController() { EGTableAction tableAction = (EGTableAction) getActions("TABLE").get(0); tableAction.setAddOptions(false); + tableAction.setAddCheckbox(true); + tableAction.setShowColumnToExport(false); tableAction.setDisplayAll(true); tableAction.setShowLabel(true); setUseVariableForAxeH(true); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java 2015-10-09 19:53:24 UTC (rev 9183) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java 2015-10-09 19:53:32 UTC (rev 9184) @@ -21,6 +21,8 @@ public ReportTemporalCourbesUiResController() { EGTableAction tableAction = (EGTableAction) getActions("TABLE").get(0); tableAction.setAddOptions(false); + tableAction.setAddCheckbox(true); + tableAction.setShowColumnToExport(false); tableAction.setDisplayAll(true); tableAction.setShowLabel(true); } Modified: trunk/soft/fudaa-crue/ui-study/src/main/java/org/fudaa/fudaa/crue/study/services/TableExportCommentSupplier.java =================================================================== --- trunk/soft/fudaa-crue/ui-study/src/main/java/org/fudaa/fudaa/crue/study/services/TableExportCommentSupplier.java 2015-10-09 19:53:24 UTC (rev 9183) +++ trunk/soft/fudaa-crue/ui-study/src/main/java/org/fudaa/fudaa/crue/study/services/TableExportCommentSupplier.java 2015-10-09 19:53:32 UTC (rev 9184) @@ -4,10 +4,10 @@ package org.fudaa.fudaa.crue.study.services; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.fudaa.dodico.crue.common.BusinessMessages; import org.openide.util.Lookup; -import org.openide.util.NbBundle; /** * @@ -23,6 +23,10 @@ } public List<String> getComments(String type) { + //pour tests uniquement + if (crueService == null) { + return Collections.emptyList(); + } if (post) { return Arrays.asList( BusinessMessages.getString("ExportFichierEtu") + ": " + crueService.getEtuFileLoaded().getAbsolutePath(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-09 19:53:26
|
Revision: 9183 http://sourceforge.net/p/fudaa/svn/9183 Author: deniger Date: 2015-10-09 19:53:24 +0000 (Fri, 09 Oct 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableColumnHeader.java trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableSortModel.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt Added Paths: ----------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -13,8 +13,6 @@ import java.io.Reader; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; import org.apache.commons.lang.StringUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableColumnHeader.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableColumnHeader.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableColumnHeader.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -164,6 +164,7 @@ w = computePreferredWidth(getTable(), _column, i); _column.setMaxWidth(Integer.MAX_VALUE); _column.setPreferredWidth(w); + _column.setWidth(w); } } Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableSortModel.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableSortModel.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableSortModel.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -8,6 +8,7 @@ package org.fudaa.ctulu.table; import com.memoire.bu.BuTableSortModel; +import org.apache.commons.lang.StringUtils; /** * @author fred deniger @@ -15,9 +16,9 @@ */ public class CtuluTableSortModel extends BuTableSortModel { - protected final int compareNumberRowsByColumn(final int _row1,final int _row2,final int _col){ - final Object o1 = model_.getValueAt(_row1, _col); - final Object o2 = model_.getValueAt(_row2, _col); + protected final int compareNumberRowsByColumn(final int _row1, final int _row2, final int _col) { + final Object o1 = model_.getValueAt(_row1, _col); + final Object o2 = model_.getValueAt(_row2, _col); if ((o1 == null) && (o2 == null)) { return 0; @@ -26,8 +27,12 @@ } else if (o2 == null) { return 1; } - final double d1 = ((Number) o1).doubleValue(); - final double d2 = ((Number) o2).doubleValue(); + Class clazz = model_.getColumnClass(_col); + if (String.class.equals(clazz) || Number.class.isAssignableFrom(clazz)) { + return o1.toString().compareTo(o2.toString()); + } + final double d1 = ((Number) o1).doubleValue(); + final double d2 = ((Number) o2).doubleValue(); if (d1 < d2) { return -1; @@ -39,21 +44,20 @@ } @Override - public int compare(final int _row1,final int _row2){ + public int compare(final int _row1, final int _row2) { compares++; - final int nc = model_.getRowCount(); + final int nc = model_.getRowCount(); - for (int i = 0; i < nbcols_; i++) - //for(int i=nbcols_-1;i>=0;i--) + for (int i = 0; i < nbcols_; i++) //for(int i=nbcols_-1;i>=0;i--) { - final int c = columns_[i]; + final int c = columns_[i]; if ((c < 0) || (c >= nc)) { continue; } int s = Number.class.isAssignableFrom(model_.getColumnClass(c)) ? compareNumberRowsByColumn( - _row1, _row2, c) : compareRowsByColumn(_row1, _row2, c); + _row1, _row2, c) : compareRowsByColumn(_row1, _row2, c); if (descending_[i]) { s = -s; } Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -12,20 +12,17 @@ package org.fudaa.ctulu.gui; import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuGlassPaneStop; -import com.memoire.bu.BuLib; import com.memoire.bu.BuList; import com.memoire.bu.BuPreferences; import com.memoire.bu.BuRadioButton; import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuTable; import gnu.trove.TIntArrayList; -import java.awt.Cursor; import java.awt.Point; import java.awt.Window; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; -import java.text.DecimalFormat; import javax.swing.AbstractListModel; import javax.swing.ButtonGroup; import javax.swing.JDialog; @@ -34,49 +31,54 @@ import javax.swing.ListSelectionModel; import javax.swing.table.TableColumn; import org.apache.commons.lang.StringUtils; -import org.fudaa.ctulu.CsvWriter; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel.TypeChoosen; -import org.fudaa.ctulu.table.CtuluTableCsvWriter; -import org.fudaa.ctulu.table.CtuluTableExcelWriter; import org.fudaa.ctulu.table.CtuluTableExportInterface; -import org.fudaa.ctulu.table.CtuluTableModelDefault; -import org.fudaa.ctulu.table.CtuluTableModelInterface; -import org.fudaa.ctulu.table.CtuluTableXlsxWriter; -import org.jdesktop.swingx.JXTreeTable; /** * @author DENIGER */ @SuppressWarnings("serial") public final class CtuluTableExportPanel extends CtuluDialogPanel implements ItemListener { - + private static final char DEFAULT_SEPARATOR = '\t'; JList cbModel_; BuRadioButton cbOnlySelected_; - File dest_; - TypeChoosen choosenType_; - final JTable table_; - final CtuluUI ui_; + + final CtuluTableExportTask exportTask; JDialog parentDial_; char separator = '\t'; - + + public static void setShowColumnsToExport(final BuTable _b, final boolean _show) { + _b.putClientProperty("TABLE_SHOW_COLUMNS_TO_EXPORT", Boolean.valueOf(_show)); + } + + public static boolean isshowColumnToExport(final JTable _b) { + final Boolean res = (Boolean) _b.getClientProperty("TABLE_SHOW_COLUMNS_TO_EXPORT"); + return res == null ? true : res.booleanValue(); + } + public static void showExportDialog(final char separator, final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui) { showExportDialog(separator, _table, _dest, type, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + public static void showExportDialog(final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui, final Window windowParent) { showExportDialog('\t', _table, _dest, type, _ui, windowParent); } - + public static void showExportDialog(final char separator, final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui, final Window windowParent) { + if (!isshowColumnToExport(_table)) { + CtuluTableExportTask task = new CtuluTableExportTask(_table, _ui, type, _dest); + task.setSeparator(separator); + task.export(null, null); + return; + } final CtuluTableExportPanel pn = new CtuluTableExportPanel(_table, _dest, type, _ui); pn.separator = separator; final CtuluDialog dial = CtuluDialogPanel.createDialog(windowParent, pn); @@ -88,11 +90,11 @@ CtuluDialogPreferences.saveComponentLocationAndDimension(dial, BuPreferences.BU, "exportExcelDialog"); BuPreferences.BU.writeIniFile(); } - + public static void doExport(final JTable _t, final CtuluUI _ui, final Window _f) { doExport(DEFAULT_SEPARATOR, _t, _ui, _f); } - + public static void doExport(final char separator, final JTable _t, final CtuluUI _ui, final Window _f) { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui); String defaultDir = BuPreferences.BU.getStringProperty("export.excel.lastPath", null); @@ -100,7 +102,7 @@ File dir = new File(defaultDir); if (dir.exists() && dir.isDirectory()) { choose.setCurrentDirectory(dir); - + } } final File f = choose.getDestFile(); @@ -115,32 +117,29 @@ } CtuluTableExportPanel.showExportDialog(separator, _t, f, choose.getTypeChoosen(), _ui); } - + public static void doExport(char separator, final JTable _t, final CtuluUI _ui) { doExport(separator, _t, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + public static void doExport(final JTable _t, final CtuluUI _ui) { doExport('\t', _t, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + @SuppressWarnings("serial") private CtuluTableExportPanel(final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui) { super(false); setLayout(new BuBorderLayout(5, 5)); - table_ = _table; - dest_ = _dest; - ui_ = _ui; - choosenType_ = type; + exportTask = new CtuluTableExportTask(_table, _ui, type, _dest); cbModel_ = new BuList(); final TIntArrayList exportableColumns = new TIntArrayList(); CtuluTableExportInterface exportInterface = null; - if (table_.getModel() instanceof CtuluTableExportInterface) { - exportInterface = (CtuluTableExportInterface) table_.getModel(); + if (_table.getModel() instanceof CtuluTableExportInterface) { + exportInterface = (CtuluTableExportInterface) _table.getModel(); } - - for (int i = 0; i < table_.getColumnCount(); i++) { - final TableColumn column = table_.getColumnModel().getColumn(i); + + for (int i = 0; i < _table.getColumnCount(); i++) { + final TableColumn column = _table.getColumnModel().getColumn(i); boolean toAdd = true; if (exportInterface != null) { toAdd = exportInterface.isColumnExportable(column.getModelIndex()); @@ -152,9 +151,9 @@ cbModel_.setModel(new AbstractListModel() { @Override public Object getElementAt(final int _index) { - return table_.getColumnName(exportableColumns.get(_index)); + return exportTask.getTable().getColumnName(exportableColumns.get(_index)); } - + @Override public int getSize() { return exportableColumns.size(); @@ -164,7 +163,7 @@ final BuRadioButton col = new BuRadioButton(CtuluLib.getS("Exporter les colonnes suivantes:")); bg.add(col); add(col, BuBorderLayout.NORTH); - final boolean isCellSelected = !table_.getSelectionModel().isSelectionEmpty(); + final boolean isCellSelected = !exportTask.getTable().getSelectionModel().isSelectionEmpty(); add(new BuScrollPane(cbModel_), BuBorderLayout.CENTER); cbModel_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); cbModel_.getSelectionModel().setSelectionInterval(0, cbModel_.getModel().getSize() - 1); @@ -178,7 +177,7 @@ col.setSelected(true); add(cbOnlySelected_, BuBorderLayout.SOUTH); } - + @Override public String getHelpText() { String msg = CtuluLib.getS("Vous pouvez s\xE9lectionner les colonnes \xE0 exporter"); @@ -190,24 +189,25 @@ msg += "<br>" + CtuluLib.getS("Par d\xE9faut, toutes les colonnes sont s\xE9lectionn\xE9es pour l'exportation."); return "<html><body>" + msg + "</body></html>"; } - + protected void nothingToExport() { - ui_.warn(CtuluResource.CTULU.getString("Exportation annul\xE9e"), CtuluResource.CTULU.getString("Ancune donn\xE9e n'a \xE9t\xE9 s\xE9lectionn\xE9e"), false); + exportTask.getUi().warn(CtuluResource.CTULU.getString("Exportation annul\xE9e"), CtuluResource.CTULU.getString("Ancune donn\xE9e n'a \xE9t\xE9 s\xE9lectionn\xE9e"), + false); } - + @Override public void apply() { int[] col = null; int[] row = null; if (cbOnlySelected_.isSelected()) { - col = table_.getSelectedColumns(); - if (!table_.getColumnSelectionAllowed()) { - col = new int[table_.getColumnCount()]; + col = exportTask.getTable().getSelectedColumns(); + if (!exportTask.getTable().getColumnSelectionAllowed()) { + col = new int[exportTask.getTable().getColumnCount()]; for (int i = 0; i < col.length; i++) { col[i] = i; } } - row = table_.getSelectedRows(); + row = exportTask.getTable().getSelectedRows(); if ((col == null || row == null) || (row.length == 0 || col.length == 0)) { nothingToExport(); return; @@ -224,95 +224,18 @@ col = null; } } - final BuGlassPaneStop s = new BuGlassPaneStop(); - //on enleve les colonnes non exportables - if (table_.getModel() instanceof CtuluTableExportInterface) { - CtuluTableExportInterface exportInterface = (CtuluTableExportInterface) table_.getModel(); - final TIntArrayList toExport = new TIntArrayList(); - if (col == null) { - for (int i = 0; i < table_.getColumnCount(); i++) { - final TableColumn column = table_.getColumnModel().getColumn(i); - boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); - if (toAdd) { - toExport.add(i); - } - } - } else { - for (int i = 0; i < col.length; i++) { - final TableColumn column = table_.getColumnModel().getColumn(col[i]); - boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); - if (toAdd) { - toExport.add(i); - } - } - } - col = toExport.toNativeArray(); - } - final int[] colToWrite = col; - final int[] rowToWrite = row; - parentDial_.setGlassPane(s); - parentDial_.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - s.setVisible(true); - final CtuluTaskDelegate task = ui_.createTask(CtuluLib.getS("Export format texte")); - task.start(new Runnable() { - @Override - public void run() { - final CtuluTableModelInterface m = createDefaultModele(colToWrite, rowToWrite); - try { - if (TypeChoosen.XLS.equals(choosenType_)) { - final CtuluTableExcelWriter w = new CtuluTableExcelWriter(m, dest_); - w.write(task.getStateReceiver()); - } else if (TypeChoosen.XLSX.equals(choosenType_)) { - final CtuluTableXlsxWriter w = new CtuluTableXlsxWriter(m, dest_); - w.write(task.getStateReceiver()); - } else { - int nbDigits = BuPreferences.BU.getIntegerProperty(CtuluTablePreferencesComponent.COORDS_EXPORT_NB_DIGITS, -1); - DecimalFormat fmt; - if (nbDigits == -1) { - fmt = null; - } else { - fmt = CtuluLib.getDecimalFormat(); - fmt.setMaximumFractionDigits(nbDigits); - } - final CtuluTableCsvWriter w = new CtuluTableCsvWriter(new CsvWriter(dest_), m, separator, fmt); - w.write(task.getStateReceiver()); - } - } catch (final Exception e) { - ui_.error(dest_.getName(), e.getLocalizedMessage(), false); - } - BuLib.invokeLater(new Runnable() { - @Override - public void run() { - s.setVisible(false); - parentDial_.getRootPane().remove(s); - parentDial_.setCursor(Cursor.getDefaultCursor()); - ui_.message(CtuluResource.CTULU.getString("Export termin\xE9"), CtuluResource.CTULU.getString("Donn\xE9es export\xE9es dans le fichier\n {0}", - dest_. - getAbsolutePath()), false); - } - }); - - } - - private CtuluTableModelInterface createDefaultModele(final int[] colToWrite, final int[] rowToWrite) { - if (table_ instanceof JXTreeTable) { - return new CtuluTreeTableModelDefault((JXTreeTable) table_, colToWrite, - rowToWrite); - } - return new CtuluTableModelDefault(table_, colToWrite, rowToWrite); - } - }); + exportTask.export(col, row); } - + @Override public void itemStateChanged(final ItemEvent _e) { cbModel_.setEnabled(!cbOnlySelected_.isSelected()); } - + public JDialog getParentDial() { return parentDial_; } - + public void setParentDial(final JDialog _parentDial) { parentDial_ = _parentDial; } Added: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java (rev 0) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -0,0 +1,165 @@ +/* + GPL 2 + */ +package org.fudaa.ctulu.gui; + +import com.memoire.bu.BuGlassPaneStop; +import com.memoire.bu.BuLib; +import com.memoire.bu.BuPreferences; +import gnu.trove.TIntArrayList; +import java.awt.Cursor; +import java.io.File; +import static java.io.File.separator; +import java.text.DecimalFormat; +import javax.swing.JDialog; +import javax.swing.JTable; +import javax.swing.table.TableColumn; +import org.fudaa.ctulu.CsvWriter; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.CtuluTaskDelegate; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.table.CtuluTableCsvWriter; +import org.fudaa.ctulu.table.CtuluTableExcelWriter; +import org.fudaa.ctulu.table.CtuluTableExportInterface; +import org.fudaa.ctulu.table.CtuluTableModelDefault; +import org.fudaa.ctulu.table.CtuluTableModelInterface; +import org.fudaa.ctulu.table.CtuluTableXlsxWriter; +import org.jdesktop.swingx.JXTreeTable; + +/** + * + * @author Frederic Deniger + */ +public class CtuluTableExportTask { + + private final JTable table_; + private final CtuluUI ui_; + private final CtuluFileChooserCsvExcel.TypeChoosen choosenType_; + private final File dest_; + private JDialog parentDial_; + private char separator = '\t'; + + public CtuluTableExportTask(JTable table_, CtuluUI ui_, CtuluFileChooserCsvExcel.TypeChoosen choosenType_, File dest_) { + this.table_ = table_; + this.ui_ = ui_; + this.choosenType_ = choosenType_; + this.dest_ = dest_; + } + + public JTable getTable() { + return table_; + } + + public CtuluUI getUi() { + return ui_; + } + + public CtuluFileChooserCsvExcel.TypeChoosen getChoosenType() { + return choosenType_; + } + + public File getDest() { + return dest_; + } + + public JDialog getParentDial() { + return parentDial_; + } + + public char getSeparator() { + return separator; + } + + public void setParentDial(JDialog parentDial_) { + this.parentDial_ = parentDial_; + } + + public void setSeparator(char separator) { + this.separator = separator; + } + + private CtuluTableModelInterface createDefaultModele(final int[] colToWrite, final int[] rowToWrite) { + if (table_ instanceof JXTreeTable) { + return new CtuluTreeTableModelDefault((JXTreeTable) table_, colToWrite, + rowToWrite); + } + return new CtuluTableModelDefault(table_, colToWrite, rowToWrite); + } + + public void export(int[] col, int[] row) { + final BuGlassPaneStop s = new BuGlassPaneStop(); + //on enleve les colonnes non exportables + if (table_.getModel() instanceof CtuluTableExportInterface) { + CtuluTableExportInterface exportInterface = (CtuluTableExportInterface) table_.getModel(); + final TIntArrayList toExport = new TIntArrayList(); + if (col == null) { + for (int i = 0; i < table_.getColumnCount(); i++) { + final TableColumn column = table_.getColumnModel().getColumn(i); + boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); + if (toAdd) { + toExport.add(i); + } + } + } else { + for (int i = 0; i < col.length; i++) { + final TableColumn column = table_.getColumnModel().getColumn(col[i]); + boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); + if (toAdd) { + toExport.add(i); + } + } + } + col = toExport.toNativeArray(); + } + final int[] colToWrite = col; + final int[] rowToWrite = row; + if (parentDial_ != null) { + parentDial_.setGlassPane(s); + parentDial_.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } + s.setVisible(true); + final CtuluTaskDelegate task = ui_.createTask(CtuluLib.getS("Export format texte")); + task.start(new Runnable() { + @Override + public void run() { + final CtuluTableModelInterface m = createDefaultModele(colToWrite, rowToWrite); + try { + if (CtuluFileChooserCsvExcel.TypeChoosen.XLS.equals(choosenType_)) { + final CtuluTableExcelWriter w = new CtuluTableExcelWriter(m, dest_); + w.write(task.getStateReceiver()); + } else if (CtuluFileChooserCsvExcel.TypeChoosen.XLSX.equals(choosenType_)) { + final CtuluTableXlsxWriter w = new CtuluTableXlsxWriter(m, dest_); + w.write(task.getStateReceiver()); + } else { + int nbDigits = BuPreferences.BU.getIntegerProperty(CtuluTablePreferencesComponent.COORDS_EXPORT_NB_DIGITS, -1); + DecimalFormat fmt; + if (nbDigits == -1) { + fmt = null; + } else { + fmt = CtuluLib.getDecimalFormat(); + fmt.setMaximumFractionDigits(nbDigits); + } + final CtuluTableCsvWriter w = new CtuluTableCsvWriter(new CsvWriter(dest_), m, separator, fmt); + w.write(task.getStateReceiver()); + } + } catch (final Exception e) { + ui_.error(dest_.getName(), e.getLocalizedMessage(), false); + } + BuLib.invokeLater(new Runnable() { + @Override + public void run() { + s.setVisible(false); + if (parentDial_ != null) { + parentDial_.getRootPane().remove(s); + parentDial_.setCursor(Cursor.getDefaultCursor()); + } + ui_.message(CtuluResource.CTULU.getString("Export termin\xE9"), CtuluResource.CTULU.getString("Donn\xE9es export\xE9es dans le fichier\n {0}", + dest_. + getAbsolutePath()), true); + } + }); + } + }); + } +} Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -11,15 +11,18 @@ */ package org.fudaa.ebli.courbe; -import gnu.trove.TDoubleHashSet; import gnu.trove.TIntArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import jxl.write.Label; import jxl.write.Number; import jxl.write.WritableCell; +import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; @@ -168,10 +171,11 @@ private final static class SameH extends EGExportData { double[] time_; + List<String> labels; SameH(final EGCourbe[] _cs, final EGGraphe _g, boolean _onlyH, boolean showLabels) { super(_cs, _g, showLabels); - final TDoubleHashSet set = new TDoubleHashSet(); + Set<EGTimeLabel> set = new HashSet<EGTimeLabel>(); maxCol_ = cs_.length + 1; final EGAxeHorizontal h = g_.getTransformer().getXAxe(); for (int i = cs_.length - 1; i >= 0; i--) { @@ -179,27 +183,61 @@ for (int j = c.getModel().getNbValues() - 1; j >= 0; j--) { final double x = c.getModel().getX(j); if ((!_onlyH) || (h.containsPoint(x))) { - set.add(x); + EGTimeLabel value = new EGTimeLabel(x); + set.add(value); + value.setLabel(c.getModel().getPointLabel(j)); } } } - time_ = set.toArray(); + List<EGTimeLabel> values = new ArrayList<EGTimeLabel>(set); + Collections.sort(values); + time_ = new double[values.size()]; + for (int i = 0; i < time_.length; i++) { + time_[i] = values.get(i).getX(); + } Arrays.sort(time_); maxLine_ = time_.length; - column_ = new String[_cs.length + 1]; - column_[0] = h.getTitre(); + int nbCols = _cs.length + 1; + if (showLabels) { + nbCols++; + } + column_ = new String[nbCols]; + int offset = 0; + if (showLabels) { + offset = 1; + column_[0] = ""; + if (cs_.length > 0 && cs_[0].getModel() instanceof EgModelLabelNamed) { + column_[0] = ((EgModelLabelNamed) cs_[0].getModel()).getLabelColumnName(); + } + labels = new ArrayList<String>(); + for (EGTimeLabel value : values) { + labels.add(value.getLabel()); + } + } + column_[offset] = h.getTitre(); for (int i = 0; i < _cs.length; i++) { - column_[i + 1] = _cs[i].getTitle(); + column_[i + 1 + offset] = _cs[i].getTitle(); } } @Override public Object getValue(final int _row, final int _col) { final double x = time_[_row]; - if (_col == 0) { + int offset = 0; + if (showLabel) { + offset = 1; + if (_col == 0) { + if (_row < labels.size()) { + return labels.get(_row); + } + return ""; + + } + } + if (_col == offset) { return getXValueFor(x); } - return getYValueFor(cs_[_col - 1], cs_[_col - 1].interpol(x)); + return getYValueFor(cs_[_col - 1 - offset], cs_[_col - 1 - offset].interpol(x)); } } @@ -289,4 +327,4 @@ public final int getMaxRow() { return maxLine_; } -} \ No newline at end of file +} Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -12,10 +12,8 @@ package org.fudaa.ebli.courbe; import com.memoire.bu.BuMenu; -import com.memoire.bu.BuPreferences; import com.memoire.bu.BuResource; import com.memoire.bu.BuTable; -import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -25,6 +23,7 @@ import java.util.List; import java.util.Map; import javax.swing.AbstractButton; +import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JInternalFrame; @@ -32,14 +31,14 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; import org.fudaa.ctulu.gui.CtuluCellTextDecimalRenderer; -import org.fudaa.ctulu.gui.CtuluDialogPreferences; import org.fudaa.ctulu.gui.CtuluPopupMenu; +import org.fudaa.ctulu.gui.CtuluTableExportPanel; import org.fudaa.ctulu.gui.CtuluUIDialog; import org.fudaa.ctulu.table.CtuluTable; +import org.fudaa.ctulu.table.CtuluTableColumnHeader; import org.fudaa.ctulu.table.CtuluTableSortModel; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.commun.EbliPreferences; import org.fudaa.ebli.commun.EbliTableInfoPanel; import org.fudaa.ebli.commun.EbliTableInfoTarget; import org.fudaa.ebli.ressource.EbliResource; @@ -66,12 +65,32 @@ } boolean displayAll; boolean addOptions = true; + boolean addCheckbox = false; + //boolean utilise pour afficher ou pas le dialogue permettant d'afficher les colonnes a exporter + boolean showColumnToExport = false; boolean showLabel; public boolean isShowLabel() { return showLabel; } + public boolean isShowColumnToExport() { + return showColumnToExport; + } + + public void setShowColumnToExport(boolean showColumnToExport) { + this.showColumnToExport = showColumnToExport; + } + + + public boolean isAddCheckbox() { + return addCheckbox; + } + + public void setAddCheckbox(boolean addCheckbox) { + this.addCheckbox = addCheckbox; + } + public void setShowLabel(boolean showLabel) { this.showLabel = showLabel; } @@ -151,6 +170,7 @@ title = EbliResource.EBLI.getString("Courbes"); } EbliTableInfoPanel.setTitle(table, title); + List<JComponent> components = new ArrayList<JComponent>(); if (addOptions) { final BuMenu menu = new BuMenu(EbliLib.getS("Options"), "OPTIONS"); menu.setIcon(BuResource.BU.getMenuIcon("configurer")); @@ -173,9 +193,21 @@ } } }); - EbliTableInfoPanel.setJMenuBarComponents(table, new JComponent[]{menu}); + components.add(menu); } + if (addCheckbox) { + JCheckBox ch = new JCheckBox(EbliLib.getS("Factorisation des abscisses")); + ch.setActionCommand("SHOW_ONE_TIME"); + ch.addActionListener(new OptionActionListener(tableModel, table)); + components.add(ch); + } + + if (!components.isEmpty()) { + EbliTableInfoPanel.setJMenuBarComponents(table, components.toArray(new JComponent[components.size()])); + } + EbliTableInfoPanel.setShowSelectedRow(table, false); + CtuluTableExportPanel.setShowColumnsToExport(table, showColumnToExport); return table; } @@ -207,6 +239,9 @@ } else if ("SHOW_ONE_TIME".equals(com)) { Map<Object, TableCellRenderer> cellsRenderer = getCellsRenderer(); target_.setShowOneTime(((AbstractButton) _e.getSource()).isSelected()); + for (int i = 0; i < table_.getColumnCount(); i++) { + ((CtuluTableColumnHeader) table_.getTableHeader()).adjustWidth(table_.getColumnModel().getColumn(i)); + } putCellsRenderer(cellsRenderer); } if (idx > 0 && model != null) { Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java (rev 0) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -0,0 +1,68 @@ +/* + GPL 2 + */ +package org.fudaa.ebli.courbe; + +/** + * + * @author Frederic Deniger + */ +public class EGTimeLabel implements Comparable<EGTimeLabel> { + + private final double x; + private String label; + + public EGTimeLabel(double x) { + this.x = x; + } + + public String getLabel() { + return label; + } + + public double getX() { + return x; + } + + + public void setLabel(String label) { + this.label = label; + } + + @Override + public int compareTo(EGTimeLabel o) { + if (o == this) { + return 0; + } + if (o == null) { + return 1; + } + if (equals(o)) { + return 0; + } + return x - o.x > 0 ? 1 : -1; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 89 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32)); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final EGTimeLabel other = (EGTimeLabel) obj; + if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) { + return false; + } + return true; + } + +} Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-10-09 19:53:24 UTC (rev 9183) @@ -28,6 +28,7 @@ import javax.swing.table.TableModel; import com.memoire.bu.*; +import com.memoire.fu.FuLog; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; @@ -117,6 +118,7 @@ return res == null ? true : res.booleanValue(); } + /** * Enregistre le titre dans les propriete (putClientProperty) de la table. * @@ -148,6 +150,8 @@ public static void setShowSelectedRow(final BuTable _b, final boolean _show) { _b.putClientProperty("TABLE_SHOW_SELECTED_ROW", Boolean.valueOf(_show)); } + + final TableColumnModel colModel_; JDialog dialog_; boolean displaySelected_; @@ -329,8 +333,12 @@ copy(); } else if ("EXPORT_CSV".equals(_e.getActionCommand())) { table_.putClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY, null); - if (exportTableCommentSupplier != null) { - table_.putClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY, exportTableCommentSupplier.getComments()); + try { + if (exportTableCommentSupplier != null) { + table_.putClientProperty(CtuluTableModelInterface.EXPORT_COMMENT_PROPERTY, exportTableCommentSupplier.getComments()); + } + } catch (NullPointerException ex) { + FuLog.error(ex); } CtuluTableExportPanel.doExport(';', table_, ui_); Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-10-09 11:59:10 UTC (rev 9182) +++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-10-09 19:53:24 UTC (rev 9183) @@ -910,4 +910,5 @@ Mode contour=Contour mode Mode densit\xE9=Density mode Un calque \xE9ditable doit \xEAtre selectionn\xE9=An editable layer must be selected -Autom. zoom=Zoom auto \ No newline at end of file +Autom. zoom=Zoom auto +Factorisation des abscisses=Factoring abscissa \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-09 11:59:13
|
Revision: 9182 http://sourceforge.net/p/fudaa/svn/9182 Author: deniger Date: 2015-10-09 11:59:10 +0000 (Fri, 09 Oct 2015) Log Message: ----------- nouveau dico pour Fudaa-Prepro Modified Paths: -------------- trunk/soft/fudaa-prepro/ui/nbactions-release.xml trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/TrLauncherDefault.java trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacCommunParametres.java trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacSerafinHelper.java Modified: trunk/soft/fudaa-prepro/ui/nbactions-release.xml =================================================================== --- trunk/soft/fudaa-prepro/ui/nbactions-release.xml 2015-10-09 11:59:01 UTC (rev 9181) +++ trunk/soft/fudaa-prepro/ui/nbactions-release.xml 2015-10-09 11:59:10 UTC (rev 9182) @@ -1,2 +1,46 @@ <?xml version="1.0" encoding="UTF-8"?> -<actions /> +<actions> + <action> + <actionName>run</actionName> + <packagings> + <packaging>jar</packaging> + </packagings> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> + </goals> + <properties> + <exec.args>-classpath %classpath org.fudaa.fudaa.tr.Tr --no_log</exec.args> + <exec.executable>java</exec.executable> + </properties> + </action> + <action> + <actionName>debug</actionName> + <packagings> + <packaging>jar</packaging> + </packagings> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> + </goals> + <properties> + <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.fudaa.fudaa.tr.Tr --no_log</exec.args> + <exec.executable>java</exec.executable> + <jpda.listen>true</jpda.listen> + </properties> + </action> + <action> + <actionName>profile</actionName> + <packagings> + <packaging>jar</packaging> + </packagings> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> + </goals> + <properties> + <exec.args>-classpath %classpath org.fudaa.fudaa.tr.Tr --no_log</exec.args> + <exec.executable>java</exec.executable> + </properties> + </action> + </actions> Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/TrLauncherDefault.java 2015-10-09 11:59:01 UTC (rev 9181) +++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/TrLauncherDefault.java 2015-10-09 11:59:10 UTC (rev 9182) @@ -72,8 +72,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "1.3.0-RC9"; - infoSoft.date = "2015-08-24"; + infoSoft.version = "1.3.0-RC10"; + infoSoft.date = "2015-10-07"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2009"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacCommunParametres.java =================================================================== --- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacCommunParametres.java 2015-10-09 11:59:01 UTC (rev 9181) +++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacCommunParametres.java 2015-10-09 11:59:10 UTC (rev 9182) @@ -105,9 +105,8 @@ * TrTelemacParamsSavedData() {} public TrTelemacParamsSavedData(final boolean _isGeomFileSaved, final boolean * _isRepriseFileSaved) { super(); isGeomFileSaved_ = _isGeomFileSaved; isRepriseFileSaved_ = _isRepriseFileSaved; } } */ - TrTelemacCommunParametres(final TrImplementationEditorAbstract _ui, final H2dTelemacDicoParams _dicoParams, final File _f, final File _gridFile, - final TrTelemacCommunProjectListener _listener) { + final TrTelemacCommunProjectListener _listener) { super(_ui, _f, _dicoParams); params_ = new H2dTelemacParameters((H2dTelemacDicoParams) getDicoParams(), _listener); if (_gridFile != null) { @@ -116,13 +115,15 @@ } // TrTelemacSerafinBuilder serafinBuilder_; - TrTelemacSiActivator siActivator_; private synchronized boolean internloadGeometrie(final boolean _newProject, final boolean _useOlb, final int[] _ipobo, - final ProgressionInterface _prg) { + final ProgressionInterface _prg) { final DicoEntite entFile = getDicoFileFormatVersion().getMaillageEntiteFile(); if (entFile == null) { + if (!getDicoFileFormatVersion().isGridRequired()) { + return false; + } getUI().error(MvResource.getS("Fichier de maillage"), TrResource.getS("D\xE9finition du fichier g\xE9om\xE9trie non trouv\xE9e"), false); return false; } @@ -219,7 +220,7 @@ CtuluLibMessage.info("save Cl file in " + _f); } final CtuluIOOperationSynthese op = getDicoFileFormatVersion().getDefaultTelemacCLFormat(getDicoFileFormatVersion().getCodeName()).write(_f, - getTelemacParametres().getTelemacCLManager().createCLSourceInterface(), _prog); + getTelemacParametres().getTelemacCLManager().createCLSourceInterface(), _prog); return !ui_.manageErrorOperationAndIsFatal(op); } @@ -366,8 +367,8 @@ } /** - * @return le repertoire contenant le maillage. Si impossible, renvoie le repertoire du projet / the folder containing - * the mesh. If impossible, send the project folder + * @return le repertoire contenant le maillage. Si impossible, renvoie le repertoire du projet / the folder containing the mesh. If impossible, send + * the project folder */ public File getGridBaseDir() { final DicoEntite entFile = getDicoFileFormatVersion().getMaillageEntiteFile(); @@ -386,9 +387,8 @@ } /** - * Renvoie le maillage. Si nul, il est necessaire de charger le maillage Send the meshing. If nought, it is necessary - * to modify the meshing - * + * Renvoie le maillage. Si nul, il est necessaire de charger le maillage Send the meshing. If nought, it is necessary to modify the meshing + * * @return le maillage / the mesh */ public EfGridInterface getMaillage() { @@ -425,8 +425,7 @@ } /** - * @return true si un fichier de condition limite est utilise par ce logiciel / true if a file of boundary condition - * is used by this software + * @return true si un fichier de condition limite est utilise par ce logiciel / true if a file of boundary condition is used by this software */ public boolean isClSupported() { return getDicoFileFormatVersion().getCLEntiteFile() != null; @@ -435,7 +434,7 @@ @Override public boolean isGeometrieLoaded() { return getState().isLoaded(getDicoFileFormatVersion().getMaillageEntiteFile()) - || getState().isLoaded(getDicoFileFormatVersion().getRepriseFileKeyword()); + || getState().isLoaded(getDicoFileFormatVersion().getRepriseFileKeyword()); } public boolean isRepriseActivatedByUser() { @@ -608,7 +607,8 @@ getState().setLoaded(entFile, f, modified); if (modified) { getImpl().message(entFile.getNom(), - TrResource.getS("Certaines courbes temporelles ne sont pas assez \xE9tendues dans le temps" + "( cela sera automatiquement corrig\xE9)"), false); + TrResource.getS("Certaines courbes temporelles ne sont pas assez \xE9tendues dans le temps" + "( cela sera automatiquement corrig\xE9)"), + false); } // on verifie l'utilite de ce fichier // we check the useful of this list @@ -635,4 +635,4 @@ return getTelemacParametres().isTransientAvailable() && getTelemacParametres().getTelemacCLManager().isEvolutionUsed(); } -} \ No newline at end of file +} Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacSerafinHelper.java =================================================================== --- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacSerafinHelper.java 2015-10-09 11:59:01 UTC (rev 9181) +++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/telemac/TrTelemacSerafinHelper.java 2015-10-09 11:59:10 UTC (rev 9182) @@ -51,6 +51,7 @@ * @version $Id: TrTelemacSerafinHelper.java,v 1.16 2007-06-11 13:08:22 deniger Exp $ */ public class TrTelemacSerafinHelper extends TelemacVariableMapper { + private final TrTelemacCommunParametres params_; /** @@ -76,15 +77,17 @@ return null; } final CtuluIOOperationSynthese op = ((SerafinFileFormat) params_.getTelemacParametres().getTelemacVersion() - .getDefaultSerafinFormat()).readLast(_file, _prg); + .getDefaultSerafinFormat()).readLast(_file, _prg); final SerafinInterface serafinResults = (SerafinInterface) op.getSource(); - if (getUI().manageErrorOperationAndIsFatal(op)) { return null; } + if (getUI().manageErrorOperationAndIsFatal(op)) { + return null; + } // le maillage n'est pas conforme if (serafinResults != null) { final String diff = EfLib.isDiffQuick(serafinResults.getGrid(), params_.getMaillage()); if (diff != null) { getUI().error(getRepriseTitle(), - TrResource.getS("Le fichier de reprise n'est pas compatible") + CtuluLibString.LINE_SEP + diff, false); + TrResource.getS("Le fichier de reprise n'est pas compatible") + CtuluLibString.LINE_SEP + diff, false); return null; } } @@ -113,7 +116,9 @@ * @return si le fichier a ete simplifie */ public RepriseResults loadRepriseData(final ProgressionInterface _prg, final File _file, final Map _m) { - if (_m == null) { throw new IllegalArgumentException("map must not be null"); } + if (_m == null) { + throw new IllegalArgumentException("map must not be null"); + } final SerafinInterface serafinResults = readRepriseFile(_prg, _file); // le maillage n'a pas pu etre lu ou le maillage ne correspond pas if (serafinResults == null) { @@ -137,9 +142,9 @@ } // determineBathyForCI(t, messageBody); // les variables non support\xE9es - final H2dVariableType[] varsToRemove = new H2dVariableType[] { H2dVariableType.VITESSE, H2dVariableType.DEBIT, - H2dVariableType.DEBIT_NORMAL, H2dVariableType.DEBIT_TANGENTIEL, H2dVariableType.DEBIT_X, - H2dVariableType.DEBIT_Y }; + final H2dVariableType[] varsToRemove = new H2dVariableType[]{H2dVariableType.VITESSE, H2dVariableType.DEBIT, + H2dVariableType.DEBIT_NORMAL, H2dVariableType.DEBIT_TANGENTIEL, H2dVariableType.DEBIT_X, + H2dVariableType.DEBIT_Y}; for (int i = varsToRemove.length - 1; i >= 0; i--) { if (t.containsKey(varsToRemove[i])) { isVarRemoved = true; @@ -149,7 +154,7 @@ String msg = null; final RepriseResults r = new RepriseResults(); - r.initialDate=serafinResults.getIdate(); + r.initialDate = serafinResults.getIdate(); r.timeStep_ = serafinResults.getTimeStep(timeStep); // simplification du fichier de reprise if (isVarRemoved || isLastTimeKept) { @@ -160,12 +165,12 @@ } if (isVarRemoved) { msg += CtuluLibString.LINE_SEP + " -" - + TrResource.getS("les variables vitesses scalaires, d\xE9bit ont \xE9t\xE9 supprim\xE9es"); + + TrResource.getS("les variables vitesses scalaires, d\xE9bit ont \xE9t\xE9 supprim\xE9es"); } msg += CtuluLibString.LINE_SEP - + TrResource.getS("Si vous modifiez et sauvegardez les conditions initiales, " - + "ce nouveau fichier de reprise remplacera l'ancien."); + + TrResource.getS("Si vous modifiez et sauvegardez les conditions initiales, " + + "ce nouveau fichier de reprise remplacera l'ancien."); } // on charge les donn\xE9es // si.load(t, si.getRepriseFile(_dirBase), serafinResults.getTimeStep(timeStep)); @@ -227,12 +232,12 @@ public boolean isRepriseFileSetAndValid() { return params_.getDicoParams().isValueSetFor(getRepriseFileKw()) - && params_.getDicoParams().isValueValideFor(getRepriseFileKw()); + && params_.getDicoParams().isValueValideFor(getRepriseFileKw()); } public boolean isRepriseActivated() { return getRepriseBooleanKw() != null && params_.getDicoParams().isValueSetFor(getRepriseBooleanKw()) - && DicoDataType.Binaire.getValue(params_.getDicoParams().getValue(getRepriseBooleanKw())); + && DicoDataType.Binaire.getValue(params_.getDicoParams().getValue(getRepriseBooleanKw())); } /** @@ -301,7 +306,7 @@ _varDouble.put(H2dVariableType.COTE_EAU, new double[params_.getTelemacParametres().getMaillage().getPtsNb()]); } else { msgs - .add(TrResource.getS("La surface libre ne peut pas \xEAtre r\xE9cup\xE9r\xE9e. Elle est initialis\xE9e \xE0 partir du fond.")); + .add(TrResource.getS("La surface libre ne peut pas \xEAtre r\xE9cup\xE9r\xE9e. Elle est initialis\xE9e \xE0 partir du fond.")); _varDouble.put(H2dVariableType.COTE_EAU, new CtuluArrayDouble(bathy)); // on initialise avec cote=0; } @@ -347,7 +352,9 @@ getUI().setMainMessage(MvResource.getS("Lecture maillage")); final File f = _f; if (f == null) { - getUI().error(getGridTitle(), TrResource.getS("Le mot-cl\xE9 n'est pas renseign\xE9"), false); + if (getParams().getDicoFileFormatVersion().isGridRequired()) { + getUI().error(getGridTitle(), TrResource.getS("Le mot-cl\xE9 n'est pas renseign\xE9"), false); + } return null; } if (!f.exists()) { @@ -355,8 +362,10 @@ return null; } final CtuluIOOperationSynthese op = params_.getTelemacParametres().getTelemacVersion().getDefaultSerafinFormat() - .read(f, _prg); - if (getUI().manageErrorOperationAndIsFatal(op)) { return null; } + .read(f, _prg); + if (getUI().manageErrorOperationAndIsFatal(op)) { + return null; + } final SerafinInterface r = (SerafinInterface) op.getSource(); if (r.getGrid().getEltType() == EfElementType.T6) { getUI().error(getGridTitle(), TrResource.getS("Les maillages 3D ne sont pas support\xE9s"), false); @@ -443,7 +452,9 @@ public double getV(final Object _value, final int _ptIdx) { final int valueIdx = nameIdx_.get(_value); - if (valueIdx == oldVarIdx_) { return cache_[_ptIdx]; } + if (valueIdx == oldVarIdx_) { + return cache_[_ptIdx]; + } oldVarIdx_ = valueIdx; try { cache_ = ser_.getReadingInfo().getDouble(valueIdx, timeStep_); @@ -457,14 +468,16 @@ } public Map buildVariables(final SerafinInterface _serafin, final int _timeStep, final EfGridInterface _new, - final ProgressionInterface _prog) { - if (_new == null) { return buildVariables(_serafin, _timeStep, null); } + final ProgressionInterface _prog) { + if (_new == null) { + return buildVariables(_serafin, _timeStep, null); + } final Map nodalVal = new HashMap(); final int nb = _serafin.getValueNb(); final GridInterpolAdapter src = new GridInterpolAdapter(_serafin, _timeStep); final CtuluPermanentList allValues = src.getAllValues(); final InterpolationParameters params = new InterpolationParameters(allValues, new EfInterpolationTargetGridAdapter( - _new, false), src); + _new, false), src); params.setProg(_prog); params.createDefaultResults(); final InterpolationResultsHolderI res = params.getResults(); @@ -490,4 +503,4 @@ public TrTelemacCommunParametres getParams() { return params_; } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-28 20:26:40
|
Revision: 9180 http://sourceforge.net/p/fudaa/svn/9180 Author: deniger Date: 2015-09-28 20:26:37 +0000 (Mon, 28 Sep 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoCasReader.java trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoModelAbstract.java Modified: trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoCasReader.java =================================================================== --- trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoCasReader.java 2015-09-28 20:26:30 UTC (rev 9179) +++ trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoCasReader.java 2015-09-28 20:26:37 UTC (rev 9180) @@ -3,7 +3,7 @@ * @modification $Date: 2007-11-20 11:42:56 $ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne -* @mail de...@fu... + * @mail de...@fu... */ package org.fudaa.dodico.dico; @@ -40,36 +40,37 @@ public DicoCasReader(final DicoCasFileFormatVersionAbstract _t) { ft_ = _t; dico_ = ft_.getDico(); - if(dico_==null) { + if (dico_ == null) { throw new IllegalArgumentException(); } } - public void setFile(final File _f){ + public void setFile(final File _f) { analyze_ = new CtuluAnalyze(); analyze_.setResource(_f.getAbsolutePath()); try { in_ = new LineNumberReader(new FileReader(_f)); - } - catch (final FileNotFoundException e) { + } catch (final FileNotFoundException e) { in_ = null; } } /** * Test rapide pour savoir si le fichier _f contient des donnees valides. + * * @param _f le fichier a tester * @return true si fichier valide */ - public boolean testFile(final File _f){ + public boolean testFile(final File _f) { LineNumberReader l = null; String line; try { l = new LineNumberReader(new FileReader(_f)); String trimLine = null; + DicoModelAbstract otherLanguage = null; while ((line = l.readLine()) != null) { trimLine = line.trim(); - if ((trimLine.length() == 0) || (trimLine.charAt(0)=='/')) { + if ((trimLine.length() == 0) || (trimLine.charAt(0) == '/')) { continue; } final int indexEq = getEqualsIndex(trimLine); @@ -77,27 +78,35 @@ return false; } final String s = trimLine.substring(0, indexEq).trim(); + boolean isKey = dico_.isKey(s); + if (isKey) { + if (otherLanguage == null) { + otherLanguage = dico_.toOtherLanguage(); + } + //une cl\xE9 identique dans les 2 languages... + if (otherLanguage != null && otherLanguage.isKey(s)) { + continue; + } + } return dico_.isKey(s); } - } - catch (final IOException e) { + } catch (final IOException e) { //c'est un test rapdie donc on ne lance pas d'exception - } - finally { + } finally { if (l != null) { try { l.close(); - } - catch (final IOException e1) { + } catch (final IOException e1) { e1.printStackTrace(); } } } + return false; } - private DicoCasInterface readCas(){ + private DicoCasInterface readCas() { DicoCasResult inter = null; if (in_ == null) { analyze_.addFatalError(DicoResource.getS("Flux d'entr\xE9e non trouv\xE9")); @@ -117,41 +126,32 @@ //ligne vide on annule les commentaires if (quoteEnCours_) { splitLine(line, inter); - } - else if (line.trim().length() == 0) { - commentairesEnCours_=new StringBuffer(30); - } - else { + } else if (line.trim().length() == 0) { + commentairesEnCours_ = new StringBuffer(30); + } else { //commentaire - if (line.charAt(0)=='/') { + if (line.charAt(0) == '/') { if (commentairesEnCours_.length() > 0) { commentairesEnCours_.append(CtuluLibString.LINE_SEP); } commentairesEnCours_.append(line.substring(1)); - } - else if (line.startsWith(ft_.getCommandStop())) { + } else if (line.startsWith(ft_.getCommandStop())) { inter.setCommandStop(true); - } - else if (line.startsWith(ft_.getCommandStopProgram())) { + } else if (line.startsWith(ft_.getCommandStopProgram())) { inter.setCommandStopProgram(true); - } - else if (line.startsWith(ft_.getCommandPrintKeys())) { + } else if (line.startsWith(ft_.getCommandPrintKeys())) { inter.setPrintKeys(true); - } - else if (line.startsWith(ft_.getCommandPrintLongKeys())) { + } else if (line.startsWith(ft_.getCommandPrintLongKeys())) { inter.setPrintLongKeys(true); - } - else if (line.startsWith(ft_.getCommandPrintKeysValues())) { + } else if (line.startsWith(ft_.getCommandPrintKeysValues())) { inter.setPrintKeysValues(true); - } - else { + } else { splitLine(line, inter); } } //manageArray(inter_); } - } - catch (final IOException _ioe) { + } catch (final IOException _ioe) { analyze_.manageException(_ioe); } if (currentkey_ != null) { @@ -163,26 +163,23 @@ /** * Supprime les commentaires et les quotes ( et transforme les double en simple). */ - private void splitLine(final String _s,final DicoCasResult _m){ + private void splitLine(final String _s, final DicoCasResult _m) { final int l = _s.length(); final int index = _s.indexOf('\''); if (quoteEnCours_) { if (index < 0) { //add the quoted line for the next read appendValue(_s); - } - else if (index == l - 1) { + } else if (index == l - 1) { appendValue(_s.substring(0, l - 1)); endValue(_m); quoteEnCours_ = false; - } - else { + } else { final char c = _s.charAt(index + 1); if (c == '\'') { // Suppression des cotes doubl\xE9es appendValue(_s.substring(0, index + 1)); splitLine(_s.substring(index + 2), _m); - } - else { + } else { appendValue(_s.substring(0, index)); // B.M. 09/10/2007 - Appel supprime pour gerer les tableaux de chaine de Mascaret // endValue(_m); @@ -191,14 +188,13 @@ //sansCommentaire(_s.substring(index + 1)); } } - } - else { + } else { //l'indice du sigle de commentaire final int indexCom = _s.indexOf('/'); //no comment if (indexCom < 0) { if (index >= 0) { - final int equalIdx = getEqualsIndex(_s); + final int equalIdx = getEqualsIndex(_s); if (equalIdx > index) { addKeyOrValue(_s.substring(0, equalIdx), _m); splitLine(_s.substring(equalIdx + 1), _m); @@ -209,18 +205,16 @@ splitLine(_s.substring(index + 1), _m); } else { putStringInArray(_s, _m); - //comment after ' + //comment after ' } - } - else if ((index >= 0) && (index < indexCom)) { + } else if ((index >= 0) && (index < indexCom)) { putStringInArray(_s.substring(0, index), _m); quoteEnCours_ = true; splitLine(_s.substring(index + 1), _m); //a comment before ' - } - else { + } else { putStringInArray(_s.substring(0, indexCom), _m); - final int com2 = _s.indexOf('/', indexCom + 1); + final int com2 = _s.indexOf('/', indexCom + 1); if ((com2 < 0) || (com2 == l - 1)) { return; } @@ -233,7 +227,7 @@ * @param _s la ligne lue * @return l'index pour le caractere = ou :. -1 si non trouve */ - public int getEqualsIndex(final String _s){ + public int getEqualsIndex(final String _s) { final int i = _s.indexOf('='); if (i < 0) { return _s.indexOf(':'); @@ -248,7 +242,7 @@ return i; } - private void putStringInArray(final String _s,final DicoCasResult _m){ + private void putStringInArray(final String _s, final DicoCasResult _m) { final StringTokenizer tk = new StringTokenizer(_s, ":="); String t; while (tk.hasMoreTokens()) { @@ -256,9 +250,8 @@ if (t.length() > 0) { if (dico_.isKey(t)) { addKeyOrValue(t, _m); - } - else { - final int i = t.indexOf(' '); + } else { + final int i = t.indexOf(' '); if (i > 0) { addKeyOrValue(t.substring(0, i).trim(), _m); addKeyOrValue(t.substring(i + 1).trim(), _m); @@ -270,17 +263,16 @@ } } - private void endValue(final DicoCasResult _m){ + private void endValue(final DicoCasResult _m) { final String s = valueBuffer_.toString().trim(); if (currentkey_ == null) { analyze_.addError(DicoResource.getS("La valeur {0} est ignor\xE9e", s), in_); - } - else { + } else { _m.addKeyValue(currentkey_, s); - valueBuffer_=new StringBuffer(30); + valueBuffer_ = new StringBuffer(30); if (!currentkey_.isValide(s)) { analyze_.addError(DicoResource.getS("La valeur {0} est invalide pour le mot-cl\xE9 {1}", s, - currentkey_.getNom()), in_.getLineNumber()); + currentkey_.getNom()), in_.getLineNumber()); } //maj des commentaires if (commentaireFinal_ != null && commentaireFinal_.length() > 0) { @@ -291,26 +283,25 @@ } } - private void appendValue(final String _t){ + private void appendValue(final String _t) { valueBuffer_.append(_t); } String commentaireFinal_; - private void addKeyOrValue(final String _s,final DicoCasResult _m){ + private void addKeyOrValue(final String _s, final DicoCasResult _m) { final String s = _s.trim(); if (dico_.isKey(s)) { if (currentkey_ != null) { endValue(_m); } - valueBuffer_=new StringBuffer(30); + valueBuffer_ = new StringBuffer(30); currentkey_ = dico_.getEntite(s); if (currentkey_ != null) { commentaireFinal_ = commentairesEnCours_.toString(); - commentairesEnCours_=new StringBuffer(30); + commentairesEnCours_ = new StringBuffer(30); } - } - else { + } else { appendValue(_s); } } @@ -318,45 +309,45 @@ /** * @throws IOException fermeture */ - public void close() throws IOException{ + public void close() throws IOException { in_.close(); } /** * @param _f le fichier a lire (0). */ - public void setFile(final File[] _f){ + public void setFile(final File[] _f) { setFile(_f[0]); } /** * @return la version utilisee */ - public DicoCasFileFormatVersionAbstract getDicoCasFileFormatVersion(){ + public DicoCasFileFormatVersionAbstract getDicoCasFileFormatVersion() { return ft_; } /** * @return la version utilisee */ - public FileFormatVersionInterface getFileFormatVersion(){ + public FileFormatVersionInterface getFileFormatVersion() { return getDicoCasFileFormatVersion(); } /** * */ - protected Object internalRead(){ + protected Object internalRead() { return readCas(); } /** * */ - protected FortranInterface getFortranInterface(){ + protected FortranInterface getFortranInterface() { return new FortranInterface() { - public void close() throws IOException{ + public void close() throws IOException { if (in_ != null) { in_.close(); } @@ -367,7 +358,7 @@ /** * @return la version utilisee */ - public FileFormatVersionInterface getVersion(){ + public FileFormatVersionInterface getVersion() { return ft_; } -} \ No newline at end of file +} Modified: trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoModelAbstract.java =================================================================== --- trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoModelAbstract.java 2015-09-28 20:26:30 UTC (rev 9179) +++ trunk/framework/fudaa-dico/server/src/main/java/org/fudaa/dodico/dico/DicoModelAbstract.java 2015-09-28 20:26:37 UTC (rev 9180) @@ -7,6 +7,7 @@ */ package org.fudaa.dodico.dico; +import com.memoire.fu.FuLog; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -14,16 +15,19 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import org.fudaa.ctulu.CtuluLibString; /** * Une classe abstraite pour toutes les classes generees pour les fichiers dico. s - * + * * @author deniger * @version $Id: DicoModelAbstract.java,v 1.17 2006-09-19 14:42:27 deniger Exp $ */ public abstract class DicoModelAbstract implements Comparable { + private DicoEntiteList entites_; protected Map entiteComportValues_; @@ -44,6 +48,16 @@ languageIndex_ = DicoLanguage.getNormalizeLanguage(_language); } + public DicoModelAbstract toOtherLanguage() { + try { + DicoModelAbstract res = getClass().getConstructor(Integer.TYPE).newInstance(getOtherLanguageIndex()); + return res; + } catch (Exception ex) { + FuLog.error(ex); + } + return null; + } + /** * @param _language l'identifiant du langage * @see DicoLanguage @@ -72,8 +86,12 @@ protected abstract String[] createNoms(); public int compareTo(final Object _obj) { - if (_obj == this) { return 0; } - if (!(_obj instanceof DicoModelAbstract)) { throw new IllegalArgumentException("arg is not a DicoModelAbstract"); } + if (_obj == this) { + return 0; + } + if (!(_obj instanceof DicoModelAbstract)) { + throw new IllegalArgumentException("arg is not a DicoModelAbstract"); + } final DicoModelAbstract m = (DicoModelAbstract) _obj; final int i = getCodeName().compareTo(m.getCodeName()); return i == 0 ? getVersion().compareTo(m.getVersion()) : i; @@ -95,18 +113,26 @@ * @return true si meme code, meme version et meme langage. */ public boolean equalsModel(final DicoModelAbstract _obj) { - if (_obj == this) { return true; } - if (_obj == null) { return false; } + if (_obj == this) { + return true; + } + if (_obj == null) { + return false; + } return (_obj.getCodeName().equals(getCodeName())) && (_obj.getVersion().equals(getVersion())) - && _obj.getLanguageIndex() == getLanguageIndex(); + && _obj.getLanguageIndex() == getLanguageIndex(); } /** * @return true si meme code, meme version et meme langage. */ public boolean equals(final Object _obj) { - if (_obj == this) { return true; } - if (_obj instanceof DicoModelAbstract) { return equalsModel((DicoModelAbstract) _obj); } + if (_obj == this) { + return true; + } + if (_obj instanceof DicoModelAbstract) { + return equalsModel((DicoModelAbstract) _obj); + } return false; } @@ -117,7 +143,7 @@ /** * Renvoie l'entite correspondante. - * + * * @return null si non trouvee. * @param _nom le nom a chercher */ @@ -137,7 +163,7 @@ /** * Initialise la liste si necessaire. - * + * * @return le nombre de mot-cles geres. */ public int getEntiteNombre() { @@ -149,7 +175,7 @@ /** * Initialise la liste si necessaire. - * + * * @return la liste des mot-cles. */ public DicoEntiteList getEntites() { @@ -171,7 +197,9 @@ * @return la liste des mot-cles contenus dans cette table qui caracterise des fichiers. */ public Set getFichierEntitesFor(final Map _entKeys) { - if ((_entKeys == null) || (_entKeys.size() == 0)) { return null; } + if ((_entKeys == null) || (_entKeys.size() == 0)) { + return null; + } final Set r = new HashSet(_entKeys.size() / 2); DicoEntite ent; for (final Iterator it = _entKeys.keySet().iterator(); it.hasNext();) { @@ -188,7 +216,9 @@ * @return la list des mot-cle caracterisant des fichiers. */ public List getFichierEntitesListFor(final Map _entKeys) { - if ((_entKeys == null) || (_entKeys.size() == 0)) { return new ArrayList(); } + if ((_entKeys == null) || (_entKeys.size() == 0)) { + return new ArrayList(); + } final List r = new ArrayList(_entKeys.size() / 2); DicoEntite ent; for (final Iterator it = _entKeys.keySet().iterator(); it.hasNext();) { @@ -273,6 +303,6 @@ */ public String toString() { return getCodeName() + CtuluLibString.ESPACE + getVersion() + CtuluLibString.ESPACE - + DicoLanguage.getLocalID(languageIndex_); + + DicoLanguage.getLocalID(languageIndex_); } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-28 20:26:33
|
Revision: 9179 http://sourceforge.net/p/fudaa/svn/9179 Author: deniger Date: 2015-09-28 20:26:30 +0000 (Mon, 28 Sep 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/business/fudaa-ef/io/src/main/java/org/fudaa/dodico/ef/io/serafin/SerafinNewReaderInfo.java Modified: trunk/business/fudaa-ef/io/src/main/java/org/fudaa/dodico/ef/io/serafin/SerafinNewReaderInfo.java =================================================================== --- trunk/business/fudaa-ef/io/src/main/java/org/fudaa/dodico/ef/io/serafin/SerafinNewReaderInfo.java 2015-09-28 20:26:23 UTC (rev 9178) +++ trunk/business/fudaa-ef/io/src/main/java/org/fudaa/dodico/ef/io/serafin/SerafinNewReaderInfo.java 2015-09-28 20:26:30 UTC (rev 9179) @@ -162,7 +162,11 @@ pos += 4L + 4L + (_nbV * nbValues_ * 4L); } } - pos += _idxPt * 4; + if (doublePrecision) { + pos += _idxPt * 8; + } else { + pos += _idxPt * 4; + } channel.position(pos); oneDouble.rewind(); channel.read(oneDouble); @@ -208,4 +212,4 @@ public final void setTimeEnrLength(final int _timeEnrLength) { timeEnrLength_ = _timeEnrLength; } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-23 21:38:55
|
Revision: 9176 http://sourceforge.net/p/fudaa/svn/9176 Author: deniger Date: 2015-09-23 21:38:52 +0000 (Wed, 23 Sep 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java Added Paths: ----------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPreferences.java Modified: trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt =================================================================== --- trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2015-09-23 21:38:52 UTC (rev 9176) @@ -335,4 +335,8 @@ Restaurer la fen\xEAtre parente=Restore the parent window Maximiser la fen\xEAtre parente=Maximize the parent window Le contenu du fichier de g\xE9or\xE9f\xE9rencement n'est pas valide ( il doit contenir 6 lignes)=The content of the georeferencing file is not valid ( must contain 6 lines) -La ligne {0} n'est pas valide et ne peut pas \xEAtre transform\xE9e en nombre=The line {0} is not valid and cannot be transformed to a number \ No newline at end of file +La ligne {0} n'est pas valide et ne peut pas \xEAtre transform\xE9e en nombre=The line {0} is not valid and cannot be transformed to a number +S\xE9lection des donn\xE9es \xE0 exporter=Select data to export +Export termin\xE9=Export finished +Donn\xE9es export\xE9es dans le fichier\n {0}=Data exported in the file\n {0} +Enregistrer sous=Save as \ No newline at end of file Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialog.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -136,6 +136,11 @@ afficheDialog(true, _r); return response_; } + public int afficheDialogModal(final boolean modify) { + setModal(true); + afficheDialog(modify, null); + return response_; + } /** * @param _loc le point en haut a gauche de la nouvelle fenetre Added: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPreferences.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPreferences.java (rev 0) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluDialogPreferences.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -0,0 +1,354 @@ +/* + GPL 2 + */ +package org.fudaa.ctulu.gui; + +import com.memoire.bu.BuDesktop; +import com.memoire.fu.FuPreferences; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.util.List; +import java.util.Map; +import java.util.prefs.Preferences; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.table.TableColumn; +import org.apache.commons.lang.StringUtils; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.table.TableColumnExt; +import org.jdesktop.swingx.table.TableColumnModelExt; + +/** + * + * @author Frederic Deniger + */ +public class CtuluDialogPreferences { + + public static boolean isWindowMaximized(JFrame main) { + int extendedState = main.getExtendedState(); + return isExtendedStateMaximized(extendedState); + } + + public static boolean isExtendedStateMaximized(int extendedState) { + return (extendedState & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH; + } + + public static void saveComponentLocationAndDimension(Component main, final Preferences preferences, + final String prefix) { + saveIn(main.getSize(), prefix, preferences); + saveIn(main.getLocation(), prefix, preferences); + } + public static void saveComponentLocationAndDimension(Component main, final FuPreferences preferences, + final String prefix) { + saveIn(main.getSize(), prefix, preferences); + saveIn(main.getLocation(), prefix, preferences); + } + + public static void ensureJInternalFrameWillBeVisible(JInternalFrame main, BuDesktop parent) { + Point init = main.getLocation(); + Dimension initDim = main.getSize(); + int maxW = parent.getWidth(); + int maxH = parent.getHeight(); + int ifW = initDim.width; + int ifH = initDim.height; + ifW = Math.min(maxW, ifW); + ifH = Math.min(maxH, ifH); + int locX = Math.max(0, Math.min(init.x, maxW - ifW)); + int locY = Math.max(0, Math.min(init.y, maxH - ifH)); + Point newPt = new Point(locX, locY); + Dimension newDimension = new Dimension(ifW, ifH); + if (!newPt.equals(init) || newDimension.equals(initDim)) { + main.setLocation(newPt); + main.setSize(newDimension); + } + } + + public static Point loadComponentLocationAndDimension(final Component window, final Preferences preferences, + final String mainWindow) { + + final Dimension dim = loadDim(mainWindow, preferences); + if (dim != null) { + window.setPreferredSize(dim); + window.setSize(dim); + } + final Point loc = loadLocation(mainWindow, preferences); + if (loc != null) { + window.setLocation(loc); + } + return loc; + } + public static Point loadComponentLocationAndDimension(final Component window, final FuPreferences preferences, + final String mainWindow) { + + final Dimension dim = loadDim(mainWindow, preferences); + if (dim != null) { + window.setPreferredSize(dim); + window.setSize(dim); + } + final Point loc = loadLocation(mainWindow, preferences); + if (loc != null) { + window.setLocation(loc); + } + return loc; + } + + /** + * @param prefix le prefixe a utilser pour les cles + * @param parentDim + * @param pref les preferences a utiliser + * @return la dim lue ou null si non trouvee + */ + public static Dimension loadRatioDim(final String prefix, final Dimension parentDim, final Preferences pref) { + final double w = pref.getDouble(prefix + ".ratio.w", -1d); + if (w <= 0) { + return null; + } + final double h = pref.getDouble(prefix + ".ratio.h", -1d); + if (h <= 0) { + return null; + } + return new Dimension((int) (w * parentDim.width), (int) (h * parentDim.height)); + } + + /** + * @param prefix le prefixe a utilser pour les cles + * @param pref les preferences a utiliser + * @return le point lu ou null si non trouve + */ + public static Point loadLocation(final String prefix, final Preferences pref) { + final int x = pref.getInt(prefix + ".x", -1); + if (x < 0) { + return null; + } + final int y = pref.getInt(prefix + ".y", -1); + if (y < 0) { + return null; + } + return new Point(x, y); + } + public static Point loadLocation(final String prefix, final FuPreferences pref) { + final int x = pref.getIntegerProperty(prefix + ".x", -1); + if (x < 0) { + return null; + } + final int y = pref.getIntegerProperty(prefix + ".y", -1); + if (y < 0) { + return null; + } + return new Point(x, y); + } + + /** + * @param pref les pref a modifier + * @param table la table a sauver: colonne + visibilite + */ + public static void saveTablePreferences(final Preferences pref, final JXTable table) { + final List<TableColumn> columns = ((TableColumnModelExt) table.getColumnModel()).getColumns(true); + final String tablePrefix = getComponentPreferencesPrefix(table); + saveIn(table.getSize(), tablePrefix + "dimension.", pref); + final String wId = tablePrefix + "column.width."; + final String visibleId = tablePrefix + "column.visible."; + for (final TableColumn tableColumn : columns) { + final String colName = table.getModel().getColumnName(tableColumn.getModelIndex()); + pref.putInt(wId + colName, tableColumn.getWidth()); + pref.putBoolean(visibleId + colName, ((TableColumnExt) tableColumn).isVisible()); + } + } + + public static GraphicsDevice getDevice(final Component window) { + GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + Rectangle boundsOfWindow = window.getBounds(); + if (screenDevices != null && screenDevices.length > 1) { + for (GraphicsDevice graphicsDevice : screenDevices) { + Rectangle bounds = graphicsDevice.getDefaultConfiguration().getBounds(); + Point p = new Point(boundsOfWindow.x, bounds.y); + if (bounds.contains(p)) { + p.x = boundsOfWindow.x + boundsOfWindow.width; + if (bounds.contains(p)) { + return graphicsDevice; + } + } + } + } + return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + } + + public static void ensureComponentWillBeVisible(final Component window, final Point initLocation) { + + final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + ensureComponentWillBeVisible(window, initLocation, screenSize); + GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + if (screenDevices != null && screenDevices.length > 1) { + GraphicsDevice device = getDevice(window); + if (device != null) { + ensureComponentWillBeVisible(window, initLocation, device.getDefaultConfiguration().getBounds().getSize(), + false); + } + } + } + + private static void ensureComponentWillBeVisible(final Component window, final Point initLocation, + final Dimension screenSize) { + ensureComponentWillBeVisible(window, initLocation, screenSize, true); + } + + private static void ensureComponentWillBeVisible(final Component window, final Point initLocation, + final Dimension screenSize, boolean modifyX) { + final Dimension dim = window.getSize(); + + boolean size = false; + if (dim.width > screenSize.width) { + size = true; + dim.width = screenSize.width; + } + if (dim.height > screenSize.height) { + size = true; + dim.height = screenSize.height; + } + if (size) { + window.setSize(dim); + window.setPreferredSize(dim); + } + if (initLocation == null) { + return; + } + if (modifyX) { + initLocation.x = Math.max(0, Math.min(initLocation.x, screenSize.width - dim.width)); + } + initLocation.y = Math.max(0, Math.min(initLocation.y, screenSize.height - dim.height)); + window.setLocation(initLocation); + } + + /** + * @param d le point a sauvegarder + * @param prefix le prefixe a utilser pour les cles + * @param pref les preferences a modifier + */ + public static void saveIn(final Point d, final String prefix, final Preferences pref) { + // on s'assure d'avoir au moins 0: car si la fenetre est maximise, la location + // renvoie -4 ,-4 + pref.putInt(prefix + ".x", Math.max(0, d.x)); + pref.putInt(prefix + ".y", Math.max(0, d.y)); + } + public static void saveIn(final Point d, final String prefix, final FuPreferences pref) { + // on s'assure d'avoir au moins 0: car si la fenetre est maximise, la location + // renvoie -4 ,-4 + pref.putIntegerProperty(prefix + ".x", Math.max(0, d.x)); + pref.putIntegerProperty(prefix + ".y", Math.max(0, d.y)); + } + + /** + * @param prefix le prefixe a utilser pour les cles + * @param pref les preferences a utiliser + * @return la dim lue ou null si non trouvee + */ + public static Dimension loadDim(final String prefix, final Preferences pref) { + final int w = pref.getInt(prefix + ".w", -1); + if (w <= 0) { + return null; + } + final int h = pref.getInt(prefix + ".h", -1); + if (h <= 0) { + return null; + } + return new Dimension(w, h); + } + public static Dimension loadDim(final String prefix, final FuPreferences pref) { + final int w = pref.getIntegerProperty(prefix + ".w", -1); + if (w <= 0) { + return null; + } + final int h = pref.getIntegerProperty(prefix + ".h", -1); + if (h <= 0) { + return null; + } + return new Dimension(w, h); + } + + public static boolean loadExtendedState(final String prefix, final Preferences pref) { + return pref.getBoolean(prefix + ".isExtended", false); + } + + public static void saveExtendedState(final String prefix, final Preferences pref, boolean val) { + pref.putBoolean(prefix + ".isExtended", val); + } + + public static void saveIn(final Dimension d, final String prefix, final Preferences pref) { + pref.putInt(prefix + ".w", d.width); + pref.putInt(prefix + ".h", d.height); + } + public static void saveIn(final Dimension d, final String prefix, final FuPreferences pref) { + pref.putIntegerProperty(prefix + ".w", d.width); + pref.putIntegerProperty(prefix + ".h", d.height); + } + + /** + * @param d les dimension du composant a suaver + * @param parentDim les dimension parentes utilisees pour le ratio. + * @param prefix prefix a utiliser pour les preferences + * @param pref lles preferences a modifier + */ + public static void saveRatioIn(final Dimension d, final Dimension parentDim, final String prefix, + final Preferences pref) { + pref.putDouble(prefix + ".ratio.w", ((double) d.width) / (double) parentDim.width); + pref.putDouble(prefix + ".ratio.h", ((double) d.height) / (double) parentDim.height); + } + + /** + * @param pref les preferences a utiliser + * @param table la table a modifier + * @param defaultWidths les largeurs a utiliser par default + */ + public static void loadTablePreferences(final Preferences pref, final JXTable table, + final Map<String, Integer> defaultWidths) { + final String tablePrefix = getComponentPreferencesPrefix(table); + loadTableSizePreferences(pref, table, tablePrefix); + final List<TableColumn> columns = ((TableColumnModelExt) table.getColumnModel()).getColumns(true); + + final String wId = tablePrefix + "column.width."; + final String visibleId = tablePrefix + "column.visible."; + for (final TableColumn tableColumn : columns) { + final String colName = table.getModel().getColumnName(tableColumn.getModelIndex()); + final Integer defaultWidth = defaultWidths == null ? null : defaultWidths.get(colName); + final int w = pref.getInt(wId + colName, defaultWidth == null ? -1 : defaultWidth.intValue()); + if (w > 0) { + tableColumn.setPreferredWidth(w); + tableColumn.setWidth(w); + } + // par defaut les colonnes sont visibles: donc on ne traite que le cas cache. + if (!pref.getBoolean(visibleId + colName, true)) { + ((TableColumnExt) tableColumn).setVisible(false); + } + } + } + + /** + * Dimensionne la table selon les preferences sauvegardees. + * + * @param pref les preferences a utiliser + * @param table la table a modifier + * @param defaultWidths les largeurs a utiliser par default + */ + private static void loadTableSizePreferences(final Preferences pref, final JXTable table, final String tablePrefix) { + final Dimension d = loadDim(tablePrefix + "dimension.", pref); + if (d != null) { + table.setSize(d); + } + } + + /** + * @param t + * @return + */ + private static String getComponentPreferencesPrefix(final JComponent t) { + return StringUtils.defaultString(t.getName(), "noName") + "."; + } + +} Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -57,6 +57,7 @@ CtuluFileChooserTestWritable tester = new CtuluFileChooserTestWritable(parentComponent); tester.setAppendExtension(true, null); setFileFilter(ftXslx_); + setDialogTitle(CtuluLib.getS("Enregistrer sous")); setTester(tester); } Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -20,6 +20,7 @@ import com.memoire.bu.BuScrollPane; import gnu.trove.TIntArrayList; import java.awt.Cursor; +import java.awt.Point; import java.awt.Window; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -32,6 +33,7 @@ import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.table.TableColumn; +import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CsvWriter; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; @@ -79,17 +81,37 @@ pn.separator = separator; final CtuluDialog dial = CtuluDialogPanel.createDialog(windowParent, pn); pn.setParentDial(dial); - dial.afficheDialogModal(); + dial.setTitle(CtuluLib.getS("S\xE9lection des donn\xE9es \xE0 exporter")); + Point isSet = CtuluDialogPreferences.loadComponentLocationAndDimension(dial, BuPreferences.BU, "exportExcelDialog"); + CtuluDialogPreferences.ensureComponentWillBeVisible(dial, dial.getLocation()); + dial.afficheDialogModal(isSet == null); + CtuluDialogPreferences.saveComponentLocationAndDimension(dial, BuPreferences.BU, "exportExcelDialog"); + BuPreferences.BU.writeIniFile(); } public static void doExport(final JTable _t, final CtuluUI _ui, final Window _f) { doExport(DEFAULT_SEPARATOR, _t, _ui, _f); } + public static void doExport(final char separator, final JTable _t, final CtuluUI _ui, final Window _f) { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui); + String defaultDir = BuPreferences.BU.getStringProperty("export.excel.lastPath", null); + if (StringUtils.isNotBlank(defaultDir)) { + File dir = new File(defaultDir); + if (dir.exists() && dir.isDirectory()) { + choose.setCurrentDirectory(dir); + + } + } final File f = choose.getDestFile(); if (f == null) { return; + } else { + File dir = f.getParentFile(); + if (dir != null) { + BuPreferences.BU.putStringProperty("export.excel.lastPath", dir.getAbsolutePath()); + BuPreferences.BU.writeIniFile(); + } } CtuluTableExportPanel.showExportDialog(separator, _t, f, choose.getTypeChoosen(), _ui); } @@ -264,6 +286,9 @@ s.setVisible(false); parentDial_.getRootPane().remove(s); parentDial_.setCursor(Cursor.getDefaultCursor()); + ui_.message(CtuluResource.CTULU.getString("Export termin\xE9"), CtuluResource.CTULU.getString("Donn\xE9es export\xE9es dans le fichier\n {0}", + dest_. + getAbsolutePath()), false); } }); Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -7,6 +7,8 @@ import java.util.ArrayList; import java.util.Arrays; import javax.swing.JFileChooser; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; @@ -15,13 +17,13 @@ * @author Frederic Deniger */ public class EGCsvFileImporter { - + private final EGTableGraphePanel panel; - + EGCsvFileImporter(EGTableGraphePanel aThis) { this.panel = aThis; } - + void importCsv() { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(panel); choose.setDialogType(JFileChooser.OPEN_DIALOG); @@ -39,9 +41,15 @@ ArrayList tab = new ArrayList(values.length); for (int i = 0; i < values.length; i++) { String[] value = values[i]; + //la premier ligne peut \xEAtre les entetes + if (i == 0) { + if (!CtuluLibString.isNumeric(value[0])) { + continue; + } + } tab.add(Arrays.asList(value)); } panel.t_.insertTableInTable(tab); } - + } Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -12,8 +12,10 @@ package org.fudaa.ebli.courbe; import com.memoire.bu.BuMenu; +import com.memoire.bu.BuPreferences; import com.memoire.bu.BuResource; import com.memoire.bu.BuTable; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -30,12 +32,14 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; import org.fudaa.ctulu.gui.CtuluCellTextDecimalRenderer; +import org.fudaa.ctulu.gui.CtuluDialogPreferences; import org.fudaa.ctulu.gui.CtuluPopupMenu; import org.fudaa.ctulu.gui.CtuluUIDialog; import org.fudaa.ctulu.table.CtuluTable; import org.fudaa.ctulu.table.CtuluTableSortModel; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliPreferences; import org.fudaa.ebli.commun.EbliTableInfoPanel; import org.fudaa.ebli.commun.EbliTableInfoTarget; import org.fudaa.ebli.ressource.EbliResource; @@ -152,7 +156,8 @@ menu.setIcon(BuResource.BU.getMenuIcon("configurer")); final ActionListener ac = new OptionActionListener(tableModel, table); final boolean isCourbeSelected = courbesSelected.size() > 0; - menu.addCheckBox(EbliLib.getS("Afficher uniquement les courbes s\xE9lectionn\xE9es"), "SHOW_SELECTED_COURBES", null, isCourbeSelected, isCourbeSelected) + menu.addCheckBox(EbliLib.getS("Afficher uniquement les courbes s\xE9lectionn\xE9es"), "SHOW_SELECTED_COURBES", null, isCourbeSelected, + isCourbeSelected) .addActionListener(ac); menu.addCheckBox(EbliLib.getS("Afficher une seule colonne des abscisses"), "SHOW_ONE_TIME", null, true, false).addActionListener(ac); tableModel.setShowOnlySelected(isCourbeSelected); Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -336,6 +336,10 @@ private void addValuesInModel(final List _tab, final EGTableModel _model, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp, final int _maxUpdate) { + if (_model instanceof EGTableModelUpdatable) { + ((EGTableModelUpdatable) _model).addValuesInModel(_tab, _doubleParser, _cmp, _maxUpdate); + return; + } final int nbLine = _tab.size(); final TDoubleArrayList newX = new TDoubleArrayList(nbLine - _maxUpdate + 1); final TDoubleArrayList newY = new TDoubleArrayList(nbLine - _maxUpdate + 1); Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModel.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -91,19 +91,19 @@ c_.getModel().setValue(_rowIndex, x, y, a_.getCmd()); } - public void setValueAt(final double _val, final int _rowIndex, final int _columnIndex, + public boolean setValueAt(final double _val, final int _rowIndex, final int _columnIndex, final CtuluCommandContainer _cmd) { final double x = _columnIndex == xColIndex ? _val : c_.getModel().getX(_rowIndex); final double y = _columnIndex == yColIndex ? _val : c_.getModel().getY(_rowIndex); - c_.getModel().setValue(_rowIndex, x, y, _cmd); + return c_.getModel().setValue(_rowIndex, x, y, _cmd); } public void addValueAt(final double _x, final double _y, final CtuluCommandContainer _cmd) { c_.getModel().addValue(_x, _y, _cmd); } - public void addValueAt(final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { - c_.getModel().addValue(_x, _y, _cmd); + public final boolean addValueAt(final double[] _x, final double[] _y, final CtuluCommandContainer _cmd) { + return c_.getModel().addValue(_x, _y, _cmd); } protected void selectedCourbeChanged(final EGCourbe _a) { Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -16,4 +16,6 @@ int updateLines(final List _tab, final int _selectedColumm, final int _selectedRow, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp); + public void addValuesInModel(List _tab, CtuluDoubleParser _doubleParser, CtuluCommandComposite _cmp, int _maxUpdate); + } Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-09-22 22:11:45 UTC (rev 9175) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-09-23 21:38:52 UTC (rev 9176) @@ -32,11 +32,13 @@ import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.KeyEvent; +import javax.swing.JTable; import javax.units.SI; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluCellTextDecimalRenderer; +import org.fudaa.ctulu.gui.CtuluDialogPreferences; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTableExportPanel; import org.fudaa.ctulu.table.CtuluTableColumnHeader; @@ -210,6 +212,7 @@ sortedModel_.setModel(globalModel_); sortedModel_.setSortOnUpdate(true); table_.setModel(sortedModel_); + table_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table_.getActionMap().remove("copy"); String t = (String) table_.getClientProperty("TABLE_TITLE"); if (t == null) { @@ -236,11 +239,15 @@ } add(new BuScrollPane(table_), BuBorderLayout.CENTER); // l'ordre de ces 2 lignes est important - table_.setTableHeader(new CtuluTableColumnHeader(colModel_)); + CtuluTableColumnHeader header = new CtuluTableColumnHeader(colModel_); + table_.setTableHeader(header); + sortedModel_.install(table_); table_.setColumnModel(colModel_); table_.setCellSelectionEnabled(true); - + for (int i = 0; i < colModel_.getColumnCount(); i++) { + header.adjustWidth(colModel_.getColumn(i)); + } } } @@ -303,8 +310,12 @@ dialog_.pack(); dialog_.setTitle(target_.getTitle()); dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui_.getParentComponent())); + CtuluDialogPreferences.loadComponentLocationAndDimension(dialog_, EbliPreferences.EBLI, "graphe.table"); + CtuluDialogPreferences.ensureComponentWillBeVisible(dialog_, dialog_.getLocation()); dialog_.show(); dialog_.dispose(); + CtuluDialogPreferences.saveComponentLocationAndDimension(dialog_, EbliPreferences.EBLI, "graphe.table"); + EbliPreferences.EBLI.writeIniFile(); dialog_ = null; } private ExportTableCommentSupplier exportTableCommentSupplier; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-22 22:11:48
|
Revision: 9175 http://sourceforge.net/p/fudaa/svn/9175 Author: deniger Date: 2015-09-22 22:11:45 +0000 (Tue, 22 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/DefaultLoiTableModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiTableModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiUiController.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java 2015-09-22 22:09:19 UTC (rev 9174) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java 2015-09-22 22:11:45 UTC (rev 9175) @@ -154,7 +154,6 @@ treeSet.add(ptEvolDelta); } - } return true; } @@ -524,7 +523,10 @@ } Arrays.sort(idxToRemove); for (int i = nb - 1; i >= 0; i--) { - lines.remove(idxToRemove[i]); + int idx = idxToRemove[i]; + if (idx < lines.size() && idx >= 0) { + lines.remove(idx); + } } changeDone(); return true; Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/DefaultLoiTableModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/DefaultLoiTableModel.java 2015-09-22 22:09:19 UTC (rev 9174) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/DefaultLoiTableModel.java 2015-09-22 22:11:45 UTC (rev 9175) @@ -1,19 +1,25 @@ package org.fudaa.fudaa.crue.loi.common; +import java.util.List; import org.apache.commons.lang.StringUtils; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluDoubleParser; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.table.CtuluTableExportInterface; import org.fudaa.dodico.crue.config.ccm.PropertyNature; import org.fudaa.ebli.courbe.EGAxe; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGTableGraphePanel; import org.fudaa.ebli.courbe.EGTableGraphePanel.SpecTableModel; +import org.fudaa.ebli.courbe.EGTableModel; +import org.fudaa.ebli.courbe.EGTableModelUpdatable; /** * Etend le tableModel par defaut de ebli-graphe, pour ajouter une colonne indiquant les erreurs/warnings et pour ne réagir qu'au courbe des points. * * @author Frederic Deniger */ -public class DefaultLoiTableModel extends SpecTableModel { +public class DefaultLoiTableModel extends SpecTableModel implements CtuluTableExportInterface, EGTableModelUpdatable { public DefaultLoiTableModel(EGTableGraphePanel graphePanel) { super(graphePanel); @@ -27,6 +33,51 @@ } @Override + public boolean isColumnExportable(int colModel) { + return colModel != 0; + } + + @Override + public int updateLines(final List _tab, final int _selectedColumm, + final int _selectedRow, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp) { + final int nbLine = _tab.size(); + final int maxUpdate = Math.min(nbLine, getCourbe().getModel().getNbValues() - _selectedRow); + for (int i = 0; i < maxUpdate; i++) { + final List listCell = (List) _tab.get(i); + final int max = Math.min(getRowCount() - _selectedColumm, listCell.size()); + for (int j = 0; j < max; j++) { + final int iCellule = i + _selectedRow; + final int jCellule = j + _selectedColumm; + if (jCellule >= 1) { + final Object o = listCell.get(j); + setValueInModel(o, _doubleParser, iCellule, jCellule, _cmp); + } + } + } + return maxUpdate; + } + + protected void setValueInModel(final Object o, final CtuluDoubleParser _doubleParser, final int iCellule, final int jCellule, + final CtuluCommandComposite _cmp) { + boolean ok = false; + double d = 0; + if (o instanceof Number) { + d = ((Number) o).doubleValue(); + ok = true; + } else if (o != null) { + try { + d = _doubleParser.parse(o.toString()); + ok = true; + } catch (final NumberFormatException e) { + ok = false; + } + } + if (ok) { + setValueAt(d, iCellule, jCellule, _cmp); + } + } + + @Override protected void selectedCourbeChanged(EGCourbe _a) { if (_a == null && getCourbe() == null) { return; Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiTableModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiTableModel.java 2015-09-22 22:09:19 UTC (rev 9174) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiTableModel.java 2015-09-22 22:11:45 UTC (rev 9175) @@ -3,6 +3,7 @@ */ package org.fudaa.fudaa.crue.loi.section; +import com.memoire.fu.FuEmptyArrays; import gnu.trove.TIntObjectHashMap; import java.util.ArrayList; import java.util.Collections; @@ -10,7 +11,12 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluDoubleParser; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelection; +import org.fudaa.dodico.crue.common.transformer.TransformerHelper; import org.fudaa.dodico.crue.metier.emh.DonFrt; import org.fudaa.dodico.crue.config.lit.LitNommeLimite; import org.fudaa.ebli.courbe.EGTableGraphePanel; @@ -28,9 +34,11 @@ public static final int COLUMN_FRT = 4; protected String donFrtLimiteLitAsString; protected String donFrtLimiteLitNommeAsString; + private final ProfilSectionLoiUiController profilSectionLoiUiController; - public ProfilSectionLoiTableModel(EGTableGraphePanel graphePanel) { + public ProfilSectionLoiTableModel(EGTableGraphePanel graphePanel, ProfilSectionLoiUiController profilSectionLoiUiController) { super(graphePanel); + this.profilSectionLoiUiController = profilSectionLoiUiController; donFrtLimiteLitAsString = org.openide.util.NbBundle.getMessage(LoiMessages.class, "ProfilSection.DonFrt.LimiteLit"); donFrtLimiteLitNommeAsString = org.openide.util.NbBundle.getMessage(LoiMessages.class, "ProfilSection.DonFrt.LimiteLitNomme"); } @@ -64,10 +72,38 @@ } @Override - public String getColumnName(int _column) { + protected void setValueInModel(final Object o, final CtuluDoubleParser _doubleParser, final int iCellule, final int jCellule, + final CtuluCommandComposite _cmp) { + if (jCellule == COLUMN_ETIQUETTE) { + String etiquettesValue = o == null ? null : o.toString(); + String[] etiquettes = StringUtils.split(etiquettesValue, ";"); + final List<ProfilSectionEtiquette> allEtiquettes = ProfilSectionEtiquette.getEtiquettes(profilSectionLoiUiController.getCcm()); + List<ProfilSectionEtiquette> newEtiquettes = new ArrayList<>(); + final Map<String, ProfilSectionEtiquette> toMapOfString = CtuluLibArray.toMapOfString(allEtiquettes); + for (String etiquette : etiquettes) { + final ProfilSectionEtiquette found = toMapOfString.get(etiquette); + if (found != null) { + newEtiquettes.add(found); + } + } + setEtiquettes(newEtiquettes, iCellule); + + } else if (jCellule == COLUMN_FRT) { + String frt = o == null ? null : o.toString(); + DonFrt toSet = profilSectionLoiUiController.getDonFrtByName(frt); + setValueAt(toSet, iCellule, jCellule); + } else { + super.setValueInModel(o, _doubleParser, iCellule, jCellule, _cmp); + } + } + + @Override + public String + getColumnName(int _column) { if (_column == COLUMN_ETIQUETTE) { return NbBundle.getMessage(LoiMessages.class, "Etiquette.Label"); } + if (_column == COLUMN_FRT) { return NbBundle.getMessage(LoiMessages.class, "DonFrt.Label"); } @@ -77,6 +113,7 @@ @Override public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { if (_columnIndex == COLUMN_ETIQUETTE) { + // ne rien faire ici.setEtiquettes appelé explicitement par le CellEditor. } else if (_columnIndex == COLUMN_FRT) { if (_rowIndex < getCourbe().getModel().getNbValues()) { Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiUiController.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiUiController.java 2015-09-22 22:09:19 UTC (rev 9174) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionLoiUiController.java 2015-09-22 22:11:45 UTC (rev 9175) @@ -24,6 +24,7 @@ import org.fudaa.ctulu.CtuluLogLevel; import org.fudaa.ctulu.CtuluNumberFormatDefault; import org.fudaa.dodico.crue.common.io.CrueIOResu; +import org.fudaa.dodico.crue.common.transformer.TransformerHelper; import org.fudaa.dodico.crue.config.ccm.ConfigLoi; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; import org.fudaa.dodico.crue.config.ccm.DecimalFormatEpsilonEnum; @@ -187,6 +188,20 @@ } } + protected DonFrt getDonFrtByName(String id) { + if (id == null) { + return null; + } + Map<String, DonFrt> toMapOfId = TransformerHelper.toMapOfId(frt); + DonFrt frt = toMapOfId.get(id.toUpperCase()); + if (frt != null) { + return frt; + } + toMapOfId = TransformerHelper.toMapOfId(frtStockage); + return toMapOfId.get(id.toUpperCase()); + + } + public JLabel getLabelValidating() { return labelValidating; } @@ -330,7 +345,7 @@ @Override protected AbstractTableModel createTableModel() { - return new ProfilSectionLoiTableModel(tableGraphePanel); + return new ProfilSectionLoiTableModel(tableGraphePanel, this); } @Override Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java 2015-09-22 22:09:19 UTC (rev 9174) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java 2015-09-22 22:11:45 UTC (rev 9175) @@ -195,6 +195,13 @@ Coordinate aval = brancheGis.getCoordinateN(segmentidx + 1); double norm = amont.distance(aval); if (norm == 0) { + if (segmentidx > 0) { + amont = brancheGis.getCoordinateN(segmentidx - 1); + norm = amont.distance(aval); + if (norm == 0) { + return null; + } + } return null; } double vx = aval.x - amont.x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-22 22:09:21
|
Revision: 9174 http://sourceforge.net/p/fudaa/svn/9174 Author: deniger Date: 2015-09-22 22:09:19 +0000 (Tue, 22 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTable.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java Added Paths: ----------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableExportInterface.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java 2015-09-17 23:44:40 UTC (rev 9173) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -26,6 +26,8 @@ import javax.swing.ListSelectionModel; import com.memoire.fu.FuEmptyArrays; +import java.util.HashMap; +import java.util.Map; /** * Des methodes statiques concernant les tableaux. @@ -896,6 +898,17 @@ return -1; } + public static <T extends ToStringTransformable> Map<String, T> toMapOfString(Collection<T> in) { + HashMap<String, T> res = new HashMap<String, T>(); + if (in == null) { + return res; + } + for (T t : in) { + res.put(t.getAsString(), t); + } + return res; + } + /** * Transpose un tableau de double \xE0 2 dimensions. * Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTable.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTable.java 2015-09-17 23:44:40 UTC (rev 9173) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTable.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -361,6 +361,12 @@ selectedColumm = 0; selectedRow = 0; } + if (selectedColumm == 0 && getModel() instanceof CtuluTableExportInterface) { + int modelIndex = getColumnModel().getColumn(0).getModelIndex(); + if (!((CtuluTableExportInterface) getModel()).isColumnExportable(modelIndex)) { + selectedColumm = 1; + } + } for (int i = 0; i < _tab.size(); i++) { if ((i + selectedRow) < numberRow) { Added: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableExportInterface.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableExportInterface.java (rev 0) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableExportInterface.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -0,0 +1,14 @@ +/* + GPL 2 + */ +package org.fudaa.ctulu.table; + +/** + * + * @author Frederic Deniger + */ +public interface CtuluTableExportInterface { + + boolean isColumnExportable(int colModel); + +} Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-09-17 23:44:40 UTC (rev 9173) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -18,6 +18,7 @@ import com.memoire.bu.BuPreferences; import com.memoire.bu.BuRadioButton; import com.memoire.bu.BuScrollPane; +import gnu.trove.TIntArrayList; import java.awt.Cursor; import java.awt.Window; import java.awt.event.ItemEvent; @@ -30,6 +31,7 @@ import javax.swing.JList; import javax.swing.JTable; import javax.swing.ListSelectionModel; +import javax.swing.table.TableColumn; import org.fudaa.ctulu.CsvWriter; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; @@ -39,6 +41,7 @@ import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel.TypeChoosen; import org.fudaa.ctulu.table.CtuluTableCsvWriter; import org.fudaa.ctulu.table.CtuluTableExcelWriter; +import org.fudaa.ctulu.table.CtuluTableExportInterface; import org.fudaa.ctulu.table.CtuluTableModelDefault; import org.fudaa.ctulu.table.CtuluTableModelInterface; import org.fudaa.ctulu.table.CtuluTableXlsxWriter; @@ -82,7 +85,6 @@ public static void doExport(final JTable _t, final CtuluUI _ui, final Window _f) { doExport(DEFAULT_SEPARATOR, _t, _ui, _f); } - public static void doExport(final char separator, final JTable _t, final CtuluUI _ui, final Window _f) { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui); final File f = choose.getDestFile(); @@ -109,15 +111,31 @@ ui_ = _ui; choosenType_ = type; cbModel_ = new BuList(); + final TIntArrayList exportableColumns = new TIntArrayList(); + CtuluTableExportInterface exportInterface = null; + if (table_.getModel() instanceof CtuluTableExportInterface) { + exportInterface = (CtuluTableExportInterface) table_.getModel(); + } + + for (int i = 0; i < table_.getColumnCount(); i++) { + final TableColumn column = table_.getColumnModel().getColumn(i); + boolean toAdd = true; + if (exportInterface != null) { + toAdd = exportInterface.isColumnExportable(column.getModelIndex()); + } + if (toAdd) { + exportableColumns.add(i); + } + } cbModel_.setModel(new AbstractListModel() { @Override public Object getElementAt(final int _index) { - return table_.getColumnName(_index); + return table_.getColumnName(exportableColumns.get(_index)); } @Override public int getSize() { - return table_.getColumnCount(); + return exportableColumns.size(); } }); final ButtonGroup bg = new ButtonGroup(); @@ -185,6 +203,29 @@ } } final BuGlassPaneStop s = new BuGlassPaneStop(); + //on enleve les colonnes non exportables + if (table_.getModel() instanceof CtuluTableExportInterface) { + CtuluTableExportInterface exportInterface = (CtuluTableExportInterface) table_.getModel(); + final TIntArrayList toExport = new TIntArrayList(); + if (col == null) { + for (int i = 0; i < table_.getColumnCount(); i++) { + final TableColumn column = table_.getColumnModel().getColumn(i); + boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); + if (toAdd) { + toExport.add(i); + } + } + } else { + for (int i = 0; i < col.length; i++) { + final TableColumn column = table_.getColumnModel().getColumn(col[i]); + boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); + if (toAdd) { + toExport.add(i); + } + } + } + col = toExport.toNativeArray(); + } final int[] colToWrite = col; final int[] rowToWrite = row; parentDial_.setGlassPane(s); Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-17 23:44:40 UTC (rev 9173) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -40,6 +40,7 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluSelectionListTableModelUpdater; import org.fudaa.ctulu.table.CtuluTable; +import org.fudaa.ctulu.table.CtuluTableExportInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.ressource.EbliResource; @@ -60,7 +61,7 @@ public static class SpecTableModel extends EGTableModel { - private EGTableGraphePanel graphePanel; + protected final EGTableGraphePanel graphePanel; Double newX_; Double newY_; @@ -284,6 +285,12 @@ int selectedColumm = getSelectedColumn(); int selectedRow = getSelectedRow(); final CtuluDoubleParser doubleParser = new CtuluDoubleParser(); + if (selectedColumm <= 0 && getModel() instanceof CtuluTableExportInterface) { + int modelIndex = getColumnModel().getColumn(0).getModelIndex(); + if (!((CtuluTableExportInterface) getModel()).isColumnExportable(modelIndex)) { + selectedColumm = 1; + } + } final CtuluCommandComposite cmp = new CtuluCommandComposite(); if (selectedRow >= 0) { @@ -379,6 +386,9 @@ private int updateLines(final List _tab, final EGTableModel _model, final int _selectedColumm, final int _selectedRow, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp) { + if (_model instanceof EGTableModelUpdatable) { + return ((EGTableModelUpdatable) _model).updateLines(_tab, _selectedColumm, _selectedRow, _doubleParser, _cmp); + } final int nbLine = _tab.size(); final int maxUpdate = Math.min(nbLine, _model.c_.getModel().getNbValues() - _selectedRow); for (int i = 0; i < maxUpdate; i++) { Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java (rev 0) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableModelUpdatable.java 2015-09-22 22:09:19 UTC (rev 9174) @@ -0,0 +1,19 @@ +/* + GPL 2 + */ +package org.fudaa.ebli.courbe; + +import java.util.List; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluDoubleParser; + +/** + * + * @author Frederic Deniger + */ +public interface EGTableModelUpdatable { + + int updateLines(final List _tab, final int _selectedColumm, + final int _selectedRow, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp); + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 23:44:42
|
Revision: 9173 http://sourceforge.net/p/fudaa/svn/9173 Author: deniger Date: 2015-09-17 23:44:40 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrt.java Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrt.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrt.java 2015-09-17 23:44:04 UTC (rev 9172) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonFrt.java 2015-09-17 23:44:40 UTC (rev 9173) @@ -27,6 +27,12 @@ return getNom(); } + @Override + public String toString() { + return getAsString(); + } + + /** * ne pas utiliser directement. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 23:44:07
|
Revision: 9172 http://sourceforge.net/p/fudaa/svn/9172 Author: deniger Date: 2015-09-17 23:44:04 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionEtiquetteContainer.java Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionEtiquetteContainer.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionEtiquetteContainer.java 2015-09-17 23:43:42 UTC (rev 9171) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionEtiquetteContainer.java 2015-09-17 23:44:04 UTC (rev 9172) @@ -25,6 +25,12 @@ } @Override + public String toString() { + return getAsString(); + } + + + @Override public String getAsString() { StringBuilder builder = new StringBuilder(); if (etiquettes != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 23:43:44
|
Revision: 9171 http://sourceforge.net/p/fudaa/svn/9171 Author: deniger Date: 2015-09-17 23:43:42 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-17 23:41:19 UTC (rev 9170) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-17 23:43:42 UTC (rev 9171) @@ -319,7 +319,7 @@ if (!model.isModelXModifiable()) { return; } - final int[] row = new int[model.getRowCount()]; + final int[] row = new int[model.getRowCount() - 1]; for (int i = 0; i < row.length; i++) { row[i] = i; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 23:41:21
|
Revision: 9170 http://sourceforge.net/p/fudaa/svn/9170 Author: deniger Date: 2015-09-17 23:41:19 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-662 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt Added Paths: ----------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java (rev 0) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2015-09-17 23:41:19 UTC (rev 9170) @@ -0,0 +1,47 @@ +/* + GPL 2 + */ +package org.fudaa.ebli.courbe; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import javax.swing.JFileChooser; +import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; +import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; + +/** + * + * @author Frederic Deniger + */ +public class EGCsvFileImporter { + + private final EGTableGraphePanel panel; + + EGCsvFileImporter(EGTableGraphePanel aThis) { + this.panel = aThis; + } + + void importCsv() { + final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(panel); + choose.setDialogType(JFileChooser.OPEN_DIALOG); + choose.setTester(null); + final File f = choose.getDestFile(); + if (f == null) { + return; + } + final String[][] values = new CtuluExcelCsvFileReader(f).readFile(); + if (values == null) { + return; + } + panel.t_.deleteAllValues(); + panel.t_.clearSelection(); + ArrayList tab = new ArrayList(values.length); + for (int i = 0; i < values.length; i++) { + String[] value = values[i]; + tab.add(Arrays.asList(value)); + } + panel.t_.insertTableInTable(tab); + } + +} Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-17 23:40:54 UTC (rev 9169) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2015-09-17 23:41:19 UTC (rev 9170) @@ -208,6 +208,7 @@ EGGraphe a_; BuToolButton btAdd_; BuToolButton btCopy_; + BuToolButton btImport_; BuToolButton btAlign_; BuToolButton btRemove_; BuLabel lb_; @@ -313,6 +314,19 @@ } } + public void deleteAllValues() { + final EGTableModel model = (EGTableModel) getModel(); + if (!model.isModelXModifiable()) { + return; + } + final int[] row = new int[model.getRowCount()]; + for (int i = 0; i < row.length; i++) { + row[i] = i; + } + // on ne peut pas tout enlever + model.c_.getModel().removeValue(row, model.a_.getCmd()); + } + private void addValuesInModel(final List _tab, final EGTableModel _model, final CtuluDoubleParser _doubleParser, final CtuluCommandComposite _cmp, final int _maxUpdate) { final int nbLine = _tab.size(); @@ -551,14 +565,14 @@ txt.setColumns(10); t_ .setDefaultEditor(Double.class, new BuTableCellEditor(txt) { - @Override - public boolean isCellEditable(final EventObject _evt) { - if (_evt instanceof MouseEvent) { - return ((MouseEvent) _evt).getClickCount() >= 2; - } - return true; - } - }); + @Override + public boolean isCellEditable(final EventObject _evt) { + if (_evt instanceof MouseEvent) { + return ((MouseEvent) _evt).getClickCount() >= 2; + } + return true; + } + }); t_.setModel(createValuesTableModel()); t_.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -611,6 +625,9 @@ if (btCopy_ != null) { btCopy_.setEnabled(modifiable && c.getModel().isXModifiable()); } + if (btImport_ != null) { + btImport_.setEnabled(modifiable && c.getModel().isXModifiable()); + } if (btAdd_ != null) { btAdd_.setEnabled(modifiable && c.getModel().isXModifiable() && selection_.getSelection() != null && selection_.getSelection().getNbSelectedIndex() >= 2); @@ -693,6 +710,11 @@ protected void tablePaste() { t_.paste(); } + + protected void tableImport() { + new EGCsvFileImporter(this).importCsv(); + } + EbliActionSimple actionDelete; public EbliActionSimple getActionDelete() { @@ -701,9 +723,6 @@ } return actionDelete; - - - } public class DeleteAction extends EbliActionSimple { @@ -767,6 +786,19 @@ } }); + btImport_ = new BuToolButton(); + btImport_.setIcon(EbliResource.EBLI.getToolIcon("crystal_importer")); + btImport_.setMargin(zeroInset); + btImport_.setActionCommand("IMPORT"); + btImport_.setToolTipText("<html>" + EbliLib.getS("Importer depuis un fichier Excel/csv") + "<br><b>" + EbliLib.getS( + "Toutes les valeurs actuelles seront remplac\xE9es")); + btImport_.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + EGTableGraphePanel.this.tableImport(); + } + }); + btRemove_ = new BuToolButton(); btRemove_.setMargin(zeroInset); btRemove_.setIcon(EbliResource.EBLI.getToolIcon("node-delete")); @@ -792,6 +824,7 @@ pnBt.setLayout(new BuButtonLayout(1, SwingConstants.LEFT)); if (addPasteButtons) { pnBt.add(btCopy_); + pnBt.add(btImport_); } if (addTopButtons) { pnBt.add(btAdd_); @@ -822,6 +855,7 @@ public void removeEditButtons() { removeEditButtonsButCopy(); removeButton(btCopy_); + removeButton(btImport_); } public void removeEditButtonsButCopy() { @@ -840,7 +874,8 @@ @Override public void axeContentChanged(final EGAxe _c) { - (getSpecTableModel()).fireTableChanged(new TableModelEvent(getSpecTableModel(), 0, getSpecTableModel().getRowCount() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE)); + (getSpecTableModel()).fireTableChanged(new TableModelEvent(getSpecTableModel(), 0, getSpecTableModel().getRowCount() - 1, + TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE)); repaint(); } Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-09-17 23:40:54 UTC (rev 9169) +++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-09-17 23:41:19 UTC (rev 9170) @@ -23,6 +23,8 @@ Choix couleur contour=Foreground color Choix couleur de fond=Background color Coller une s\xE9rie de valeurs depuis le presse-papier=Copy a list of value from the clipboard +Importer depuis un fichier Excel/csv=Import values form Excel/Csv file +Toutes les valeurs actuelles seront remplac\xE9es=All current values will be replaced Police=Font Choisir=Choose Transparence=Transparency This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 23:40:56
|
Revision: 9169 http://sourceforge.net/p/fudaa/svn/9169 Author: deniger Date: 2015-09-17 23:40:54 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-662 Added Paths: ----------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java Added: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java (rev 0) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java 2015-09-17 23:40:54 UTC (rev 9169) @@ -0,0 +1,102 @@ +/* + GPL 2 + */ +package org.fudaa.ctulu.table; + +import com.Ostermiller.util.CSVParser; +import com.memoire.fu.FuLog; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.io.File; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.fudaa.ctulu.CtuluLibFile; + +/** + * + * @author Frederic Deniger + */ +public class CtuluExcelCsvFileReader { + + final File file; + + public CtuluExcelCsvFileReader(File file) { + this.file = file; + } + + public String[][] readFile() { + final String nameToLowerCase = file.getName().toLowerCase(); + if (nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls")) { + List<String[]> rows = new ArrayList<String[]>(); + InputStream is = null; + try { + is = new FileInputStream(file); + Workbook wb = WorkbookFactory.create(is); + Sheet sheetAt = wb.getSheetAt(0); + for (Row row : sheetAt) { + List<String> cols = new ArrayList<String>(); + for (Cell cell : row) { + cols.add(getValue(cell)); + } + rows.add(cols.toArray(new String[cols.size()])); + } + } catch (Exception ex) { + FuLog.error(ex); + } finally { + CtuluLibFile.close(is); + } + final String[][] toArray = rows.toArray(new String[rows.size()][]); + return toArray; + + } else { + return readCsv(); + } + } + + protected String[][] readCsv() { + String[][] values = null; + Reader reader = null; + try { + reader = new FileReader(file); + values = new CSVParser(new BufferedReader(reader), ';').getAllValues(); + } catch (Exception ex) { + FuLog.error(ex); + } finally { + CtuluLibFile.close(reader); + } + return values; + } + + protected String getValue(Cell cell) { + switch (cell.getCellType()) { + case Cell.CELL_TYPE_NUMERIC: + return Double.toString(cell.getNumericCellValue()); + case Cell.CELL_TYPE_STRING: + return cell.getStringCellValue(); + default: + try { + return Double.toString(cell.getNumericCellValue()); + } catch (Exception ex) { + FuLog.error(ex); + try { + return cell.getStringCellValue(); + } catch (Exception ex1) { + FuLog.error(ex); + + } + } + } + return StringUtils.EMPTY; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-17 21:38:34
|
Revision: 9168 http://sourceforge.net/p/fudaa/svn/9168 Author: deniger Date: 2015-09-17 21:38:31 +0000 (Thu, 17 Sep 2015) Log Message: ----------- CRUE-669 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java 2015-09-10 19:54:58 UTC (rev 9167) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/LayerTraceGisBuilder.java 2015-09-17 21:38:31 UTC (rev 9168) @@ -109,6 +109,7 @@ for (int i = nb - 1; i >= 0; i--) { CatEMHBranche branche = brancheController.getBranche(i); GISPolyligne brancheGis = brancheController.getBrancheGis(i); + TObjectDoubleHashMap<RelationEMHSectionDansBranche> ratiosBySection = LayerSectionGisBuilder.getRatio(i, realDistance, brancheController); for (TObjectDoubleIterator it = ratiosBySection.iterator(); it.hasNext();) { @@ -140,8 +141,10 @@ endAngleInRadians = Math.toRadians(endAngleInDegree); } GISPolyligne traceGIS = createLine(profilSection, brancheGis, tmpResult, startAngleInRadians, endAngleInRadians); - newSectionCollection.addPolyligne(traceGIS, planimetryGisModelContainer.buildTraceData( - sectionDansBranche, branche, startAngleInDegree, endAngleInDegree), null); + if (traceGIS != null) { + newSectionCollection.addPolyligne(traceGIS, planimetryGisModelContainer.buildTraceData( + sectionDansBranche, branche, startAngleInDegree, endAngleInDegree), null); + } } } newSectionCollection.setGeomModifiable(false); @@ -187,14 +190,13 @@ } } - int segmentidx = tmpResult.getSegmentidx(); Coordinate amont = brancheGis.getCoordinateN(segmentidx); Coordinate aval = brancheGis.getCoordinateN(segmentidx + 1); - if (amont.equals2D(aval)) { + double norm = amont.distance(aval); + if (norm == 0) { return null; } - double norm = amont.distance(aval); double vx = aval.x - amont.x; double vy = aval.y - amont.y; double vxTrace = (vy) / norm; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 19:55:01
|
Revision: 9167 http://sourceforge.net/p/fudaa/svn/9167 Author: deniger Date: 2015-09-10 19:54:58 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-634 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportVisualTopComponent.java Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportVisualTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportVisualTopComponent.java 2015-09-10 16:57:17 UTC (rev 9166) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportVisualTopComponent.java 2015-09-10 19:54:58 UTC (rev 9167) @@ -82,7 +82,7 @@ preferredID = ReportVisualTopComponent.TOPCOMPONENT_ID) public final class ReportVisualTopComponent extends AbstractReportTimeTopComponent implements LookupListener, ExplorerManager.Provider, CtuluImageProducer, ReportTopComponentConfigurable<ReportPlanimetryConfig>, PropertyChangeListener { - + public static final String TOPCOMPONENT_ID = "ReportVisualTopComponent"; public static final String TOPCOMPONENT_ACTION = "CTL_" + TOPCOMPONENT_ID; public static final String TOPCOMPONENT_ACTION_DISPLAYNAME = "#" + TOPCOMPONENT_ACTION; @@ -95,7 +95,7 @@ private final ExplorerManager em = new ExplorerManager(); ReportPlanimetryConfig reportPlanimetryConfig = new ReportPlanimetryConfig(); private final ReportPlanimetryConfigurer reportPlanimetryConfigurer = new ReportPlanimetryConfigurer(); - + public ReportVisualTopComponent() { initComponents(); setDefaultName(); @@ -107,27 +107,27 @@ ActionMap map = this.getActionMap(); associateLookup(ExplorerUtils.createLookup(em, map)); } - + @Override protected String getHelpCtxId() { return SysdocUrlBuilder.getTopComponentHelpCtxId("vuePlanimetrie", PerspectiveEnum.REPORT); } - + @Override public ReportPlanimetryConfig getReportConfig() { return reportPlanimetryConfig; } - + @Override public boolean isClosable() { return false; } - + @Override public void rangeChanged() { setReportConfig(getReportConfig(), false); } - + @Override public void setReportConfig(ReportPlanimetryConfig newConfig, boolean fromTemplate) { super.updating = true; @@ -154,27 +154,27 @@ } } private ReportViewLineInfo info; - + @Override public void setReportInfo(ReportViewLineInfo info) { this.info = info; } - + @Override public AbstractReportTopComponent getTopComponent() { return this; } - + @Override public void updateFrameName() { setName(info == null ? "" : info.getNom()); updateTopComponentName(); } - + public ReportPlanimetryConfigurer getReportPlanimetryConfigurer() { return reportPlanimetryConfigurer; } - + private void updateConfigurer() { if (panel != null) { final PlanimetryController planimetryController = panel.getPlanimetryController(); @@ -199,22 +199,22 @@ panel.getVueCalque().repaint(0); } } - + @Override public BufferedImage produceImage(Map params) { return panel.produceImage(params); } - + @Override public BufferedImage produceImage(int w, int h, Map params) { return panel.produceImage(w, h, params); } - + @Override public Dimension getDefaultImageDimension() { return panel.getDefaultImageDimension(); } - + @Override protected void componentActivated() { super.componentActivated(); @@ -223,19 +223,19 @@ panel.requestFocusInWindow(); } } - + @Override protected void componentDeactivated() { super.componentDeactivated(); ExplorerUtils.activateActions(em, false); } - + @Override public ExplorerManager getExplorerManager() { return em; } Map<String, Long> calcByName; - + @Override public void selectedTimeChanged() { if (reportService.getRunCourant() != null & panel != null) { @@ -248,11 +248,11 @@ panel.getPlanimetryController().setEditedCalcul(calcSelected); } } - + @Override public void timeFormatChanged() { } - + @Override public void setEditable(boolean b) { this.editable = b; @@ -261,7 +261,7 @@ planimetryVisuPanel.getPlanimetryController().setEditable(b, false); } } - + @Override public void setModified(boolean modified) { super.setModified(modified); @@ -271,7 +271,7 @@ } } } - + @Override protected void runLoadedHandler() { if (reportVisuService.getPlanimetryVisuPanel() != null) { @@ -279,10 +279,11 @@ } } VisuConfiguration initConfiguration; - + protected void scenarioVisuLoaded() { + final double[][] repere = panel == null ? null : panel.getVueCalque().getRepere(); this.removeAll(); - + panel = reportVisuService.getPlanimetryVisuPanel(); List<BCalque> mainLayers = panel.getPlanimetryController().getMainLayers(); for (BCalque bCalque : mainLayers) { @@ -310,28 +311,37 @@ EventQueue.invokeLater(new Runnable() { @Override public void run() { - panel.restaurer(); + if (repere != null) { + panel.getVueCalque().setRepere(repere); + + } else { + panel.restaurer(); + } + selectedTimeChanged(); - panel.getPlanimetryController().setEditable(editable); + + panel.getPlanimetryController() + .setEditable(editable); } - }); + } + ); } private final Set<String> ignoreProperties = new TreeSet<String>(Arrays.asList("versEcran", "versReel")); VisuChangerListener modificationChangeListener = new VisuChangerListener(); - + @Override public void propertyChange(PropertyChangeEvent evt) { if (panel != null && !updating) { reportPlanimetryConfig.setVisibility(panel.getPlanimetryController().getLayerVisibility()); reportViewServiceContrat.changesDoneIn(ReportVisualTopComponent.this); - + } - + } private PlanimetryVisuPanel panel; private LayerSelectionListener selectionListener = null; SelectedEMHsLookupListener selectedEMHsLookupListener; - + public void buildCalcMapIfNeeded() { if (calcByName == null) { calcByName = new HashMap<String, Long>(); @@ -342,7 +352,7 @@ } } } - + @Override public void clearReportModifications() { updating = true; @@ -354,12 +364,13 @@ } clearModificationState(); updating = false; + } - + private void setDefaultName() throws MissingResourceException { setName(NbBundle.getMessage(ReportVisualTopComponent.class, TOPCOMPONENT_ACTION)); } - + private void restoreDefaultConfigurationData() { ReportTemplateFileProvider template = new ReportTemplateFileProvider(); reportPlanimetryConfig = (ReportPlanimetryConfig) template.loadTemplate(ReportContentType.PLANIMETRY); @@ -373,19 +384,20 @@ setDefaultName(); setModified(false); } - + private void clearModificationState() { setModified(false); + } - + private class LayerSelectionListener implements ZSelectionListener { - + @Override public void selectionChanged(ZSelectionEvent _evt) { selectionChangedInPanel(); } } - + protected void selectionChangedInPanel() { if (updating) { return; @@ -412,12 +424,12 @@ //met à jour la sélection des EMHs. reportSelectedEMHService.setSelectedEMHs(selected); } - + protected JComponent createToolbar(PlanimetryVisuPanel panel) { SaveTemplateAction action = new SaveTemplateAction(this); return PlanimetryVisuPanelBuilder.buildTopComponent(panel, action.buildButton(EbliComponentFactory.INSTANCE)); } - + @Override protected void runUnloadedHandler() { updating = true; @@ -430,12 +442,14 @@ bCalque.removePropertyChangeListener(BSelecteurCheckBox.PROP_USER_VISIBLE, this); } } - + panel = null; calcByName = null; this.removeAll(); + this.add(new JLabel(NbBundle.getMessage(ReportVisualTopComponent.class, "TopComponent.NoScenarioLoadedInformations"))); super.revalidate(); + this.repaint(); updating = false; } @@ -462,30 +476,35 @@ } } VisuPanelLookupListener visuLookupListener; - + @Override protected void componentOpenedHandler() { if (resultatVisuPanel == null) { visuLookupListener = new VisuPanelLookupListener(); - resultatVisuPanel = reportVisuService.getLookup().lookupResult(PlanimetryVisuPanel.class); + resultatVisuPanel + = reportVisuService.getLookup().lookupResult(PlanimetryVisuPanel.class + ); resultatVisuPanel.addLookupListener(visuLookupListener); } if (resultatEMHsSelected == null) { selectedEMHsLookupListener = new SelectedEMHsLookupListener(); - resultatEMHsSelected = reportSelectedEMHService.getLookup().lookupResult(Long.class); + resultatEMHsSelected + = reportSelectedEMHService.getLookup().lookupResult(Long.class + ); resultatEMHsSelected.addLookupListener(selectedEMHsLookupListener); } if (info != null) { updateFrameName(); + } - + } - + private class SelectedEMHsLookupListener implements LookupListener { - + @Override public void resultChanged(LookupEvent ev) { - + if (panel == null || WindowManager.getDefault().getRegistry().getActivated() == ReportVisualTopComponent.this) { return; } @@ -496,14 +515,14 @@ Collection<Long> uids = new ArrayList<Long>(allItems.size()); for (Long uid : allItems) { uids.add(uid); - + } updating = true; panel.setSelectedEMHFromUids(uids); updating = false; } } - + @Override protected void componentClosedDefinitlyHandler() { if (resultatVisuPanel != null) { @@ -515,28 +534,29 @@ resultatEMHsSelected = null; } } - + @Override public void componentClosedTemporarily() { super.componentClosedTemporarily(); } - + void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // http://wiki.apidesign.org/wiki/PropertyFiles p.setProperty("version", "1.0"); // TODO store your settings + } - + void readProperties(java.util.Properties p) { // TODO read your settings according to their version } - + private class VisuChangerListener implements PropertyChangeListener, Observer { - + public VisuChangerListener() { } - + @Override public void update(Observable o, Object arg) { if (!updating && "visible".equals(arg)) { @@ -544,16 +564,16 @@ reportViewServiceContrat.changesDoneIn(ReportVisualTopComponent.this); } } - + @Override public void propertyChange(PropertyChangeEvent evt) { - + if (panel == null) { return; } if (evt.getSource() == panel.getCqLegend() && (!editable || ignoreProperties.contains(evt.getPropertyName()))) { return; - + } if (updating) { return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 16:57:19
|
Revision: 9166 http://sourceforge.net/p/fudaa/svn/9166 Author: deniger Date: 2015-09-10 16:57:17 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-657 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java Added Paths: ----------- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/CrueBasicComponentFactory.java trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JidePaletteButton.java trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JideToolButton.java Modified: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java 2015-09-10 16:56:03 UTC (rev 9165) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java 2015-09-10 16:57:17 UTC (rev 9166) @@ -1,6 +1,5 @@ package org.fudaa.fudaa.crue.common; -import com.jidesoft.plaf.UIDefaultsLookup; import com.memoire.bu.BuResource; import java.awt.BorderLayout; import java.awt.Color; @@ -23,6 +22,7 @@ import org.fudaa.fudaa.crue.common.pdt.PrendreClicheFinPermanentEditor; import org.fudaa.fudaa.crue.common.services.PerspectiveService; import org.fudaa.fudaa.crue.common.services.SelectedPerspectiveService; +import org.fudaa.fudaa.crue.common.swing.CrueBasicComponentFactory; import org.openide.modules.ModuleInstall; import org.openide.util.Lookup; import org.openide.util.Lookup.Item; @@ -33,31 +33,31 @@ import org.openide.windows.WindowManager; public class InitPerspectiveInstaller extends ModuleInstall implements Runnable { - + @Override protected void initialize() { BuResource.BU.setIconFamily("crystal"); BPalettePlage.setDisplayReversed(); WindowManager.getDefault().invokeWhenUIReady(this); } - + @Override public void validate() throws IllegalStateException { super.validate(); } - + @Override public void restored() { BuResource.BU.setIconFamily("crystal"); BPalettePlage.setDisplayReversed(); - + WindowManager.getDefault().invokeWhenUIReady(this); } - + @Override @Messages("FudaaCrueClosing.Label=Fudaa-Crue est en cours de fermeture...") public boolean closing() { - + SelectedPerspectiveService selectedPerspectiveService = Lookup.getDefault().lookup(SelectedPerspectiveService.class); boolean closing = true; if (selectedPerspectiveService.getCurrentPerspectiveService() != null) { @@ -72,7 +72,7 @@ if (perspectiveService != null) { closing = perspectiveService.closing(); } - + JDialog d = new JDialog(); JLabel jLabel = new JLabel(FudaaCrueClosing_Label()); d.setTitle(jLabel.getText()); @@ -88,13 +88,13 @@ } return closing; } - + @Override public void run() { UIManager.put("ToggleButton.select", Color.RED); UIManager.put("ToggleButton.focus", Color.RED); UIManager.put("ToggleButton.highlight", Color.RED); - EbliComponentFactory.INSTANCE.setUseSelectedIcon(UIDefaultsLookup.getColor("JideButton.highlight")); + EbliComponentFactory.INSTANCE.setComponentFactory(new CrueBasicComponentFactory()); DurationPropertyEditor.registerEditor(); LocalDateTimeEditor.registerEditor(); PrendreClicheFinPermanentEditor.registerAllClicheEditors(); Added: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/CrueBasicComponentFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/CrueBasicComponentFactory.java (rev 0) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/CrueBasicComponentFactory.java 2015-09-10 16:57:17 UTC (rev 9166) @@ -0,0 +1,51 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.common.swing; + +import com.jidesoft.swing.JideButton; +import com.jidesoft.swing.JideMenu; +import com.jidesoft.swing.JideToggleButton; +import javax.swing.AbstractButton; +import javax.swing.JMenuItem; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliBasicComponentFactory; + +/** + * + * @author Frederic Deniger + */ +public class CrueBasicComponentFactory extends EbliBasicComponentFactory { + + @Override + public AbstractButton createToolToggleButton() { + final JideToggleButton jideToggleButton = new JideToggleButton(); + jideToggleButton.setButtonStyle(JideButton.TOOLBAR_STYLE); + return jideToggleButton; + } + + @Override + public AbstractButton createToggleButton() { + return new JideToggleButton(); + } + + + @Override + public AbstractButton createToolButton(EbliActionSimple _a) { + JideButton button = new JideToolButton(_a); + return button; + } + + @Override + public AbstractButton createButton() { + return new JideButton(); + } + + + @Override + public AbstractButton createPaletteButton(EbliActionPaletteAbstract _a) { + return new JidePaletteButton(_a); + } + +} Added: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JidePaletteButton.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JidePaletteButton.java (rev 0) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JidePaletteButton.java 2015-09-10 16:57:17 UTC (rev 9166) @@ -0,0 +1,37 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.common.swing; + +import com.jidesoft.swing.JideToggleButton; +import com.memoire.bu.BuDesktop; +import org.fudaa.ebli.commun.EbliActionPaletteAbstract; + +/** + * + * @author Frederic Deniger + */ +public class JidePaletteButton extends JideToggleButton { + + EbliActionPaletteAbstract ac_; + + /** + * + */ + public JidePaletteButton(final EbliActionPaletteAbstract _ac) { + ac_ = _ac; + } + + @Override + public final void setVisible(final boolean _b) { + if (_b != isVisible()) { + ac_.setMainButtonVisible(_b); + super.setVisible(_b); + } + + } + + public void setDesktop(final BuDesktop _d) { + ac_.setDesktop(_d); + } +} Added: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JideToolButton.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JideToolButton.java (rev 0) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/swing/JideToolButton.java 2015-09-10 16:57:17 UTC (rev 9166) @@ -0,0 +1,60 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.common.swing; + +import com.jidesoft.swing.JideButton; +import java.awt.event.KeyEvent; +import javax.swing.Action; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import org.fudaa.ebli.commun.EbliActionInterface; + +/** + * + * @author Frederic Deniger + */ +public class JideToolButton extends JideButton { + + KeyStroke key_; + + public JideToolButton(final EbliActionInterface _action) { + super(null, null); + setAction(_action); + setFocusable(true); + setButtonStyle(JideButton.TOOLBAR_STYLE); + key_ = (KeyStroke) _action.getValue(Action.ACCELERATOR_KEY); + if (key_ != null) { + final KeyStroke accelerator = key_; + final String acceleratorDelimiter + = UIManager.getString("MenuItem.acceleratorDelimiter"); + String acceleratorText = ""; + if (accelerator != null) { + final int modifiers = accelerator.getModifiers(); + if (modifiers > 0) { + acceleratorText = KeyEvent.getKeyModifiersText(modifiers); + //acceleratorText += "-"; + acceleratorText += acceleratorDelimiter; + } + + final int keyCode = accelerator.getKeyCode(); + if (keyCode == 0) { + acceleratorText += accelerator.getKeyChar(); + } else { + acceleratorText += KeyEvent.getKeyText(keyCode); + } + } + setToolTipText(super.getToolTipText() + " " + acceleratorText); + } + } + + @Override + protected boolean processKeyBinding(final KeyStroke _ks, final KeyEvent _e, final int _condition, final boolean _pressed) { + if (isEnabled() && key_ != null && key_.equals(_ks)) { + return SwingUtilities.notifyAction(getAction(), _ks, _e, this, _e.getModifiers()); + } + return super.processKeyBinding(_ks, _e, _condition, _pressed); + } + +} Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java 2015-09-10 16:56:03 UTC (rev 9165) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java 2015-09-10 16:57:17 UTC (rev 9166) @@ -204,7 +204,6 @@ @Override public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) { - throw new UnsupportedOperationException("Not supported yet."); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 16:56:05
|
Revision: 9165 http://sourceforge.net/p/fudaa/svn/9165 Author: deniger Date: 2015-09-10 16:56:03 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-657 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java Added Paths: ----------- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliBasicComponentFactory.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComposedIcon.java Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2015-09-10 14:41:11 UTC (rev 9164) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbeSimple.java 2015-09-10 16:56:03 UTC (rev 9165) @@ -36,7 +36,7 @@ super.fillWithInfo(_table, _selectedPt); final String pre = EbliLib.getS("Axe vertical:") + CtuluLibString.ESPACE; final EGAxeVertical axe = getAxeY(); - if (_table != null) { + if (_table != null && axe != null) { _table.put(pre + EbliLib.getS("Borne min"), axe.getStringAffiche(axe.getMinimum())); _table.put(pre + EbliLib.getS("Borne max"), axe.getStringAffiche(axe.getMaximum())); } Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliBasicComponentFactory.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliBasicComponentFactory.java (rev 0) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliBasicComponentFactory.java 2015-09-10 16:56:03 UTC (rev 9165) @@ -0,0 +1,53 @@ +/* + GPL 2 + */ +package org.fudaa.ebli.commun; + +import com.memoire.bu.BuButton; +import com.memoire.bu.BuCheckBoxMenuItem; +import com.memoire.bu.BuMenuItem; +import com.memoire.bu.BuToggleButton; +import javax.swing.AbstractButton; +import javax.swing.JCheckBox; +import javax.swing.JMenuItem; +import javax.swing.JToggleButton; + +/** + * + * @author Frederic Deniger + */ +public class EbliBasicComponentFactory { + + public AbstractButton createButton() { + return new BuButton(); + } + + public AbstractButton createToggleButton() { + return new BuToggleButton(); + } + + public JMenuItem createCheckBoxMenuItem() { + return new BuCheckBoxMenuItem(); + } + + public JMenuItem createMenuItem() { + return new BuMenuItem(); + } + + public AbstractButton createToolToggleButton() { + return new BuToggleButton(); + } + + public AbstractButton createCheckBox() { + return new JCheckBox(); + } + + public AbstractButton createPaletteButton(EbliActionPaletteAbstract _a) { + return new EbliPaletteButton(_a); + } + + public AbstractButton createToolButton(EbliActionSimple _a) { + return new EbliButtonTool(_a); + } + +} Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java 2015-09-10 14:41:11 UTC (rev 9164) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java 2015-09-10 16:56:03 UTC (rev 9165) @@ -10,18 +10,11 @@ package org.fudaa.ebli.commun; import javax.swing.AbstractButton; -import javax.swing.JCheckBox; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JToggleButton; -import com.memoire.bu.BuButton; -import com.memoire.bu.BuCheckBoxMenuItem; -import com.memoire.bu.BuColorIcon; -import com.memoire.bu.BuComposedIcon; -import com.memoire.bu.BuMenuItem; -import com.memoire.bu.BuToggleButton; import java.awt.Color; /** @@ -29,11 +22,13 @@ * @version $Id: EbliComponentFactory.java,v 1.12 2006-09-19 14:55:55 deniger Exp $ */ public final class EbliComponentFactory { - + public final static EbliComponentFactory INSTANCE = new EbliComponentFactory(); - + private Color useSelectedIcon; + EbliBasicComponentFactory componentFactory = new EbliBasicComponentFactory(); + /** * */ @@ -41,6 +36,14 @@ super(); } + public EbliBasicComponentFactory getComponentFactory() { + return componentFactory; + } + + public void setComponentFactory(EbliBasicComponentFactory componentFactory) { + this.componentFactory = componentFactory; + } + public Color getUseSelectedIcon() { return useSelectedIcon; } @@ -54,7 +57,7 @@ _r.setSelected(_a.isSelected()); _a.addPropertyChangeListener(new EbliSelectedChangeListener(_r)); } - + public void addActionsToMenu(final EbliActionInterface[] _acs, final JMenu _dest) { if ((_acs != null) && (_dest != null)) { final int n = _acs.length; @@ -68,7 +71,7 @@ } } } - + public void addActionsToMenu(final EbliActionInterface[] _acs, final JPopupMenu _dest) { if ((_acs != null) && (_dest != null)) { final int n = _acs.length; @@ -82,63 +85,63 @@ } } } - + public AbstractButton buildButton(final EbliActionChangeState _a) { - final JToggleButton r = new BuToggleButton(); + final AbstractButton r = componentFactory.createToggleButton(); decoreStateButton(r, _a); - if (useSelectedIcon != null && _a.getIcon() != null) { - BuComposedIcon selectedIcon = new BuComposedIcon(_a.getIcon(), new BuColorIcon(useSelectedIcon)); - r.setSelectedIcon(selectedIcon); - } return r; } - + public AbstractButton buildButton(final EbliActionSimple _a) { - final AbstractButton r = new BuButton(); + final AbstractButton r = componentFactory.createButton(); r.setAction(_a); return r; } - + public JMenuItem buildMenuItem(final EbliActionChangeState _a) { - final BuCheckBoxMenuItem r = new BuCheckBoxMenuItem(); + final JMenuItem r = componentFactory.createCheckBoxMenuItem(); decoreStateButton(r, _a); return r; } - + public JMenuItem buildMenuItem(final EbliActionSimple _a) { - final JMenuItem r = new BuMenuItem(); + final JMenuItem r = componentFactory.createMenuItem(); r.setAction(_a); return r; } - + public AbstractButton buildToolButton(final EbliActionChangeState _a) { - final AbstractButton r = new BuToggleButton(); + final AbstractButton r = componentFactory.createToolToggleButton(); decoreStateButton(r, _a); decoreToolBarButton(r); + if (useSelectedIcon != null && _a.getIcon() != null) { + EbliComposedIcon selectedIcon = new EbliComposedIcon(useSelectedIcon, _a.getIcon()); + r.setSelectedIcon(selectedIcon); + } return r; } - + public AbstractButton buildCheckBox(final EbliActionChangeState _a) { - final AbstractButton r = new JCheckBox(); + final AbstractButton r = componentFactory.createCheckBox(); decoreStateButton(r, _a); decoreToolBarButton(r); r.setText(_a.getTitle()); return r; } - + public AbstractButton buildToolButton(final EbliActionPaletteAbstract _a) { - final AbstractButton r = new EbliPaletteButton(_a); + final AbstractButton r = componentFactory.createPaletteButton(_a); decoreStateButton(r, _a); decoreToolBarButton(r); return r; } - + public AbstractButton buildToolButton(final EbliActionSimple _a) { - final AbstractButton r = new EbliButtonTool(_a); + final AbstractButton r = componentFactory.createToolButton(_a); decoreToolBarButton(r); return r; } - + public void decoreToolBarButton(final AbstractButton _r) { _r.setText(""); _r.setRolloverEnabled(true); Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComposedIcon.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComposedIcon.java (rev 0) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComposedIcon.java 2015-09-10 16:56:03 UTC (rev 9165) @@ -0,0 +1,56 @@ +/* + GPL 2 + */ +package org.fudaa.ebli.commun; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import javax.swing.Icon; + +/** + * + * @author Frederic Deniger + */ +public class EbliComposedIcon implements Icon { + + private Color background; + private Icon icon; + + public EbliComposedIcon(Color background, Icon icon) { + this.background = background; + this.icon = icon; + } + + public Color getBackground() { + return background; + } + + public void setBackground(Color background) { + this.background = background; + } + + public Icon getIcon() { + return icon; + } + + public void setIcon(Icon icon) { + this.icon = icon; + } + + + public void paintIcon(Component c, Graphics g, int x, int y) { + g.setColor(background); + g.fillRect(x, y, icon.getIconWidth(), icon.getIconHeight()); + icon.paintIcon(c, g, x, y); + } + + public int getIconWidth() { + return icon.getIconWidth(); + } + + public int getIconHeight() { + return icon.getIconHeight(); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 14:41:13
|
Revision: 9164 http://sourceforge.net/p/fudaa/svn/9164 Author: deniger Date: 2015-09-10 14:41:11 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-657 Modified Paths: -------------- trunk/soft/fudaa-crue/nb-configuration.xml trunk/soft/fudaa-crue/pom.xml trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java Modified: trunk/soft/fudaa-crue/nb-configuration.xml =================================================================== --- trunk/soft/fudaa-crue/nb-configuration.xml 2015-09-10 14:41:00 UTC (rev 9163) +++ trunk/soft/fudaa-crue/nb-configuration.xml 2015-09-10 14:41:11 UTC (rev 9164) @@ -12,4 +12,13 @@ <configuration id="release" profiles="release"/> </configurations> </config-data> + <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> + <!-- +Properties that influence various parts of the IDE, especially code formatting and the like. +You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. +That way multiple projects can share the same settings (useful for formatting rules for example). +Any value defined here will override the pom.xml file value but is only applicable to the current project. +--> + <netbeans.hint.jdkPlatform>JDK_1.7</netbeans.hint.jdkPlatform> + </properties> </project-shared-configuration> Modified: trunk/soft/fudaa-crue/pom.xml =================================================================== --- trunk/soft/fudaa-crue/pom.xml 2015-09-10 14:41:00 UTC (rev 9163) +++ trunk/soft/fudaa-crue/pom.xml 2015-09-10 14:41:11 UTC (rev 9164) @@ -20,7 +20,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <javaCompiler>1.7</javaCompiler> <targetJdk>1.7</targetJdk> - <fudaa-sig.version>1.5</fudaa-sig.version> + <fudaa-sig.version>1.7-SNAPSHOT</fudaa-sig.version> <netbeans.run.params.ide /> <netbeans.run.params>${netbeans.run.params.ide}</netbeans.run.params> <!--<netbeans.version>RELEASE731</netbeans.version>--> Modified: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java 2015-09-10 14:41:00 UTC (rev 9163) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/InitPerspectiveInstaller.java 2015-09-10 14:41:11 UTC (rev 9164) @@ -1,5 +1,6 @@ package org.fudaa.fudaa.crue.common; +import com.jidesoft.plaf.UIDefaultsLookup; import com.memoire.bu.BuResource; import java.awt.BorderLayout; import java.awt.Color; @@ -11,6 +12,8 @@ import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.UIManager; +import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.palette.BPalettePlage; import static org.fudaa.fudaa.crue.common.Bundle.*; import org.fudaa.fudaa.crue.common.editor.CustomColorChooser; @@ -21,7 +24,6 @@ import org.fudaa.fudaa.crue.common.services.PerspectiveService; import org.fudaa.fudaa.crue.common.services.SelectedPerspectiveService; import org.openide.modules.ModuleInstall; -import org.openide.nodes.NodeOp; import org.openide.util.Lookup; import org.openide.util.Lookup.Item; import org.openide.util.NbBundle.Messages; @@ -89,6 +91,10 @@ @Override public void run() { + UIManager.put("ToggleButton.select", Color.RED); + UIManager.put("ToggleButton.focus", Color.RED); + UIManager.put("ToggleButton.highlight", Color.RED); + EbliComponentFactory.INSTANCE.setUseSelectedIcon(UIDefaultsLookup.getColor("JideButton.highlight")); DurationPropertyEditor.registerEditor(); LocalDateTimeEditor.registerEditor(); PrendreClicheFinPermanentEditor.registerAllClicheEditors(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 14:41:02
|
Revision: 9163 http://sourceforge.net/p/fudaa/svn/9163 Author: deniger Date: 2015-09-10 14:41:00 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-657 Modified Paths: -------------- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java 2015-09-10 14:23:32 UTC (rev 9162) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliComponentFactory.java 2015-09-10 14:41:00 UTC (rev 9163) @@ -18,16 +18,21 @@ import com.memoire.bu.BuButton; import com.memoire.bu.BuCheckBoxMenuItem; +import com.memoire.bu.BuColorIcon; +import com.memoire.bu.BuComposedIcon; import com.memoire.bu.BuMenuItem; import com.memoire.bu.BuToggleButton; +import java.awt.Color; /** * @author deniger * @version $Id: EbliComponentFactory.java,v 1.12 2006-09-19 14:55:55 deniger Exp $ */ public final class EbliComponentFactory { - + public final static EbliComponentFactory INSTANCE = new EbliComponentFactory(); + + private Color useSelectedIcon; /** * @@ -36,12 +41,20 @@ super(); } + public Color getUseSelectedIcon() { + return useSelectedIcon; + } + + public void setUseSelectedIcon(Color useSelectedIcon) { + this.useSelectedIcon = useSelectedIcon; + } + private void decoreStateButton(final AbstractButton _r, final EbliActionChangeState _a) { _r.setAction(_a); _r.setSelected(_a.isSelected()); _a.addPropertyChangeListener(new EbliSelectedChangeListener(_r)); } - + public void addActionsToMenu(final EbliActionInterface[] _acs, final JMenu _dest) { if ((_acs != null) && (_dest != null)) { final int n = _acs.length; @@ -55,7 +68,7 @@ } } } - + public void addActionsToMenu(final EbliActionInterface[] _acs, final JPopupMenu _dest) { if ((_acs != null) && (_dest != null)) { final int n = _acs.length; @@ -69,31 +82,35 @@ } } } - + public AbstractButton buildButton(final EbliActionChangeState _a) { final JToggleButton r = new BuToggleButton(); decoreStateButton(r, _a); + if (useSelectedIcon != null && _a.getIcon() != null) { + BuComposedIcon selectedIcon = new BuComposedIcon(_a.getIcon(), new BuColorIcon(useSelectedIcon)); + r.setSelectedIcon(selectedIcon); + } return r; } - + public AbstractButton buildButton(final EbliActionSimple _a) { final AbstractButton r = new BuButton(); r.setAction(_a); return r; } - + public JMenuItem buildMenuItem(final EbliActionChangeState _a) { final BuCheckBoxMenuItem r = new BuCheckBoxMenuItem(); decoreStateButton(r, _a); return r; } - + public JMenuItem buildMenuItem(final EbliActionSimple _a) { final JMenuItem r = new BuMenuItem(); r.setAction(_a); return r; } - + public AbstractButton buildToolButton(final EbliActionChangeState _a) { final AbstractButton r = new BuToggleButton(); decoreStateButton(r, _a); @@ -108,23 +125,23 @@ r.setText(_a.getTitle()); return r; } - + public AbstractButton buildToolButton(final EbliActionPaletteAbstract _a) { final AbstractButton r = new EbliPaletteButton(_a); decoreStateButton(r, _a); decoreToolBarButton(r); return r; } - + public AbstractButton buildToolButton(final EbliActionSimple _a) { final AbstractButton r = new EbliButtonTool(_a); decoreToolBarButton(r); return r; } - + public void decoreToolBarButton(final AbstractButton _r) { _r.setText(""); _r.setRolloverEnabled(true); _r.setBorderPainted(false); } -} \ No newline at end of file +} Modified: trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-09-10 14:23:32 UTC (rev 9162) +++ trunk/framework/ebli-common/src/main/resources/org/fudaa/ebli/ressource/ebli_en.fr_txt 2015-09-10 14:41:00 UTC (rev 9163) @@ -907,4 +907,5 @@ Type Nuage de points=Points fog type Mode contour=Contour mode Mode densit\xE9=Density mode -Un calque \xE9ditable doit \xEAtre selectionn\xE9=An editable layer must be selected \ No newline at end of file +Un calque \xE9ditable doit \xEAtre selectionn\xE9=An editable layer must be selected +Autom. zoom=Zoom auto \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-10 14:23:35
|
Revision: 9162 http://sourceforge.net/p/fudaa/svn/9162 Author: deniger Date: 2015-09-10 14:23:32 +0000 (Thu, 10 Sep 2015) Log Message: ----------- CRUE-657 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2015-09-09 21:59:55 UTC (rev 9161) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2015-09-10 14:23:32 UTC (rev 9162) @@ -154,6 +154,8 @@ }; // EM:Si la fonctionnalit\xE9 'Restaurer automatiquement' est d\xE9j\xE0 activ\xE9e, selectionner l'action. ((EbliActionChangeState) s).setSelected(getGraphe().isAutoRestore()); + + getGraphe().addPropertyChangeListener("autorestore", this); // s.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Restaurer automatiquement la vue")); r.add(s); @@ -280,7 +282,6 @@ final EbliActionInterface[] rf = new EbliActionInterface[r.size()]; r.toArray(rf); EbliLib.updateMapKeyStroke(this, rf); - return rf; } @@ -307,8 +308,17 @@ } } + protected void majLabelInfoAutoRestore() { + String txt = (String) lbTools_.getClientProperty("actionNameSaved"); + if (getGraphe().isAutoRestore()) { + txt = "<html><b><" + EbliLib.getS("Autom. zoom") + "></b> " + txt; + } + lbTools_.setText(txt); + } + protected void majLabelInfo(final String _s) { - lbTools_.setText(_s); + lbTools_.putClientProperty("actionNameSaved", _s); + majLabelInfoAutoRestore(); } protected void fillPopupMenu(final BuPopupMenu _menu) { @@ -454,6 +464,10 @@ @Override public void propertyChange(final PropertyChangeEvent _evt) { + if ("autorestore".equals(_evt.getPropertyName())) { + majLabelInfoAutoRestore(); + + } if (_evt.getSource() instanceof EGInteractiveComponent) { final EGInteractiveComponent c = (EGInteractiveComponent) _evt.getSource(); if (c.isActive()) { Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-09-09 21:59:55 UTC (rev 9161) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-09-10 14:23:32 UTC (rev 9162) @@ -690,6 +690,7 @@ if (autoRestore_) { restore(); } + firePropertyChange("autorestore", !autoRestore_, autoRestore_); EbliPreferences.EBLI.putBooleanProperty(getAutorRestorePref(), autoRestore_); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-09 21:59:57
|
Revision: 9161 http://sourceforge.net/p/fudaa/svn/9161 Author: deniger Date: 2015-09-09 21:59:55 +0000 (Wed, 09 Sep 2015) Log Message: ----------- CRUE-668: sauvegardes des param?\195?\168tres de visibilit?\195?\169 des calques TraceProfils et TraceCasiers Modified Paths: -------------- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/configuration/LayerVisibilityInfo.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/AbstractGroupExternController.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/GroupExterneMainController.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/PlanimetryController.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/layer/PlanimetryHydraulicGroup.java trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/save/ConfigSaverHdydaulicAndVisibility.java trunk/soft/fudaa-crue/ui-planimetry/src/main/resources/org/fudaa/fudaa/crue/planimetry/configuration/Bundle.properties Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/configuration/LayerVisibilityInfo.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/configuration/LayerVisibilityInfo.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/configuration/LayerVisibilityInfo.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -17,10 +17,34 @@ public final static String VISIBILITY_GROUP_DESSIN = "groupeDessin"; public final static String VISIBILITY_GROUP_SIG_FILE = "groupeFichierSIG"; public final static String VISIBILITY_GROUP_IMAGE_FILE = "groupeImage"; + public final static String VISIBILITY_GROUP_TRACE_PROFILS = "groupeTraceProfils"; + public final static String VISIBILITY_GROUP_TRACE_PROFILS_CASIERS = "groupeProfilsCasier"; + public static Node.Property createGrTraceProfilsProperty(LayerVisibility in) { + try { + Reflection create = ConfigurationInfoHelper.create("traceProfilsVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); + create.setName(VISIBILITY_GROUP_TRACE_PROFILS + ".visible"); + return create; + } catch (NoSuchMethodException noSuchMethodException) { + Exceptions.printStackTrace(noSuchMethodException); + } + return null; + } + + public static Node.Property createGrTraceProfilsPropertyCasiers(LayerVisibility in) { + try { + Reflection create = ConfigurationInfoHelper.create("traceCasiersVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); + create.setName(VISIBILITY_GROUP_TRACE_PROFILS_CASIERS + ".visible"); + return create; + } catch (NoSuchMethodException noSuchMethodException) { + Exceptions.printStackTrace(noSuchMethodException); + } + return null; + } + public static Node.Property createGrHydraulicProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("grHydraulicVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("grHydraulicVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(VISIBILITY_GROUP_HYDRAULIC + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -31,7 +55,7 @@ public static Node.Property createGrOtherProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("grOtherObjectVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("grOtherObjectVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(VISIBILITY_GROUP_OTHER + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -42,7 +66,7 @@ public static Node.Property createGrDessinProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("grDrawVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("grDrawVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(VISIBILITY_GROUP_DESSIN + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -53,7 +77,7 @@ public static Node.Property createGrSIGFIleProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("grSIGFileVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("grSIGFileVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(VISIBILITY_GROUP_SIG_FILE + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -64,7 +88,7 @@ public static Node.Property createGrImageProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("grImagesVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("grImagesVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(VISIBILITY_GROUP_IMAGE_FILE + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -75,7 +99,7 @@ public static Node.Property createTraceProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("traceVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("traceVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(TraceConfigurationInfo.PREFIX_TRACES + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -86,7 +110,7 @@ public static Node.Property createSectionProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("sectionVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("sectionVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(SectionConfigurationInfo.PREFIX_SECTIONS + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -97,7 +121,7 @@ public static Node.Property createNodeProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("nodeVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("nodeVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(NodeConfigurationInfo.PREFIX_NODES + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -108,7 +132,7 @@ public static Node.Property createBrancheProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("brancheVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("brancheVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(BrancheConfigurationInfo.PREFIX_BRANCHES + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -119,7 +143,7 @@ public static Node.Property createCasierProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("casierVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("casierVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(CasierConfigurationInfo.PREFIX_CASIERS + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { @@ -130,7 +154,7 @@ public static Node.Property createcondLimiteProperty(LayerVisibility in) { try { - Reflection create = ConfigurationInfoHelper.create("condLimitVisible", Boolean.TYPE, in, VisuConfigurationInfo.class); + Reflection create = ConfigurationInfoHelper.create("condLimitVisible", Boolean.TYPE, in, LayerVisibilityInfo.class); create.setName(CondLimitConfigurationInfo.PREFIX_CONDLIMITE + ".visible"); return create; } catch (NoSuchMethodException noSuchMethodException) { Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/AbstractGroupExternController.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/AbstractGroupExternController.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/AbstractGroupExternController.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -24,7 +24,8 @@ * * @author Frederic Deniger */ -public abstract class AbstractGroupExternController<T extends AbstractPlanimetryExternLayerGroup> extends Observable implements LayerController { +public abstract class AbstractGroupExternController<T extends AbstractPlanimetryExternLayerGroup> extends Observable implements LayerController, + PropertyChangeListener { public static final String PROPERTY_LAYER_ADDED = "LayerAdded"; public static final String PROPERTY_LAYER_REMOVED = "LayerRemoved"; @@ -139,6 +140,7 @@ calquesListener = new CalqueAddRemoveListener(); getGroupLayer().addContainerListener(calquesListener); } + getGroupLayer().addPropertyChangeListener(this); } public void setArbreEditable(boolean editable) { @@ -191,25 +193,25 @@ } - private class CalqueAddRemoveListener implements ContainerListener, PropertyChangeListener { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (initializing) { + return; + } + AbstractGroupExternController.this.setChanged(); + AbstractGroupExternController.this.notifyObservers(evt.getPropertyName()); + } + private class CalqueAddRemoveListener implements ContainerListener { + public CalqueAddRemoveListener() { } @Override - public void propertyChange(PropertyChangeEvent evt) { - if (initializing) { - return; - } - AbstractGroupExternController.this.setChanged(); - AbstractGroupExternController.this.notifyObservers(evt.getPropertyName()); - } - - @Override public void componentAdded(ContainerEvent e) { final BCalque c = (BCalque) e.getChild(); - c.addPropertyChangeListener(this); + c.addPropertyChangeListener(AbstractGroupExternController.this); controller.calqueAdded(c); if (initializing) { return; @@ -222,7 +224,7 @@ public void componentRemoved(ContainerEvent e) { final BCalque c = (BCalque) e.getChild(); - c.removePropertyChangeListener(this); + c.removePropertyChangeListener(AbstractGroupExternController.this); controller.calqueRemoved(c); if (initializing) { return; Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/GroupExterneMainController.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/GroupExterneMainController.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/GroupExterneMainController.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -66,7 +66,6 @@ controller.groupExternController = groupController; controller.controllersByName.put(PlanimetryController.NAME_GC_EXTERN, groupController); - return groupController; } @@ -224,8 +223,10 @@ void apply(LayerVisibility layerVisibility) { getGroupExtern().setVisible(layerVisibility.isGrOtherObjectVisible()); getSubController(PlanimetryController.NAME_GC_EXTERN_SIG).getGroupLayer().setVisible(layerVisibility.isGrSIGFileVisible()); - getSubController(PlanimetryController.NAME_GC_EXTERN_DRAW).getGroupLayer().setVisible(layerVisibility.isGrImagesVisible()); + getSubController(PlanimetryController.NAME_GC_EXTERN_DRAW).getGroupLayer().setVisible(layerVisibility.isGrDrawVisible()); getSubController(PlanimetryController.NAME_GC_EXTERN_IMAGES).getGroupLayer().setVisible(layerVisibility.isGrImagesVisible()); + getSubController(PlanimetryController.NAME_GC_EXTERN_TRACES).getGroupLayer().setVisible(layerVisibility.isTraceProfilsVisible()); + getSubController(PlanimetryController.NAME_GC_EXTERN_TRACES_CASIERS).getGroupLayer().setVisible(layerVisibility.isTraceCasiersVisible()); } void fill(LayerVisibility res) { @@ -233,6 +234,8 @@ res.setGrSIGFileVisible(getSubController(PlanimetryController.NAME_GC_EXTERN_SIG).getGroupLayer().isVisible()); res.setGrDrawVisible(getSubController(PlanimetryController.NAME_GC_EXTERN_DRAW).getGroupLayer().isVisible()); res.setGrImagesVisible(getSubController(PlanimetryController.NAME_GC_EXTERN_IMAGES).getGroupLayer().isVisible()); + res.setTraceProfilsVisible(getSubController(PlanimetryController.NAME_GC_EXTERN_TRACES).getGroupLayer().isVisible()); + res.setTraceCasiersVisible(getSubController(PlanimetryController.NAME_GC_EXTERN_TRACES_CASIERS).getGroupLayer().isVisible()); } Map<String, Boolean> getVisibilityForExternLayer() { Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/PlanimetryController.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/PlanimetryController.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/controller/PlanimetryController.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -424,25 +424,23 @@ public LayerVisibility getLayerVisibility() { LayerVisibility res = new LayerVisibility(); - res.setBrancheVisible(getBrancheController().getLayer().isVisible()); - res.setCasierVisible(getCasierController().getLayer().isVisible()); - res.setNodeVisible(getNodeController().getLayer().isVisible()); - res.setSectionVisible(getSectionController().getLayer().isVisible()); - res.setTraceVisible(getTraceController().getLayer().isVisible()); - res.setCondLimitVisible(getcondLimiteController().getLayer().isVisible()); - res.setGrHydraulicVisible(getGroupHydraulicController().groupHydraulic.isVisible()); + res.setBrancheVisible(getBrancheController().getLayer().isUserVisible()); + res.setCasierVisible(getCasierController().getLayer().isUserVisible()); + res.setNodeVisible(getNodeController().getLayer().isUserVisible()); + res.setSectionVisible(getSectionController().getLayer().isUserVisible()); + res.setTraceVisible(getTraceController().getLayer().isUserVisible()); + res.setCondLimitVisible(getcondLimiteController().getLayer().isUserVisible()); getGroupExternController().fill(res); return res; } public void apply(LayerVisibility layerVisibility) { - getBrancheController().getLayer().setVisible(layerVisibility.isBrancheVisible()); - getCasierController().getLayer().setVisible(layerVisibility.isCasierVisible()); - getNodeController().getLayer().setVisible(layerVisibility.isNodeVisible()); - getSectionController().getLayer().setVisible(layerVisibility.isSectionVisible()); - getTraceController().getLayer().setVisible(layerVisibility.isTraceVisible()); - getcondLimiteController().getLayer().setVisible(layerVisibility.isCondLimitVisible()); - getGroupHydraulicController().groupHydraulic.setVisible(layerVisibility.isGrHydraulicVisible()); + getBrancheController().getLayer().setUserVisible(layerVisibility.isBrancheVisible()); + getCasierController().getLayer().setUserVisible(layerVisibility.isCasierVisible()); + getNodeController().getLayer().setUserVisible(layerVisibility.isNodeVisible()); + getSectionController().getLayer().setUserVisible(layerVisibility.isSectionVisible()); + getTraceController().getLayer().setUserVisible(layerVisibility.isTraceVisible()); + getcondLimiteController().getLayer().setUserVisible(layerVisibility.isCondLimitVisible()); getGroupExternController().apply(layerVisibility); } Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/layer/PlanimetryHydraulicGroup.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/layer/PlanimetryHydraulicGroup.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/layer/PlanimetryHydraulicGroup.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -38,4 +38,14 @@ return true; } + + @Override + public void setUserVisible(boolean _b) { + super.setUserVisible(_b); + + final BCalque[] c = getCalques(); + for (int i = 0; i < c.length; i++) { + c[i].setUserVisible(_b); + } + } } Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/save/ConfigSaverHdydaulicAndVisibility.java =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/save/ConfigSaverHdydaulicAndVisibility.java 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/java/org/fudaa/fudaa/crue/planimetry/save/ConfigSaverHdydaulicAndVisibility.java 2015-09-09 21:59:55 UTC (rev 9161) @@ -59,8 +59,9 @@ ConfigSaverHelper.addVisibility(res, LayerVisibilityInfo.createGrImageProperty(visibility)); ConfigSaverHelper.addVisibility(res, LayerVisibilityInfo.createGrOtherProperty(visibility)); ConfigSaverHelper.addVisibility(res, LayerVisibilityInfo.createGrSIGFIleProperty(visibility)); + ConfigSaverHelper.addVisibility(res, LayerVisibilityInfo.createGrTraceProfilsProperty(visibility)); + ConfigSaverHelper.addVisibility(res, LayerVisibilityInfo.createGrTraceProfilsPropertyCasiers(visibility)); - return res; } } Modified: trunk/soft/fudaa-crue/ui-planimetry/src/main/resources/org/fudaa/fudaa/crue/planimetry/configuration/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/src/main/resources/org/fudaa/fudaa/crue/planimetry/configuration/Bundle.properties 2015-09-09 21:58:34 UTC (rev 9160) +++ trunk/soft/fudaa-crue/ui-planimetry/src/main/resources/org/fudaa/fudaa/crue/planimetry/configuration/Bundle.properties 2015-09-09 21:59:55 UTC (rev 9161) @@ -126,3 +126,7 @@ grImagesVisible.ShortDescription=Images visibles grHydraulicVisible.DisplayName=Objets hydrauliques visibles grHydraulicVisible.ShortDescription=Objets hydrauliques visibles +traceCasiersVisible.DisplayName=TraceCasiers visibles +traceCasiersVisible.ShortDescription=TraceCasiers visibles +traceProfilsVisible.DisplayName=TraceProfils visibles +traceProfilsVisible.ShortDescription=TraceProfils visibles This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-09 21:58:36
|
Revision: 9160 http://sourceforge.net/p/fudaa/svn/9160 Author: deniger Date: 2015-09-09 21:58:34 +0000 (Wed, 09 Sep 2015) Log Message: ----------- CRUE-668 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingFilesTopComponent.java Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingFilesTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingFilesTopComponent.java 2015-09-09 21:58:14 UTC (rev 9159) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingFilesTopComponent.java 2015-09-09 21:58:34 UTC (rev 9160) @@ -119,6 +119,7 @@ public void update(Observable o, Object arg) { if (propertiesToListenTo.contains(arg)) { modellingScenarioModificationService.setStudyExternConfigModified(); + modellingScenarioModificationService.setStudyConfigModified(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-09 21:58:16
|
Revision: 9159 http://sourceforge.net/p/fudaa/svn/9159 Author: deniger Date: 2015-09-09 21:58:14 +0000 (Wed, 09 Sep 2015) Log Message: ----------- CRUE-668 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/planimetry/LayerVisibility.java Modified: trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/planimetry/LayerVisibility.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/planimetry/LayerVisibility.java 2015-09-09 19:43:08 UTC (rev 9158) +++ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/planimetry/LayerVisibility.java 2015-09-09 21:58:14 UTC (rev 9159) @@ -17,7 +17,25 @@ boolean grDrawVisible = true; boolean grSIGFileVisible = true; boolean grImagesVisible = true; + boolean traceCasiersVisible = true; + boolean traceProfilsVisible = true; + public boolean isTraceCasiersVisible() { + return traceCasiersVisible; + } + + public void setTraceCasiersVisible(boolean traceCasiersVisible) { + this.traceCasiersVisible = traceCasiersVisible; + } + + public boolean isTraceProfilsVisible() { + return traceProfilsVisible; + } + + public void setTraceProfilsVisible(boolean traceProfilsVisible) { + this.traceProfilsVisible = traceProfilsVisible; + } + public boolean isGrHydraulicVisible() { return grHydraulicVisible; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-09 19:43:10
|
Revision: 9158 http://sourceforge.net/p/fudaa/svn/9158 Author: deniger Date: 2015-09-09 19:43:08 +0000 (Wed, 09 Sep 2015) Log Message: ----------- CRUE-665 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java 2015-09-09 19:38:02 UTC (rev 9157) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java 2015-09-09 19:43:08 UTC (rev 9158) @@ -224,6 +224,7 @@ renameSection = optionRename.equals(DialogHelper.showQuestion( getDisplayName(), dialogContent, new String[]{optionRename, optionNot})); } + //CRUE-665: si les noeuds amont/aval changent, le sens de la branche doit être également modifié. boolean isAmontAvalChanged = !StringUtils.equals(modifications.getNoeudAmont(), emh.getNoeudAmontNom()) || !StringUtils.equals(modifications. getNoeudAval(), emh. getNoeudAvalNom()); @@ -231,6 +232,7 @@ if (!log.containsErrorOrSevereError()) { modellingScenarioModificationService.setScenarioModified(new ScenarioModificationEvent(EnumModification.EMH)); if (isAmontAvalChanged) { + //sens modifié: réenregistrer la branche dans le bon sens modellingScenarioModificationService.setGeoLocModified(); } setModified(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-09-09 19:38:05
|
Revision: 9157 http://sourceforge.net/p/fudaa/svn/9157 Author: deniger Date: 2015-09-09 19:38:02 +0000 (Wed, 09 Sep 2015) Log Message: ----------- CRUE-665 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java 2015-08-31 14:55:09 UTC (rev 9156) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheTopComponent.java 2015-09-09 19:38:02 UTC (rev 9157) @@ -2,6 +2,7 @@ import com.memoire.bu.BuGridLayout; import java.awt.BorderLayout; +import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -12,6 +13,7 @@ import java.util.Collections; import java.util.List; import javax.swing.*; +import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluLog; import org.fudaa.dodico.crue.common.Pair; import org.fudaa.dodico.crue.edition.EditionChangeBranche; @@ -25,6 +27,7 @@ import org.fudaa.fudaa.crue.common.helper.ToStringInternationalizableCellRenderer; import org.fudaa.fudaa.crue.common.log.LogsDisplayer; import org.fudaa.fudaa.crue.common.services.SysdocUrlBuilder; +import org.fudaa.fudaa.crue.modelling.AbstractModellingTopComponent; import org.fudaa.fudaa.crue.modelling.action.ModellingOpenListFrottementsOnBrancheNodeAction; import org.fudaa.fudaa.crue.modelling.action.ModellingOpenListSectionsNodeAction; import org.fudaa.fudaa.crue.modelling.services.EnumModification; @@ -221,10 +224,15 @@ renameSection = optionRename.equals(DialogHelper.showQuestion( getDisplayName(), dialogContent, new String[]{optionRename, optionNot})); } - + boolean isAmontAvalChanged = !StringUtils.equals(modifications.getNoeudAmont(), emh.getNoeudAmontNom()) || !StringUtils.equals(modifications. + getNoeudAval(), emh. + getNoeudAvalNom()); CtuluLog log = edition.changeBranche(emh, modifications, getCcm(), renameSection); if (!log.containsErrorOrSevereError()) { modellingScenarioModificationService.setScenarioModified(new ScenarioModificationEvent(EnumModification.EMH)); + if (isAmontAvalChanged) { + modellingScenarioModificationService.setGeoLocModified(); + } setModified(false); } if (log.isNotEmpty()) { @@ -248,7 +256,16 @@ cbType.setSelectedItem(branche.getBrancheType()); btSectionAmont.setText(branche.getSectionAmont().getEmhNom()); btSectionAval.setText(branche.getSectionAval().getEmhNom()); - udpdateSpecificCenter(); + if (EventQueue.isDispatchThread()) { + udpdateSpecificCenter(); + } else { + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + udpdateSpecificCenter(); + } + }); + } } /** * le premier est le panel principal. le deuxieme est le panel spécifique au type de branche This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |