Revision: 5746
          http://sourceforge.net/p/jump-pilot/code/5746
Author:   ma15569
Date:     2018-04-07 10:55:50 +0000 (Sat, 07 Apr 2018)
Log Message:
-----------
Moved all result output to OpenJUMP Additional result frame

Modified Paths:
--------------
    
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteResultsPlugin.java
    
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/gui/OpenJUMPPostProcessTask.java

Modified: 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteResultsPlugin.java
===================================================================
--- 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteResultsPlugin.java
 2018-04-07 09:08:25 UTC (rev 5745)
+++ 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteResultsPlugin.java
 2018-04-07 10:55:50 UTC (rev 5746)
@@ -4,26 +4,31 @@
 
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
+import javax.swing.JInternalFrame;
 import javax.swing.JOptionPane;
 
 import org.openjump.core.ui.plugin.AbstractUiPlugIn;
+import org.openjump.sextante.core.ObjectAndDescription;
+import org.openjump.sextante.gui.additionalResults.AdditionalResults;
+import org.openjump.sextante.gui.additionalResults.AdditionalResultsFrame;
 
-import es.unex.sextante.core.Sextante;
-import es.unex.sextante.gui.additionalResults.AdditionalResults;
-import es.unex.sextante.gui.core.SextanteGUI;
-import es.unex.sextante.openjump.language.I18NPlug;
+import com.vividsolutions.jump.I18N;
 //import es.unex.sextante.gui.additionalResults.AdditionalResults;
 //import org.openjump.sextante.gui.additionalResults.AdditionalResultsFrame;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.I18N;
 
+//import es.unex.sextante.core.Sextante;
 //import es.unex.sextante.gui.additionalResults.AdditionalResults;
+//import es.unex.sextante.gui.core.SextanteGUI;
+import es.unex.sextante.openjump.language.I18NPlug;
 
