Revision: 5710
          http://sourceforge.net/p/jump-pilot/code/5710
Author:   ma15569
Date:     2018-03-12 15:22:08 +0000 (Mon, 12 Mar 2018)
Log Message:
-----------
Feature statistics is opened into Additional Results frame

Modified Paths:
--------------
    
core/trunk/src/org/openjump/core/ui/plugin/tools/statistics/StatisticOverViewPlugIn.java

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/tools/statistics/StatisticOverViewPlugIn.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/tools/statistics/StatisticOverViewPlugIn.java
    2018-03-12 15:07:52 UTC (rev 5709)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/tools/statistics/StatisticOverViewPlugIn.java
    2018-03-12 15:22:08 UTC (rev 5710)
@@ -27,7 +27,13 @@
  */
 package org.openjump.core.ui.plugin.tools.statistics;
 
+import java.awt.Dimension;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
 import org.openjump.core.apitools.FeatureCollectionTools;
+import org.openjump.sextante.gui.additionalResults.AdditionalResults;
 
 import com.vividsolutions.jump.I18N;
 import com.vividsolutions.jump.feature.Feature;
@@ -40,67 +46,88 @@
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
 import com.vividsolutions.jump.workbench.ui.MenuNames;
 
-
 /**
- * PlugIn that gives a quick impression on the value ranges, means (modes) and 
the deviation of the layer features' 
- * attribute values.
+ * PlugIn that gives a quick impression on the value ranges, means (modes) and
+ * the deviation of the layer features' attribute values.
  *
- * @author Ole Rahn, sstein
- * modified: [sstein] 16.Feb.2009 adaptation for OpenJUMP
+ * @author Ole Rahn, sstein modified: [sstein] 16.Feb.2009 adaptation for
+ *         OpenJUMP
  */
-public class StatisticOverViewPlugIn extends AbstractPlugIn{
-    
-    private static final String sStatisticsOverview =
-            
I18N.get("org.openjump.core.ui.plugin.tools.statistics.StatisticOverViewPlugIn.Attribute-Statistics-Overview");
-       
-    public void initialize(PlugInContext context) throws Exception
-    {     
-        WorkbenchContext workbenchContext = context.getWorkbenchContext();
-        context.getFeatureInstaller().addMainMenuPlugin(
-                       this, 
-                               new String[] { MenuNames.TOOLS, 
MenuNames.STATISTICS}, 
-                               this.getName() + "...", 
-                               false, 
-                               null, 
-                               this.createEnableCheck(workbenchContext));
+public class StatisticOverViewPlugIn extends AbstractPlugIn {
+
+    private static final String sStatisticsOverview = I18N
+            
.get("org.openjump.core.ui.plugin.tools.statistics.StatisticOverViewPlugIn.Attribute-Statistics-Overview");
+
+    @Override
+    public void initialize(PlugInContext context) throws Exception {
+        final WorkbenchContext workbenchContext = 
context.getWorkbenchContext();
+        context.getFeatureInstaller().addMainMenuPlugin(this,
+                new String[] { MenuNames.TOOLS, MenuNames.STATISTICS },
+                getName() + "...", false, null,
+                createEnableCheck(workbenchContext));
     }
-    
+
+    @Override
     public String getName() {
         return sStatisticsOverview;
     }
-    
+
     /**
-     *@inheritDoc
+     * @inheritDoc
      */
     public String getIconString() {
         return "statsOverview.png";
     }
-    
+
     /**
-     *@inheritDoc
+     * @inheritDoc
      */
+    @Override
     public boolean execute(PlugInContext context) throws Exception {
-        
-        Layer layer = context.getSelectedLayer(0);
-        FeatureCollection featureColl = 
layer.getFeatureCollectionWrapper().getWrappee();
-        Feature[] features = 
FeatureCollectionTools.FeatureCollection2FeatureArray(featureColl);
 
+        final Layer layer = context.getSelectedLayer(0);
+        final FeatureCollection featureColl = layer
+                .getFeatureCollectionWrapper().getWrappee();
+        final Feature[] features = FeatureCollectionTools
+                .FeatureCollection2FeatureArray(featureColl);
+
         // mmichaud fix bug 3229892 (2011-04-05)
         if (features.length == 0) {
-            
context.getWorkbenchFrame().warnUser(I18N.get("org.openjump.core.ui.plugin.tools.statistics.StatisticOverViewPlugIn.Selected-layer-is-empty"));
+            context.getWorkbenchFrame()
+                    .warnUser(
+                            
I18N.get("org.openjump.core.ui.plugin.tools.statistics.StatisticOverViewPlugIn.Selected-layer-is-empty"));
             return false;
         }
-        StatisticOverViewDialog dialog =  new 
StatisticOverViewDialog(context.getWorkbenchFrame(), this.getName(), false, 
features);
-        
-        dialog.setVisible(true);
-        
+        final StatisticOverViewTableModel tableModel = new 
StatisticOverViewTableModel(
+                features);
+
+        // -- [Giuseppe Aruta 2018-3-12] Statistic table is opened into
+        // AdditionalResult frame
+        final JTable table = new JTable(tableModel);
+        table.setRowHeight(22);
+
+        final JScrollPane scrollPane = new JScrollPane(table);
+        table.setPreferredScrollableViewportSize(new Dimension(500, 300));
+
+        AdditionalResults.addAdditionalResultAndShow(getName(), scrollPane);
+
+        // StatisticOverViewDialog dialog = new
+        // StatisticOverViewDialog(context.getWorkbenchFrame(), this.getName(),
+        // false, features);
+
+        // dialog.setVisible(true);
+
         return true;
+
+        return true;
     }
 
-    public MultiEnableCheck createEnableCheck(final WorkbenchContext 
workbenchContext) 
-    {
-        EnableCheckFactory checkFactory = new 
EnableCheckFactory(workbenchContext);
-        return new 
MultiEnableCheck().add(checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck())
-                                     
.add(checkFactory.createExactlyNLayersMustBeSelectedCheck(1));
-    } 
+    public MultiEnableCheck createEnableCheck(
+            final WorkbenchContext workbenchContext) {
+        final EnableCheckFactory checkFactory = new EnableCheckFactory(
+                workbenchContext);
+        return new MultiEnableCheck().add(
+                checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck())
+                .add(checkFactory.createExactlyNLayersMustBeSelectedCheck(1));
+    }
 }


------------------------------------------------------------------------------
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