jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1779215 - in /jmeter/trunk: src/core/org/apache/jmeter/JMeter.java src/core/org/apache/jmeter/SplashScreen.java xdocs/changes.xml
Date Tue, 17 Jan 2017 17:08:28 GMT
Author: pmouawad
Date: Tue Jan 17 17:08:28 2017
New Revision: 1779215

URL: http://svn.apache.org/viewvc?rev=1779215&view=rev
Log:
Bug 60595: Add a SplashScreen at the start of JMeter GUI
Contributed by maxime.chassagneux at gmail.com
This closes #251
Bugzilla Id: 60595

Added:
    jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1779215&r1=1779214&r2=1779215&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Tue Jan 17 17:08:28 2017
@@ -329,22 +329,29 @@ public class JMeter implements JMeterPlu
         System.out.println("For load testing, use NON GUI Mode (jmeter -n -t [jmx file] -l
[results file] -e -o [Path to output folder])");//NOSONAR
         System.out.println("& adapt Java Heap to your test requirements");//NOSONAR
         System.out.println("================================================================================");//NOSONAR
+        
+        SplashScreen splash = new SplashScreen();
+        splash.showScreen();
         String jMeterLaf = LookAndFeelCommand.getJMeterLaf();
         try {
             UIManager.setLookAndFeel(jMeterLaf);
         } catch (Exception ex) {
             log.warn("Could not set LAF to:"+jMeterLaf, ex);
         }
-
+        splash.setProgress(10);
         PluginManager.install(this, true);
 
         JMeterTreeModel treeModel = new JMeterTreeModel();
+        splash.setProgress(20);
         JMeterTreeListener treeLis = new JMeterTreeListener(treeModel);
         final ActionRouter instance = ActionRouter.getInstance();
         instance.populateCommandMap();
+        splash.setProgress(30);
         treeLis.setActionHandler(instance);
         GuiPackage.initInstance(treeLis, treeModel);
+        splash.setProgress(60);
         MainFrame main = new MainFrame(treeModel, treeLis);
+        splash.setProgress(80);
         ComponentUtil.centerComponentInWindow(main, 80);
         main.setVisible(true);
         instance.actionPerformed(new ActionEvent(main, 1, ActionNames.ADD_ALL));
@@ -372,6 +379,8 @@ public class JMeter implements JMeterPlu
             jTree.setSelectionPath(path);
             FocusRequester.requestFocus(jTree);
         }
+        splash.setProgress(100);
+        splash.close();
     }
 
     /**

Added: jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java?rev=1779215&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java Tue Jan 17 17:08:28 2017
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JProgressBar;
+import javax.swing.JWindow;
+import javax.swing.SwingUtilities;
+
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * Splash Screen
+ * @since 3.2
+ */
+public class SplashScreen extends JWindow {
+
+    private static final long serialVersionUID = 1L;
+    private BorderLayout borderLayout = new BorderLayout();
+    private JLabel imageLabel = new JLabel();
+    private JProgressBar progressBar = new JProgressBar(0, 100);
+
+    /**
+     * Constructor
+     */
+    public SplashScreen() {
+        imageLabel.setIcon(JMeterUtils.getImage("jmeter.png"));
+        setLayout(borderLayout);
+        add(imageLabel, BorderLayout.CENTER);
+        add(progressBar, BorderLayout.SOUTH);
+        pack();
+        setLocationRelativeTo(null);
+    }
+
+    /**
+     * Show screen
+     */
+    public void showScreen() {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                setVisible(true);
+                setAlwaysOnTop(true);
+            }
+        });
+    }
+
+    /**
+     * Close splash
+     */
+    public void close() {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                setVisible(false);
+                dispose();
+            }
+        });
+    }
+
+    /**
+     * @param progress Loading progress
+     */
+    public void setProgress(final int progress) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                progressBar.setValue(progress);
+            }
+        });
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/SplashScreen.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1779215&r1=1779214&r2=1779215&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Jan 17 17:08:28 2017
@@ -154,6 +154,7 @@ JMeter now requires Java 8. Ensure you u
     <li><bug>60530</bug>Add API to create JMeter threads while test is
running. Based on a contribution by Logan Mauzaize (logan.mauzaize at gmail.com) and Maxime
Chassagneux (maxime.chassagneux at gmail.com).</li>
     <li><bug>60514</bug>Ability to apply a naming convention on Children
of a Transaction Controller. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>60593</bug>Switch to G1 GC algorithm</li>
+    <li><bug>60595</bug>Add a SplashScreen at the start of JMeter GUI.
Contributed by Maxime Chassagneux (maxime.chassagneux at gmail.com).</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message