+//import es.unex.sextante.gui.additionalResults.AdditionalResults;
+
 public class SextanteResultsPlugin extends AbstractUiPlugIn {
 
     public String NO_RESULTS = I18NPlug
             
.getI18N("es.unex.sextante.kosmo.extensions.SextanteResultsPlugin.Results.no_results");
-    private String sName = I18N
+    private final String sName = I18N
             
.get("org.openjump.sextante.gui.additionalResults.AdditionalResultsPlugIn.Result-viewer");
     private static String sWarning = I18N
             
.get("org.openjump.sextante.gui.additionalResults.AdditionalResultsPlugIn.List-of-results-is-empty");
@@ -30,40 +35,45 @@
 
     @Override
     public boolean execute(final PlugInContext context) throws Exception {
+//[Giuseppe Aruta 2018-04-07] Now it opens OpenJUMP Additional results frame
+        
+        final ArrayList<ObjectAndDescription> m_Components = 
AdditionalResults.m_Components;
+        if (m_Components == null || m_Components.size() == 0) {
+            JOptionPane.showMessageDialog(null, sWarning, sName,
+                    JOptionPane.WARNING_MESSAGE);
+            return false;
+        } else {
 
-        /*
-         * ArrayList<ObjectAndDescription> m_Components =
-         * AdditionalResults.m_Components; if (m_Components == null ||
-         * m_Components.size() == 0) { JOptionPane.showMessageDialog(null,
-         * sWarning, sName, JOptionPane.WARNING_MESSAGE); return false; } else 
{
-         * 
-         * for (JInternalFrame iFrame : context.getWorkbenchFrame()
-         * .getInternalFrames()) { if (iFrame instanceof 
AdditionalResultsFrame)
-         * {
-         * 
-         * iFrame.toFront(); return true;
-         * 
-         * } } AdditionalResultsFrame additionalResultsFrame = new
-         * AdditionalResultsFrame( m_Components);
-         * 
-         * context.getWorkbenchFrame()
-         * .addInternalFrame(additionalResultsFrame);
-         * 
-         * }
-         */
+            for (final JInternalFrame iFrame : context.getWorkbenchFrame()
+                    .getInternalFrames()) {
+                if (iFrame instanceof AdditionalResultsFrame) {
 
-        final ArrayList<?> results = AdditionalResults.getComponents();
-        if (results.size() != 0) {
-            SextanteGUI.getGUIFactory().showAdditionalResultsDialog(results);
-        }
+                    iFrame.toFront();
+                    return true;
 
-        else {
-            JOptionPane.showMessageDialog(null, NO_RESULTS,
-                    Sextante.getText("Warning"), JOptionPane.WARNING_MESSAGE);
+                }
+            }
+            final AdditionalResultsFrame additionalResultsFrame = new 
AdditionalResultsFrame(
+                    m_Components);
+
+            context.getWorkbenchFrame()
+                    .addInternalFrame(additionalResultsFrame);
+
         }
-
         return true;
 
+        // final ArrayList<?> results = AdditionalResults.getComponents();
+        // if (results.size() != 0) {
+        // SextanteGUI.getGUIFactory().showAdditionalResultsDialog(results);
+        // }
+        //
+        // else {
+        // JOptionPane.showMessageDialog(null, NO_RESULTS,
+        // Sextante.getText("Warning"), JOptionPane.WARNING_MESSAGE);
+        // }
+
+        // return true;
+
     }
 
     @Override
@@ -92,6 +102,10 @@
     @Override
     public void initialize(final PlugInContext context) throws Exception {
 
+        // context.getFeatureInstaller().addMainMenuPlugin(this,
+        // new String[] { MenuNames.WINDOW }, sName, false,
+        // getColorIcon(), getEnableCheck()
+
         context.getFeatureInstaller().addMainMenuPlugin(this,
                 new String[] { "Sextante" }, getName(), false, getIcon(), 
null);
 

Modified: 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/gui/OpenJUMPPostProcessTask.java
===================================================================
--- 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/gui/OpenJUMPPostProcessTask.java
      2018-04-07 09:08:25 UTC (rev 5745)
+++ 
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/gui/OpenJUMPPostProcessTask.java
      2018-04-07 10:55:50 UTC (rev 5746)
@@ -9,7 +9,7 @@
 import javax.swing.border.BevelBorder;
 
 import org.openjump.core.rasterimage.RasterImageLayer;
-//import org.openjump.sextante.core.ObjectAndDescription;
+import org.openjump.sextante.core.ObjectAndDescription;
 
 import com.vividsolutions.jump.workbench.WorkbenchContext;
 import com.vividsolutions.jump.workbench.model.Layer;
@@ -16,13 +16,12 @@
 import com.vividsolutions.jump.workbench.model.StandardCategoryNames;
 
 import es.unex.sextante.core.GeoAlgorithm;
-import es.unex.sextante.core.ObjectAndDescription;
+//import es.unex.sextante.core.ObjectAndDescription;
 import es.unex.sextante.core.OutputObjectsSet;
 import es.unex.sextante.core.Sextante;
 import es.unex.sextante.dataObjects.IRasterLayer;
 import es.unex.sextante.dataObjects.ITable;
 import es.unex.sextante.dataObjects.IVectorLayer;
-import es.unex.sextante.gui.additionalResults.AdditionalResults;
 //import es.unex.sextante.gui.additionalResults.AdditionalResults;
 import es.unex.sextante.gui.additionalResults.TableTools;
 import es.unex.sextante.gui.core.SextanteGUI;
@@ -61,7 +60,7 @@
     private boolean addResults() {
 
         String sDescription;
-        boolean bShowAdditionalPanel = false;
+        final boolean bShowAdditionalPanel = false;
         final boolean bUseInternalNames = new Boolean(
                 SextanteGUI
                         
.getSettingParameterValue(SextanteGeneralSettings.USE_INTERNAL_NAMES))
@@ -129,13 +128,12 @@
                             .getScrollableTablePanelFromITable((ITable) 
object);
                     // [Giuseppe Aruta 2017-12-11] moved output to OpenJUMP
                     // Internal Frame
-                    AdditionalResults.addComponent(new ObjectAndDescription(
-                            sDescription, jScrollPane));
-                    bShowAdditionalPanel = true;
-
-                    // 
org.openjump.sextante.gui.additionalResults.AdditionalResults
-                    // .addComponentAndShow(new ObjectAndDescription(
+                    
org.openjump.sextante.gui.additionalResults.AdditionalResults
+                            .addComponentAndShow(new ObjectAndDescription(
+                                    sDescription, jScrollPane));
+                    // AdditionalResults.addComponent(new ObjectAndDescription(
                     // sDescription, jScrollPane));
+                    // bShowAdditionalPanel = true;
 
                 } catch (final Exception e) {
                     Sextante.addErrorToLog(e);
@@ -155,27 +153,28 @@
                         .createEtchedBorder(BevelBorder.LOWERED));
                 // [Giuseppe Aruta 2017-12-11] moved output to OpenJUMP 
Internal
                 // Frame
-                // 
org.openjump.sextante.gui.additionalResults.AdditionalResults
-                // .addComponentAndShow(new ObjectAndDescription(
+                org.openjump.sextante.gui.additionalResults.AdditionalResults
+                        .addComponentAndShow(new ObjectAndDescription(
+                                sDescription, jScrollPane));
+                // AdditionalResults.addComponent(new ObjectAndDescription(
                 // sDescription, jScrollPane));
-                AdditionalResults.addComponent(new ObjectAndDescription(
-                        sDescription, jScrollPane));
                 // 
org.openjump.core.ui.plugin.additionalResults.AdditionalResults
                 // .addComponent(new ObjectAndDescription(sDescription,
                 // jScrollPane));
-                bShowAdditionalPanel = true;
+                // bShowAdditionalPanel = true;
             } else if (object instanceof Component) {
                 // [Giuseppe Aruta 2017-12-11] moved output to OpenJUMP 
Internal
                 // Frame
-                // 
org.openjump.sextante.gui.additionalResults.AdditionalResults
-                // .addComponentAndShow(new ObjectAndDescription(
+                org.openjump.sextante.gui.additionalResults.AdditionalResults
+                        .addComponentAndShow(new ObjectAndDescription(
+                                sDescription, object));
+                // AdditionalResults.addComponent(new ObjectAndDescription(
                 // sDescription, object));
-                AdditionalResults.addComponent(new ObjectAndDescription(
-                        sDescription, object));
+                // //
                 // 
org.openjump.core.ui.plugin.additionalResults.AdditionalResults
                 // .addComponent(new ObjectAndDescription(sDescription,
                 // object));
-                bShowAdditionalPanel = true;
+                // bShowAdditionalPanel = true;
             } else if (out instanceof Output3DRasterLayer) {
                 JOptionPane.showMessageDialog(SextanteGUI.getMainFrame(),
                         Sextante.getText("3d_not_supported"),
@@ -185,13 +184,13 @@
 
         }
 
-        if (bShowAdditionalPanel && m_bShowResultsDialog) {
+     //   if (bShowAdditionalPanel && m_bShowResultsDialog) {
             // [Giuseppe Aruta 2017-12-11] moved output to OpenJUMP Internal
             // Frame
-            // org.openjump.sextante.gui.additionalResults.AdditionalResults
-            // .showPanel();
-            AdditionalResults.showPanel();
-        }
+     //       org.openjump.sextante.gui.additionalResults.AdditionalResults
+     //               .showPanel();
+            // AdditionalResults.showPanel();
+    //    }
 
         return true;
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to