Revision: 6109
          http://sourceforge.net/p/jump-pilot/code/6109
Author:   ma15569
Date:     2019-01-19 19:01:46 +0000 (Sat, 19 Jan 2019)
Log Message:
-----------
Added log record for error

Modified Paths:
--------------
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/geomorphometry/SlopeAspectHillshadePlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/DemFillerPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/FlowDirectionPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydroDistPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HyetographPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/RoutingTimePlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/UpslopeAreaPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/WatershedPlugIn.java
    
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab.java

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/geomorphometry/SlopeAspectHillshadePlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/geomorphometry/SlopeAspectHillshadePlugIn.java
   2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/geomorphometry/SlopeAspectHillshadePlugIn.java
   2019-01-19 19:01:46 UTC (rev 6109)
@@ -10,6 +10,8 @@
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
+
 import com.geomaticaeambiente.klemgui.exceptions.WarningException;
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
@@ -36,7 +38,6 @@
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -197,7 +198,7 @@
 
     }
 
-    public void SlopeAspectHillshadeCommand(
+    public void slopeAspectHillshadeCommand(
             final ComponentsTreeMap componentsWithActions) throws Exception {
         // DEM
         final String demFileFullName = GUIUtils
@@ -347,45 +348,39 @@
             public void rightButton() {
                 try {
 
-                    AbstractPlugIn
-                            .toActionListener(
-                                    new ThreadedBasePlugIn() {
-                                        @Override
-                                        public String getName() {
-                                            return null;
-                                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                                        @Override
-                                        public boolean execute(
-                                                PlugInContext context)
-                                                throws Exception {
-                                            return true;
-                                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                                        @Override
-                                        public void run(TaskMonitor monitor,
-                                                PlugInContext context)
-                                                throws Exception {
-                                            monitor.report(PluginUtils
-                                                    .getResources()
-                                                    .getString(
-                                                            
"OpenKlem.executing-process"));
-                                            // 
monitor.allowCancellationRequests();
-                                            reportNothingToUndoYet(context);
-                                            try {
-                                                
SlopeAspectHillshadeCommand(componentsWithActions);
-                                            } catch (final Exception ex) {
-                                                Logger.error(getName(), ex);
-                                            }
-                                        }
-                                    }, context.getWorkbenchContext(),
-                                    new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    
slopeAspectHillshadeCommand(componentsWithActions);
 
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
             }
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberPlugIn.java
 2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/CurveNumberPlugIn.java
 2019-01-19 19:01:46 UTC (rev 6109)
@@ -17,6 +17,8 @@
 import javax.swing.filechooser.FileNameExtensionFilter;
 import javax.swing.table.DefaultTableModel;
 
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
+
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
 import com.geomaticaeambiente.klemgui.ui.InitialDialog;
@@ -35,9 +37,13 @@
 import com.geomaticaeambiente.openjump.klem.cn.SoilGroupLandUseTable;
 import com.geomaticaeambiente.openjump.klem.cn.ValuesRange;
 import com.geomaticaeambiente.openjump.klem.grid.DoubleBasicGrid;
+import com.vividsolutions.jump.task.TaskMonitor;
 import com.vividsolutions.jump.util.StringUtil;
+import com.vividsolutions.jump.workbench.Logger;
+import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
+import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
 /**
  *
@@ -125,6 +131,61 @@
         return personalTreeMap;
     }
 
+    public void curveNumberCommand(final ComponentsTreeMap 
componentsWithActions)
+            throws Exception {
+        // input values
+        final String landUseRaster = GUIUtils
+                .getStringValue(componentsWithActions.getComponent("00",
+                        GUIUtils.INPUT, 1));
+        final String hydroGroupsRaster = GUIUtils
+                .getStringValue(componentsWithActions.getComponent("01",
+                        GUIUtils.INPUT, 1));
+
+        // Other values
+        final String groupsTableValues = GUIUtils
+                .getStringValue(componentsWithActions.getComponent("00",
+                        GUIUtils.OTHER, 0));
+
+        // Output
+        final String cnRasterOut = GUIUtils
+                .getStringValue(componentsWithActions.getComponent("00",
+                        GUIUtils.OUTPUT, 1));
+
+        checksValues(landUseRaster, hydroGroupsRaster, cnRasterOut);
+
+        // Get values
+        final DoubleBasicGrid landUserGrid = RasterUtils
+                .getDoubleBasicGrid((CustomComboBox.RasterComboBox) 
componentsWithActions
+                        .getComponent("00", GUIUtils.INPUT, 1));
+        final DoubleBasicGrid hydroGroupGrid = RasterUtils
+                .getDoubleBasicGrid((CustomComboBox.RasterComboBox) 
componentsWithActions
+                        .getComponent("01", GUIUtils.INPUT, 1));
+
+        final ValueRangeGroup[] valRangeGroup = 
getValueRangeGroupFromString(groupsTableValues);
+
+        final String table = GUIUtils.getStringValue(componentsWithActions
+                .getComponent("02", GUIUtils.OTHER, 0));
+        final SoilGroupLandUseTable soilGroup = fromTableToSoilGroup(table,
+                valRangeGroup);
+
+        // Calculate raster
+        final CurveNumberCalculator curveNumberCalculator = new 
CurveNumberCalculator();
+        final DoubleBasicGrid curveNumberGrid = curveNumberCalculator
+                .calculateCn(landUserGrid, hydroGroupGrid, soilGroup);
+
+        // display raster on TOC
+        // Save grid as tiff
+        RasterUtils.saveOutputRasterAsTiff(curveNumberGrid, new File(
+                cnRasterOut));
+        // Display raster on OJ from file
+        RasterUtils.displayRasterFileOnOJ(context.getWorkbenchContext(),
+                new File(cnRasterOut), null);
+
+        JOptionPane.showMessageDialog(super.getInitialDialog(), PluginUtils
+                .getResources().getString("SetWorkspacePlugin.Done.message"),
+                PluginUtils.plugInName, JOptionPane.INFORMATION_MESSAGE);
+    }
+
     @Override
     public JPanel buildPluginPanel(final ComponentsTreeMap 
componentsWithActions) {
         if (mainPanel != null) {
@@ -144,68 +205,39 @@
             public void rightButton() {
                 try {
 
-                    // input values
-                    final String landUseRaster = GUIUtils
-                            .getStringValue(componentsWithActions.getComponent(
-                                    "00", GUIUtils.INPUT, 1));
-                    final String hydroGroupsRaster = GUIUtils
-                            .getStringValue(componentsWithActions.getComponent(
-                                    "01", GUIUtils.INPUT, 1));
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                    // Other values
-                    final String groupsTableValues = GUIUtils
-                            .getStringValue(componentsWithActions.getComponent(
-                                    "00", GUIUtils.OTHER, 0));
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                    // Output
-                    final String cnRasterOut = GUIUtils
-                            .getStringValue(componentsWithActions.getComponent(
-                                    "00", GUIUtils.OUTPUT, 1));
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    curveNumberCommand(componentsWithActions);
 
-                    checksValues(landUseRaster, hydroGroupsRaster, 
cnRasterOut);
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
 
-                    // Get values
-                    final DoubleBasicGrid landUserGrid = RasterUtils
-                            
.getDoubleBasicGrid((CustomComboBox.RasterComboBox) componentsWithActions
-                                    .getComponent("00", GUIUtils.INPUT, 1));
-                    final DoubleBasicGrid hydroGroupGrid = RasterUtils
-                            
.getDoubleBasicGrid((CustomComboBox.RasterComboBox) componentsWithActions
-                                    .getComponent("01", GUIUtils.INPUT, 1));
-
-                    final ValueRangeGroup[] valRangeGroup = 
getValueRangeGroupFromString(groupsTableValues);
-
-                    final String table = GUIUtils
-                            .getStringValue(componentsWithActions.getComponent(
-                                    "02", GUIUtils.OTHER, 0));
-                    final SoilGroupLandUseTable soilGroup = 
fromTableToSoilGroup(
-                            table, valRangeGroup);
-
-                    // Calculate raster
-                    final CurveNumberCalculator curveNumberCalculator = new 
CurveNumberCalculator();
-                    final DoubleBasicGrid curveNumberGrid = 
curveNumberCalculator
-                            .calculateCn(landUserGrid, hydroGroupGrid,
-                                    soilGroup);
-
-                    // display raster on TOC
-                    // Save grid as tiff
-                    RasterUtils.saveOutputRasterAsTiff(curveNumberGrid,
-                            new File(cnRasterOut));
-                    // Display raster on OJ from file
-                    RasterUtils.displayRasterFileOnOJ(
-                            context.getWorkbenchContext(),
-                            new File(cnRasterOut), null);
-
-                    JOptionPane.showMessageDialog(
-                            super.getInitialDialog(),
-                            PluginUtils.getResources().getString(
-                                    "SetWorkspacePlugin.Done.message"),
-                            PluginUtils.plugInName,
-                            JOptionPane.INFORMATION_MESSAGE);
-
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
             }
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/DemFillerPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/DemFillerPlugIn.java
   2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/DemFillerPlugIn.java
   2019-01-19 19:01:46 UTC (rev 6109)
@@ -8,6 +8,7 @@
 import javax.swing.JTextField;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
 
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
@@ -27,7 +28,6 @@
 import com.vividsolutions.jump.workbench.Logger;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -140,38 +140,39 @@
             public void rightButton() {
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                demFillerCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    demFillerCommand(componentsWithActions);
 
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
             }
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/FlowDirectionPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/FlowDirectionPlugIn.java
       2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/FlowDirectionPlugIn.java
       2019-01-19 19:01:46 UTC (rev 6109)
@@ -8,6 +8,7 @@
 import javax.swing.JTextField;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
 
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox.LayerComboBox;
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox.RasterComboBox;
@@ -34,7 +35,6 @@
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -164,38 +164,41 @@
 
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                flowDirectionCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                    return true;
+                                }
 
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    monitor.allowCancellationRequests();
+                                    reportNothingToUndoYet(context);
+
+                                    
flowDirectionCommand(componentsWithActions);
+
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
 
             }

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydroDistPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydroDistPlugIn.java
   2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HydroDistPlugIn.java
   2019-01-19 19:01:46 UTC (rev 6109)
@@ -8,6 +8,7 @@
 import javax.swing.JTextField;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
 
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
@@ -33,7 +34,6 @@
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -166,41 +166,41 @@
 
             @Override
             public void rightButton() {
-
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                hydroDistCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    hydroDistCommand(componentsWithActions);
 
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
             }
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HyetographPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HyetographPlugIn.java
  2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/HyetographPlugIn.java
  2019-01-19 19:01:46 UTC (rev 6109)
@@ -1,22 +1,5 @@
 package com.geomaticaeambiente.klemgui.plugin.hydrology;
 
-import com.geomaticaeambiente.klemgui.utils.PluginUtils;
-import com.geomaticaeambiente.klemgui.ui.GUIUtils;
-import com.geomaticaeambiente.klemgui.ui.InitialDialog;
-import com.geomaticaeambiente.klemgui.ui.MainPanel;
-import com.geomaticaeambiente.klemgui.ui.LayerablesList;
-import com.geomaticaeambiente.klemgui.utils.AbstractInputKlemPlugin;
-import com.geomaticaeambiente.klemgui.utils.ActionObject;
-import com.geomaticaeambiente.klemgui.utils.ComponentsTreeMap;
-import com.geomaticaeambiente.klemgui.utils.Header;
-import com.geomaticaeambiente.klemgui.utils.PersonalChart;
-import com.geomaticaeambiente.klemgui.utils.PersonalChartHyetograph;
-import com.geomaticaeambiente.klemgui.utils.PersonalRadioButtons;
-import com.geomaticaeambiente.klemgui.utils.PersonalTable;
-import com.geomaticaeambiente.klemgui.utils.InitialData;
-import com.vividsolutions.jump.util.StringUtil;
-import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import it.geomaticaeambiente.klem.BaseflowParams;
 import it.geomaticaeambiente.klem.DesignRain;
 import it.geomaticaeambiente.klem.Geomorphology;
@@ -27,7 +10,7 @@
 import it.geomaticaeambiente.klem.RainfallRecession;
 import it.geomaticaeambiente.klem.TimeInterval;
 import it.geomaticaeambiente.klem.Watershed;
-import javax.swing.JOptionPane;
+
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
 import javax.swing.JTabbedPane;
@@ -34,6 +17,24 @@
 import javax.swing.filechooser.FileNameExtensionFilter;
 import javax.swing.table.DefaultTableModel;
 
+import com.geomaticaeambiente.klemgui.ui.GUIUtils;
+import com.geomaticaeambiente.klemgui.ui.InitialDialog;
+import com.geomaticaeambiente.klemgui.ui.LayerablesList;
+import com.geomaticaeambiente.klemgui.ui.MainPanel;
+import com.geomaticaeambiente.klemgui.utils.AbstractInputKlemPlugin;
+import com.geomaticaeambiente.klemgui.utils.ActionObject;
+import com.geomaticaeambiente.klemgui.utils.ComponentsTreeMap;
+import com.geomaticaeambiente.klemgui.utils.Header;
+import com.geomaticaeambiente.klemgui.utils.InitialData;
+import com.geomaticaeambiente.klemgui.utils.PersonalChart;
+import com.geomaticaeambiente.klemgui.utils.PersonalChartHyetograph;
+import com.geomaticaeambiente.klemgui.utils.PersonalRadioButtons;
+import com.geomaticaeambiente.klemgui.utils.PersonalTable;
+import com.geomaticaeambiente.klemgui.utils.PluginUtils;
+import com.vividsolutions.jump.util.StringUtil;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+import com.vividsolutions.jump.workbench.ui.ErrorDialog;
+
 /**
  *
  * @author Geomatica
@@ -40,7 +41,8 @@
  */
 public class HyetographPlugIn extends AbstractInputKlemPlugin {
 
-    public HyetographPlugIn(PlugInContext context, InitialDialog 
initialDialog, LayerablesList layerablesList) {
+    public HyetographPlugIn(PlugInContext context, InitialDialog initialDialog,
+            LayerablesList layerablesList) {
         super(context, initialDialog);
         this.context = context;
         this.layerablesList = layerablesList;
@@ -49,35 +51,51 @@
     @Override
     public InitialData setInitialData() {
 
-        InitialData initialData = new InitialData();
-        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(PARAM_A), "", 
GUIUtils.INPUT); //param a
-        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(PARAM_N), "", 
GUIUtils.INPUT); //param n
-        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(TIME), "", 
GUIUtils.INPUT); // param time
-        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(STEP), "", 
GUIUtils.INPUT); //param step
-        initialData.setParam_Labels(new String[]{GUIUtils.setGUILabel(MODEL)}, 
GUIUtils.INPUT); //label Model
+        final InitialData initialData = new InitialData();
+        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(PARAM_A), "",
+                GUIUtils.INPUT); //param a
+        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(PARAM_N), "",
+                GUIUtils.INPUT); //param n
+        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(TIME), "",
+                GUIUtils.INPUT); // param time
+        initialData.setParam_Label_TextBox(GUIUtils.setGUILabel(STEP), "",
+                GUIUtils.INPUT); //param step
+        initialData.setParam_Labels(
+                new String[] { GUIUtils.setGUILabel(MODEL) }, GUIUtils.INPUT); 
//label Model
 
-        PersonalRadioButtons radioButtons = new PersonalRadioButtons(
-                
PluginUtils.getResources().getString("HyetographPlugIn.AlternatingBlocks.label"),
-                
PluginUtils.getResources().getString("HyetographPlugIn.Costant.label"),
-                
PluginUtils.getResources().getString("HyetographPlugIn.IstantaneusIntensity.label"),
-                
PluginUtils.getResources().getString("HyetographPlugIn.Triangular.label"),
-                
PluginUtils.getResources().getString("HyetographPlugIn.Wallingford.labela"));
+        final PersonalRadioButtons radioButtons = new PersonalRadioButtons(
+                PluginUtils.getResources().getString(
+                        "HyetographPlugIn.AlternatingBlocks.label"),
+                PluginUtils.getResources().getString(
+                        "HyetographPlugIn.Costant.label"), PluginUtils
+                        .getResources().getString(
+                                "HyetographPlugIn.IstantaneusIntensity.label"),
+                PluginUtils.getResources().getString(
+                        "HyetographPlugIn.Triangular.label"), PluginUtils
+                        .getResources().getString(
+                                "HyetographPlugIn.Wallingford.labela"));
 
         initialData.setParam_RadioButtons(radioButtons, GUIUtils.INPUT);
 
-        initialData.setParam_Labels(new 
String[]{GUIUtils.setGUILabel(X_UNITS)}, GUIUtils.INPUT); //label x unit
-        initialData.setParam_Action(new ActionObject(
-                new 
String[]{PluginUtils.getResources().getString("KlemGUI.hours.label"),
-                    
PluginUtils.getResources().getString("KlemGUI.minutes.label")}), 
GUIUtils.INPUT);//radio buttons: hours and minutes
+        initialData.setParam_Labels(
+                new String[] { GUIUtils.setGUILabel(X_UNITS) }, 
GUIUtils.INPUT); //label x unit
+        initialData.setParam_Action(
+                new ActionObject(new String[] {
+                        PluginUtils.getResources().getString(
+                                "KlemGUI.hours.label"),
+                        PluginUtils.getResources().getString(
+                                "KlemGUI.minutes.label") }), 
GUIUtils.INPUT);//radio buttons: hours and minutes
 
         return initialData;
     }
 
     @Override
-    public ComponentsTreeMap setComponentsActions(ComponentsTreeMap 
personalTreeMap) {
+    public ComponentsTreeMap setComponentsActions(
+            ComponentsTreeMap personalTreeMap) {
 
         //set radiobutton selection
-        JRadioButton jradioButton_Units = (JRadioButton) 
personalTreeMap.getComponent("07", GUIUtils.INPUT, 0);
+        final JRadioButton jradioButton_Units = (JRadioButton) personalTreeMap
+                .getComponent("07", GUIUtils.INPUT, 0);
         jradioButton_Units.setSelected(true);
 
         return personalTreeMap;
@@ -85,31 +103,50 @@
 
     @Override
     public JPanel buildPluginPanel(final ComponentsTreeMap 
componentsWithActions) {
-        
-        if(this.mainPanel != null) {
-            return this.mainPanel;
+
+        if (mainPanel != null) {
+            return mainPanel;
         }
-        this.mainPanel = new MainPanel(super.getInitialDialog(), 
componentsWithActions, false, false, true,
-                
PluginUtils.getResources().getString("MainPanel.ExecuteButton.text"), 
layerablesList) {
+        mainPanel = new MainPanel(super.getInitialDialog(),
+                componentsWithActions, false, false, true, PluginUtils
+                        .getResources().getString(
+                                "MainPanel.ExecuteButton.text"), 
layerablesList) {
 
+            /**
+                     * 
+                     */
+            private static final long serialVersionUID = 1L;
+
             @Override
             public void rightButton() {
 
                 try {
-         
+
                     //input values
-                    double paramA = 
GUIUtils.getDoubleValue(componentsWithActions.getComponent("00", 
GUIUtils.INPUT, 1));
-                    double paramN = 
GUIUtils.getDoubleValue(componentsWithActions.getComponent("01", 
GUIUtils.INPUT, 1));
-                    double duration_param = 
GUIUtils.getDoubleValue(componentsWithActions.getComponent("02", 
GUIUtils.INPUT, 1));
-                    step_param = 
GUIUtils.getDoubleValue(componentsWithActions.getComponent("03", 
GUIUtils.INPUT, 1));
+                    final double paramA = GUIUtils
+                            .getDoubleValue(componentsWithActions.getComponent(
+                                    "00", GUIUtils.INPUT, 1));
+                    final double paramN = GUIUtils
+                            .getDoubleValue(componentsWithActions.getComponent(
+                                    "01", GUIUtils.INPUT, 1));
+                    final double duration_param = GUIUtils
+                            .getDoubleValue(componentsWithActions.getComponent(
+                                    "02", GUIUtils.INPUT, 1));
+                    step_param = GUIUtils.getDoubleValue(componentsWithActions
+                            .getComponent("03", GUIUtils.INPUT, 1));
 
-                    selHyetoType = 
GUIUtils.getSelectedButton(componentsWithActions.getComponent("05", 
GUIUtils.INPUT, 0));
+                    selHyetoType = GUIUtils
+                            .getSelectedButton(componentsWithActions
+                                    .getComponent("05", GUIUtils.INPUT, 0));
                     if (selHyetoType == -1) {
                         return;
                     }
 
-                    int units = 
GUIUtils.getSelectedJRadioButton((JRadioButton) 
componentsWithActions.getComponent("07", GUIUtils.INPUT, 0), // units: hours
-                            (JRadioButton) 
componentsWithActions.getComponent("07", GUIUtils.INPUT, 1)); //units: minutes
+                    final int units = GUIUtils.getSelectedJRadioButton(
+                            (JRadioButton) componentsWithActions.getComponent(
+                                    "07", GUIUtils.INPUT, 0), // units: hours
+                            (JRadioButton) componentsWithActions.getComponent(
+                                    "07", GUIUtils.INPUT, 1)); //units: minutes
 
                     if (units == 0) {
                         xUnit = TimeInterval.TimeIntervalUnit.HOUR;
@@ -118,20 +155,27 @@
                     }
 
                     //start calculate hyetograph
-                    TimeInterval duration = new TimeInterval(duration_param, 
TimeInterval.TimeIntervalUnit.HOUR);
+                    final TimeInterval duration = new TimeInterval(
+                            duration_param, 
TimeInterval.TimeIntervalUnit.HOUR);
 
-                    LsppCalculator lsppCalculator = new LsppCalculator(paramA, 
paramN, paramN);
-                    Geomorphology geomorphology = new Geomorphology(0, 0);
+                    final LsppCalculator lsppCalculator = new LsppCalculator(
+                            paramA, paramN, paramN);
+                    final Geomorphology geomorphology = new Geomorphology(0, 
0);
 
-                    InitialAbstraction ia = new 
InitialAbstraction(InitialAbstraction.AbstractionUnits.MILLIMETERS, 0);
-                    BaseflowParams bfp = new 
BaseflowParams(BaseflowParams.BaseflowType.DISTRIBUTED, null, 0);
-                    RainfallRecession rr = new RainfallRecession(0, 0);
-                    Watershed watershed = new Watershed(0d, null, null, 0, 0, 
0, ia, bfp, 0, rr, 1d, geomorphology);
+                    final InitialAbstraction ia = new InitialAbstraction(
+                            InitialAbstraction.AbstractionUnits.MILLIMETERS, 
0);
+                    final BaseflowParams bfp = new BaseflowParams(
+                            BaseflowParams.BaseflowType.DISTRIBUTED, null, 0);
+                    final RainfallRecession rr = new RainfallRecession(0, 0);
+                    final Watershed watershed = new Watershed(0d, null, null,
+                            0, 0, 0, ia, bfp, 0, rr, 1d, geomorphology);
 
-                    TimeInterval step = new TimeInterval(step_param, 
TimeInterval.TimeIntervalUnit.MINUTE);
-                    DesignRain designRain = new DesignRain(duration, 
lsppCalculator.getParamsAN(), watershed);
+                    final TimeInterval step = new TimeInterval(step_param,
+                            TimeInterval.TimeIntervalUnit.MINUTE);
+                    final DesignRain designRain = new DesignRain(duration,
+                            lsppCalculator.getParamsAN(), watershed);
 
-                    HyetographGenerator hyetoGenerator = new 
HyetographGenerator(
+                    final HyetographGenerator hyetoGenerator = new 
HyetographGenerator(
                             0.50, step, designRain);
 
                     //type of hyetograph
@@ -138,44 +182,50 @@
                     HyetographGenerator.HyetographShape hyetographShape;
 
                     switch (selHyetoType) {
-                        case 0: {
-                            hyetographShape = 
HyetographGenerator.HyetographShape.ALTERNATINGBLOCK;
-                            hyetograph = 
hyetoGenerator.generateHytegraph(hyetographShape, true);
-                            break;
-                        }
-                        case 1: {
-                            hyetographShape = 
HyetographGenerator.HyetographShape.CONSTANT;
-                            hyetograph = 
hyetoGenerator.generateHytegraph(hyetographShape, true);
-                            break;
-                        }
-                        case 2: {
-                            hyetographShape = 
HyetographGenerator.HyetographShape.INSTANT;
-                            hyetograph = 
hyetoGenerator.generateHytegraph(hyetographShape, true);
-                            break;
-                        }
-                        case 3: {
-                            hyetographShape = 
HyetographGenerator.HyetographShape.TRIANGULAR;
-                            hyetograph = 
hyetoGenerator.generateHytegraph(hyetographShape, true);
-                            break;
-                        }
-                        case 4: {
-                            hyetographShape = 
HyetographGenerator.HyetographShape.WALLINGFORD;
-                            hyetograph = 
hyetoGenerator.generateHytegraph(hyetographShape, true);
-                            break;
-                        }
+                    case 0: {
+                        hyetographShape = 
HyetographGenerator.HyetographShape.ALTERNATINGBLOCK;
+                        hyetograph = hyetoGenerator.generateHytegraph(
+                                hyetographShape, true);
+                        break;
                     }
+                    case 1: {
+                        hyetographShape = 
HyetographGenerator.HyetographShape.CONSTANT;
+                        hyetograph = hyetoGenerator.generateHytegraph(
+                                hyetographShape, true);
+                        break;
+                    }
+                    case 2: {
+                        hyetographShape = 
HyetographGenerator.HyetographShape.INSTANT;
+                        hyetograph = hyetoGenerator.generateHytegraph(
+                                hyetographShape, true);
+                        break;
+                    }
+                    case 3: {
+                        hyetographShape = 
HyetographGenerator.HyetographShape.TRIANGULAR;
+                        hyetograph = hyetoGenerator.generateHytegraph(
+                                hyetographShape, true);
+                        break;
+                    }
+                    case 4: {
+                        hyetographShape = 
HyetographGenerator.HyetographShape.WALLINGFORD;
+                        hyetograph = hyetoGenerator.generateHytegraph(
+                                hyetographShape, true);
+                        break;
+                    }
+                    }
 
-                    JTabbedPane mainTabelPane = 
super.getInitialDialog().getTabbedPane();
-                    HyetographPlugIn.HyetographOutput provaOut = new 
HyetographPlugIn.HyetographOutput(context, super.getInitialDialog());
-                    mainTabelPane.setComponentAt(1, 
provaOut.getTabPluginComponents());
+                    final JTabbedPane mainTabelPane = super.getInitialDialog()
+                            .getTabbedPane();
+                    final HyetographPlugIn.HyetographOutput provaOut = new 
HyetographPlugIn.HyetographOutput(
+                            context, super.getInitialDialog());
+                    mainTabelPane.setComponentAt(1,
+                            provaOut.getTabPluginComponents());
                     mainTabelPane.setEnabledAt(1, true);
                     mainTabelPane.setSelectedIndex(1);
 
-                } catch (Exception ex) {
-                    ErrorDialog.show(
-                            super.getInitialDialog(),
-                            PluginUtils.plugInName,
-                            ex.toString(),
+                } catch (final Exception ex) {
+                    ErrorDialog.show(super.getInitialDialog(),
+                            PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
                 }
             }
@@ -188,56 +238,79 @@
             public void centerButton() {
             }
         };
-        return this.mainPanel;
+        return mainPanel;
     }
 
     @Override
     public String toString() {
-        return 
PluginUtils.getResources().getString("HyetographPlugIn.PlugInName.label");
+        return PluginUtils.getResources().getString(
+                "HyetographPlugIn.PlugInName.label");
     }
 
     class HyetographOutput extends AbstractInputKlemPlugin {
 
-        public HyetographOutput(PlugInContext context, InitialDialog 
initialDialog) {
+        public HyetographOutput(PlugInContext context,
+                InitialDialog initialDialog) {
             super(context, initialDialog);
         }
 
         @Override
         public InitialData setInitialData() {
-            InitialData initialData = new InitialData();
+            final InitialData initialData = new InitialData();
 
             //output data   
-            PersonalChart personalChart = new 
PersonalChartHyetograph(hyetograph, step_param, xUnit);
+            final PersonalChart personalChart = new PersonalChartHyetograph(
+                    hyetograph, step_param, xUnit);
             initialData.setParam_ChartPanel(personalChart, GUIUtils.OUTPUT); 
//chart
 
-            Header header = new Header(new String[]{
-                
PluginUtils.getResources().getString("HyetographPlugin.TotalRainfull.label") + 
hyetograph.getTotalRain() + "," + 
PluginUtils.getResources().getString("HyetographPlugin.HyetoShpe.label") + 
getHyetoType(selHyetoType),
-                
PluginUtils.getResources().getString("HyetographPlugin.Graph_TimeHour.label") + 
"," + 
PluginUtils.getResources().getString("HyetographPlugin.Graph_Rainfall.label")});
-            PersonalTable personalTable = new PersonalTable(
-                    setTableModel(fromHyetographToData()),
-                    header,
-                    false, true, false, false, false, null, null, false);
-            
-            FileNameExtensionFilter filter = new 
FileNameExtensionFilter("Hyetograph", new String[]{"txt"});
-            initialData.setParam_PersonalTable(personalTable, filter, 
GUIUtils.OUTPUT); //table
+            final Header header = new Header(new String[] {
+                    PluginUtils.getResources().getString(
+                            "HyetographPlugin.TotalRainfull.label")
+                            + hyetograph.getTotalRain()
+                            + ","
+                            + PluginUtils.getResources().getString(
+                                    "HyetographPlugin.HyetoShpe.label")
+                            + getHyetoType(selHyetoType),
+                    PluginUtils.getResources().getString(
+                            "HyetographPlugin.Graph_TimeHour.label")
+                            + ","
+                            + PluginUtils.getResources().getString(
+                                    "HyetographPlugin.Graph_Rainfall.label") 
});
+            final PersonalTable personalTable = new PersonalTable(
+                    setTableModel(fromHyetographToData()), header, false, true,
+                    false, false, false, null, null, false);
 
+            final FileNameExtensionFilter filter = new FileNameExtensionFilter(
+                    "Hyetograph", new String[] { "txt" });
+            initialData.setParam_PersonalTable(personalTable, filter,
+                    GUIUtils.OUTPUT); //table
+
             return initialData;
         }
 
         @Override
-        public ComponentsTreeMap setComponentsActions(ComponentsTreeMap 
personalTreeMap) {
+        public ComponentsTreeMap setComponentsActions(
+                ComponentsTreeMap personalTreeMap) {
             return personalTreeMap;
         }
 
         @Override
         public JPanel buildPluginPanel(ComponentsTreeMap 
componentsWithActions) {
-            if(this.outPanel != null) {
-                return this.outPanel;
+            if (outPanel != null) {
+                return outPanel;
             }
-            
-            this.outPanel = new MainPanel(super.getInitialDialog(), 
componentsWithActions, false, false, false,
-                    
PluginUtils.getResources().getString("MainPanel.ExecuteButton.text"), 
layerablesList) {
 
+            outPanel = new MainPanel(super.getInitialDialog(),
+                    componentsWithActions, false, false, false, PluginUtils
+                            .getResources().getString(
+                                    "MainPanel.ExecuteButton.text"),
+                    layerablesList) {
+
+                /**
+                         * 
+                         */
+                private static final long serialVersionUID = 1L;
+
                 @Override
                 public void rightButton() {
                 }
@@ -254,16 +327,16 @@
         }
 
         private MainPanel outPanel;
-        
+
     }
 
     private DefaultTableModel setTableModel(double[][] data1) {
 
-        Double[][] data = new Double[data1[0].length][data1.length];
+        final Double[][] data = new Double[data1[0].length][data1.length];
         int row = 0;
         for (int c = 0; c < data1[0].length; c++) {
             int col = 0;
-            for (double[] data11 : data1) {
+            for (final double[] data11 : data1) {
                 data[row][col] = PluginUtils.getThreeDecimalFormat(data11[c]);
                 col++;
             }
@@ -272,15 +345,18 @@
 
         String time = "";
         if (xUnit == TimeInterval.TimeIntervalUnit.HOUR) {
-            time = 
PluginUtils.getResources().getString("HyetographPlugin.Graph_TimeHour.label");
+            time = PluginUtils.getResources().getString(
+                    "HyetographPlugin.Graph_TimeHour.label");
         } else if (xUnit == TimeInterval.TimeIntervalUnit.MINUTE) {
-            time = 
PluginUtils.getResources().getString("HyetographPlugin.Graph_TimeMin.label");
+            time = PluginUtils.getResources().getString(
+                    "HyetographPlugin.Graph_TimeMin.label");
 
         }
 
-        DefaultTableModel dtm = new DefaultTableModel(data, new String[]{
-            time,
-            
PluginUtils.getResources().getString("HyetographPlugin.Graph_Rainfall.label")});
+        final DefaultTableModel dtm = new DefaultTableModel(data, new String[] 
{
+                time,
+                PluginUtils.getResources().getString(
+                        "HyetographPlugin.Graph_Rainfall.label") });
 
         return dtm;
     }
@@ -287,9 +363,11 @@
 
     private double[][] fromHyetographToData() {
 
-        double[][] data = new double[2][hyetograph.getRainfall().length];
+        final double[][] data = new double[2][hyetograph.getRainfall().length];
         for (int s = 0; s < hyetograph.getRainfall().length; s++) {
-            data[0][s] = 
hyetograph.getStep().getInterval(TimeInterval.TimeIntervalUnit.MINUTE) * s;
+            data[0][s] = hyetograph.getStep().getInterval(
+                    TimeInterval.TimeIntervalUnit.MINUTE)
+                    * s;
             data[1][s] = hyetograph.getRainfall()[s];
         }
 
@@ -308,22 +386,27 @@
     private String getHyetoType(int selection) {
 
         switch (selection) {
-            case 0: {
-                return 
PluginUtils.getResources().getString("HyetographPlugIn.AlternatingBlocks.label");
-            }
-            case 1: {
-                return 
PluginUtils.getResources().getString("HyetographPlugIn.Costant.label");
-            }
-            case 2: {
-                return 
PluginUtils.getResources().getString("HyetographPlugIn.IstantaneusIntensity.label");
-            }
-            case 3: {
-                return 
PluginUtils.getResources().getString("HyetographPlugIn.Triangular.label");
-            }
-            case 4: {
-                return 
PluginUtils.getResources().getString("HyetographPlugIn.Wallingford.labela");
-            }
+        case 0: {
+            return PluginUtils.getResources().getString(
+                    "HyetographPlugIn.AlternatingBlocks.label");
         }
+        case 1: {
+            return PluginUtils.getResources().getString(
+                    "HyetographPlugIn.Costant.label");
+        }
+        case 2: {
+            return PluginUtils.getResources().getString(
+                    "HyetographPlugIn.IstantaneusIntensity.label");
+        }
+        case 3: {
+            return PluginUtils.getResources().getString(
+                    "HyetographPlugIn.Triangular.label");
+        }
+        case 4: {
+            return PluginUtils.getResources().getString(
+                    "HyetographPlugIn.Wallingford.labela");
+        }
+        }
         return "";
     }
 
@@ -333,12 +416,18 @@
     private double step_param;
     int selHyetoType;
     private TimeInterval.TimeIntervalUnit xUnit;
-    private final String PARAM_A = 
PluginUtils.getResources().getString("HyetographPlugIn.ParamA.label");
-    private final String PARAM_N = 
PluginUtils.getResources().getString("HyetographPlugIn.ParamN.label");
-    private final String TIME = 
PluginUtils.getResources().getString("HyetographPlugIn.Time.label");
-    private final String STEP = 
PluginUtils.getResources().getString("HyetographPlugIn.Step.label");
-    private final String X_UNITS = 
PluginUtils.getResources().getString("HyetographPlugIn.XUnits.label");
-    private final String MODEL = 
PluginUtils.getResources().getString("HyetographPlugIn.models.label");
+    private final String PARAM_A = PluginUtils.getResources().getString(
+            "HyetographPlugIn.ParamA.label");
+    private final String PARAM_N = PluginUtils.getResources().getString(
+            "HyetographPlugIn.ParamN.label");
+    private final String TIME = PluginUtils.getResources().getString(
+            "HyetographPlugIn.Time.label");
+    private final String STEP = PluginUtils.getResources().getString(
+            "HyetographPlugIn.Step.label");
+    private final String X_UNITS = PluginUtils.getResources().getString(
+            "HyetographPlugIn.XUnits.label");
+    private final String MODEL = PluginUtils.getResources().getString(
+            "HyetographPlugIn.models.label");
 
     private final LayerablesList layerablesList;
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/RoutingTimePlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/RoutingTimePlugIn.java
 2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/RoutingTimePlugIn.java
 2019-01-19 19:01:46 UTC (rev 6109)
@@ -7,6 +7,8 @@
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
+
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
 import com.geomaticaeambiente.klemgui.ui.InitialDialog;
@@ -28,11 +30,9 @@
 import com.vividsolutions.jts.geom.LineString;
 import com.vividsolutions.jump.task.TaskMonitor;
 import com.vividsolutions.jump.util.StringUtil;
-import com.vividsolutions.jump.workbench.Logger;
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -195,34 +195,34 @@
             public void rightButton() {
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                routingTimeCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    routingTimeCommand(componentsWithActions);
 
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                     //get input raster names
                     /*      final String demRasterSelected = GUIUtils
                                   
.getStringValue(componentsWithActions.getComponent(

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/UpslopeAreaPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/UpslopeAreaPlugIn.java
 2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/UpslopeAreaPlugIn.java
 2019-01-19 19:01:46 UTC (rev 6109)
@@ -9,6 +9,7 @@
 import javax.swing.JTextField;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
 
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
 import com.geomaticaeambiente.klemgui.ui.GUIUtils;
@@ -33,7 +34,6 @@
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -176,43 +176,42 @@
 
             @Override
             public void rightButton() {
-
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                upSlopeAreaCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    upSlopeAreaCommand(componentsWithActions);
 
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
+
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
-
             }
 
             @Override

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/WatershedPlugIn.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/WatershedPlugIn.java
   2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/WatershedPlugIn.java
   2019-01-19 19:01:46 UTC (rev 6109)
@@ -20,6 +20,7 @@
 import javax.swing.JTextField;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
+import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn;
 
 import 
com.geomaticaeambiente.klemgui.plugin.hydrology.hydrographs.klem.WatershedInformation;
 import com.geomaticaeambiente.klemgui.ui.CustomComboBox;
@@ -52,7 +53,6 @@
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn;
 import com.vividsolutions.jump.workbench.ui.ErrorDialog;
 import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager;
 
@@ -373,189 +373,39 @@
             public void rightButton() {
                 try {
 
-                    AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() {
-                        @Override
-                        public String getName() {
-                            return null;
-                        }
+                    AbstractPlugIn.toActionListener(
+                            new AbstractThreadedUiPlugIn() {
+                                @Override
+                                public String getName() {
+                                    return null;
+                                }
 
-                        @Override
-                        public boolean execute(PlugInContext context)
-                                throws Exception {
-                            return true;
-                        }
+                                @Override
+                                public boolean execute(PlugInContext context)
+                                        throws Exception {
+                                    return true;
+                                }
 
-                        @Override
-                        public void run(TaskMonitor monitor,
-                                PlugInContext context) throws Exception {
-                            monitor.report(PluginUtils.getResources()
-                                    .getString("OpenKlem.executing-process"));
-                            // monitor.allowCancellationRequests();
-                            reportNothingToUndoYet(context);
-                            try {
-                                watershedCommand(componentsWithActions);
-                            } catch (final Exception ex) {
-                                Logger.error(getName(), ex);
-                            }
-                        }
-                    }, context.getWorkbenchContext(), new TaskMonitorManager())
-                            .actionPerformed(null);
+                                @Override
+                                public void run(TaskMonitor monitor,
+                                        PlugInContext context) throws 
Exception {
+                                    monitor.report(PluginUtils
+                                            .getResources()
+                                            .getString(
+                                                    
"OpenKlem.executing-process"));
+                                    reportNothingToUndoYet(context);
+                                    monitor.allowCancellationRequests();
+                                    watershedCommand(componentsWithActions);
 
-                    //get input raster names
-                    /*           final String flowDirRaster = GUIUtils
-                                       
.getStringValue(componentsWithActions.getComponent(
-                                               "00", GUIUtils.INPUT, 1));
+                                }
+                            }, context.getWorkbenchContext(),
+                            new TaskMonitorManager()).actionPerformed(null);
 
-                               //get other information 
-                               final boolean selectionMouse = GUIUtils
-                                       
.componentIsSelected(componentsWithActions
-                                               .getComponent("01", 
GUIUtils.OTHER, 0));
-                               String xCoord = null;
-                               String yCoord = null;
-                               String layerSelected = null;
-
-                               if (selectionMouse) {
-                                   xCoord = 
GUIUtils.getStringValue(componentsWithActions
-                                           .getComponent("02", GUIUtils.OTHER, 
1));//xCoord value
-                                   yCoord = 
GUIUtils.getStringValue(componentsWithActions
-                                           .getComponent("03", GUIUtils.OTHER, 
1));//yCoord value
-                               } else {
-                                   layerSelected = GUIUtils
-                                           
.getStringValue(componentsWithActions
-                                                   .getComponent("04", 
GUIUtils.OTHER, 1)); //layer 
-                               }
-
-                               //get output raster name
-                               final boolean clipOutput = GUIUtils
-                                       .getBooleanValue(componentsWithActions
-                                               .getComponent("00", 
GUIUtils.OUTPUT, 0));
-                               final String outRasterName = GUIUtils
-                                       
.getStringValue(componentsWithActions.getComponent(
-                                               "01", GUIUtils.OUTPUT, 
1));//output raster name
-
-                               //ckeck
-                               checkValues(this, flowDirRaster, 
selectionMouse, xCoord,
-                                       yCoord, layerSelected, outRasterName);
-
-                               final List coords = new ArrayList<Coordinate>();
-
-                               //convert string values in correct objects
-                               //get input flow dir                    
-                               final DoubleBasicGrid demGrid = RasterUtils
-                                       .getDoubleBasicGrid((RasterComboBox) 
componentsWithActions
-                                               .getComponent("00", 
GUIUtils.INPUT, 1));
-                               //Calculate flow dir envelope
-                               final double xMax = 
demGrid.getLowerLeftCoord().x
-                                       + (demGrid.getCellSize() * 
demGrid.getColumnCount());
-                               final double yMax = 
demGrid.getLowerLeftCoord().y
-                                       + (demGrid.getCellSize() * 
demGrid.getRowCount());
-
-                               final Envelope env = new Envelope(
-                                       demGrid.getLowerLeftCoord().x, xMax,
-                                       demGrid.getLowerLeftCoord().y, yMax);
-
-                               if (selectionMouse) {
-
-                                   coords.add(new 
Coordinate(Double.parseDouble(xCoord),
-                                           Double.parseDouble(yCoord)));
-
-                               } else { //get Layer
-                                   //from name to Layer
-                                   final Layer layer = PluginUtils
-                                           .getLayerSelected((LayerComboBox) 
componentsWithActions
-                                                   .getComponent("04", 
GUIUtils.OTHER, 1));
-
-                                   // Get selected features, or all features 
if none selected, or return error if none present
-                                   Collection features = 
context.getLayerViewPanel()
-                                           
.getSelectionManager().getFeatureSelection()
-                                           
.getFeaturesWithSelectedItems(layer);
-
-                                   if (features.isEmpty()) {
-                                       features = 
layer.getFeatureCollectionWrapper()
-                                               .getFeatures();
-                                   }
-
-                                   Feature feature;
-                                   final Iterator iter = features.iterator();
-                                   final int count = 0;
-                                   while (iter.hasNext()) {
-                                       feature = (Feature) iter.next();
-                                       // Check feature to be point
-                                       if 
(feature.getGeometry().getGeometryType()
-                                               .toUpperCase().equals("POINT")) 
{
-                                           final Point point = (Point) feature
-                                                   .getGeometry();
-                                           //check if coordinate is inside 
raster. Only inside coordinate are added to the list
-                                           if 
(env.contains(point.getCoordinate())) {
-                                               coords.add(new Coordinate(point
-                                                       .getCoordinate().x, 
point
-                                                       .getCoordinate().y));
-                                           }
-                                           break;
-                                       }
-                                   }
-                               }
-
-                               if (coords.isEmpty()) {
-                                   throw new NullPointerException(
-                                           PluginUtils
-                                                   .getResources()
-                                                   .getString(
-                                                           
"WatershedPlugin.CoordinateOutside.label"));
-                               }
-
-                               //convert arrayList to array
-                               final Coordinate[] ar_coords = new 
Coordinate[coords.size()];
-                               for (int n = 0; n < coords.size(); n++) {
-                                   ar_coords[n] = (Coordinate) coords.get(n);
-                               }
-
-                               //execute
-                               final WatershedExtractor watershedExtractor = 
new WatershedExtractor();
-
-                               final Layer bluelinesLayer = PluginUtils
-                                       
.getLayerSelected((CustomComboBox.LayerComboBox) componentsWithActions
-                                               .getComponent("01", 
GUIUtils.INPUT, 1));
-                               LineString[] bluelines = null;
-                               if (bluelinesLayer != null) {
-                                   bluelines = GeometryUtils
-                                           
.getLineStringsFromFeatures(bluelinesLayer
-                                                   
.getFeatureCollectionWrapper());
-                               }
-
-                               final FlowDirsCalculator flowDirCalc = new 
FlowDirsCalculator(
-                                       demGrid, 
FlowDirsStripe.FlowDirAlgorithm.D8,
-                                       bluelines, 100d);
-                               final FlowDirBasicGrid flowDirGrid = flowDirCalc
-                                       .calculate();
-
-                               final DoubleBasicGrid watershedGrid = 
watershedExtractor
-                                       .extract(flowDirGrid, ar_coords, 
clipOutput);
-
-                               //Create the output file and display on OJ 
-                               //Save grid as tiff
-                               
RasterUtils.saveOutputRasterAsTiff(watershedGrid, new File(
-                                       outRasterName));
-                               //Display raster on OJ from file                
-                               RasterUtils.displayRasterFileOnOJ(context
-                                       .getWorkbenchContext(), new 
File(outRasterName),
-                                       null);
-
-                               JOptionPane.showMessageDialog(
-                                       super.getInitialDialog(),
-                                       PluginUtils.getResources().getString(
-                                               
"SetWorkspacePlugin.Done.message"),
-                                       PluginUtils.plugInName,
-                                       JOptionPane.INFORMATION_MESSAGE);
-
-                           } catch (final WarningException ex) {
-                               
JOptionPane.showMessageDialog(super.getInitialDialog(),
-                                       ex.getMessage(), PluginUtils.plugInName,
-                                       JOptionPane.WARNING_MESSAGE);*/
                 } catch (final Exception ex) {
                     ErrorDialog.show(super.getInitialDialog(),
                             PluginUtils.plugInName, ex.toString(),
                             StringUtil.stackTrace(ex));
+                    Logger.error(PluginUtils.plugInName, ex);
                 }
             }
 

Modified: 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab.java
===================================================================
--- 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab.java
        2019-01-19 12:25:19 UTC (rev 6108)
+++ 
plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/hydrology/hydrographs/klem/OutputTab.java
        2019-01-19 19:01:46 UTC (rev 6109)
@@ -27,7 +27,6 @@
 import javax.swing.table.DefaultTableModel;
 
 import org.jfree.chart.ChartUtilities;
-
 import org.openjump.core.rasterimage.ImageAndMetadata;
 import org.openjump.core.rasterimage.Metadata;
 import org.openjump.core.rasterimage.RasterImageIO;
@@ -253,17 +252,14 @@
                     jTable3 = new JTable();
                     jTable3.setModel(setSimulatedFlowParams());
 
-                    TextUtils.saveCSV(jTable,
-                            dir.concat(File.separator)
-                                    .concat(basinDataFileName));
-                    TextUtils.saveCSV(jTable1,
-                            dir.concat(File.separator).concat(tableFileName));
-                    TextUtils.saveCSV(jTable2,
-                            dir.concat(File.separator).concat(simParFileName));
-                    TextUtils.saveCSV(
-                            jTable3,
-                            dir.concat(File.separator).concat(
-                                    simFlowParFileName));
+                    TextUtils.saveCSV(jTable, dir.concat(File.separator)
+                            .concat(basinDataFileName));
+                    TextUtils.saveCSV(jTable1, dir.concat(File.separator)
+                            .concat(tableFileName));
+                    TextUtils.saveCSV(jTable2, dir.concat(File.separator)
+                            .concat(simParFileName));
+                    TextUtils.saveCSV(jTable3, dir.concat(File.separator)
+                            .concat(simFlowParFileName));
 
                     JOptionPane.showMessageDialog(
                             context.getActiveInternalFrame(),
@@ -487,7 +483,7 @@
                 BASE_FLOW, TOT_RAINFALL, EFF_RAINFALL };
 
         final String[][] data = new String[simOut.getSimulationRainfall()
-                .getTotalRain().length/2][col.length];
+                .getTotalRain().length / 20][col.length];
         for (int r = 0; r < data.length; r++) {
             data[r][0] = PluginUtils.getTwoDecimalFormatToString(simOut
                     .getSimulationDischarge().getTimeInterval()



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to