jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1209955 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/GuiPackage.java src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java xdocs/changes.xml
Date Sat, 03 Dec 2011 17:20:49 GMT
Author: pmouawad
Date: Sat Dec  3 17:20:49 2011
New Revision: 1209955

URL: http://svn.apache.org/viewvc?rev=1209955&view=rev
Log:
Bug 52279 - Switching to another language loses icons in Tree and logs error Can't obtain
GUI class from ...

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java?rev=1209955&r1=1209954&r2=1209955&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java Sat Dec  3 17:20:49 2011
@@ -362,6 +362,10 @@ public final class GuiPackage implements
             comp = testBeanGUIs.get(testClass);
             if (comp == null) {
                 comp = new TestBeanGUI(testClass);
+                // When Switching to another language occurs, Introspector clears its internal
caches
+                // and GUI classes information gets lost, so we initialize the GUI classes
here
+                // TODO Find a better place for this
+                ((TestBeanGUI)comp).setupGuiClasses();
                 testBeanGUIs.put(testClass, comp);
             }
         } else {

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java?rev=1209955&r1=1209954&r2=1209955&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java Sat Dec  3 17:20:49
2011
@@ -25,6 +25,7 @@ import java.beans.IntrospectionException
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.beans.PropertyEditorManager;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -347,9 +348,34 @@ public class TestBeanGUI extends Abstrac
             return null;
         }
 
-        int matches = 0; // How many classes can we assign from?
+        int matches = setupGuiClasses(menuCategories);
+        if (matches == 0) {
+            log.error("Could not assign GUI class to " + testBeanClass.getName());
+        } else if (matches > 1) {// may be impossible, but no harm in
+                                    // checking ...
+            log.error("More than 1 GUI class found for " + testBeanClass.getName());
+        }
+        return menuCategories;
+    }
+    
+    /**
+     * Setup GUI class
+     * @return number of matches
+     */
+    public int setupGuiClasses() {
+    	return setupGuiClasses(new ArrayList<String>());
+    }
+    
+    /**
+     * Setup GUI class
+     * @param menuCategories List<String> menu categories
+     * @return number of matches
+     */
+    private int setupGuiClasses(List<String> menuCategories ) {
+    	int matches = 0;// How many classes can we assign from?
         // TODO: there must be a nicer way...
-        if (Assertion.class.isAssignableFrom(testBeanClass)) {
+        BeanDescriptor bd = beanInfo.getBeanDescriptor();
+    	if (Assertion.class.isAssignableFrom(testBeanClass)) {
             menuCategories.add(MenuFactory.ASSERTIONS);
             bd.setValue(TestElement.GUI_CLASS, AbstractAssertionGui.class.getName());
             matches++;
@@ -375,27 +401,21 @@ public class TestBeanGUI extends Abstrac
             matches++;
         }
         if (PreProcessor.class.isAssignableFrom(testBeanClass)) {
-            matches++;
             menuCategories.add(MenuFactory.PRE_PROCESSORS);
             bd.setValue(TestElement.GUI_CLASS, AbstractPreProcessorGui.class.getName());
+            matches++;
         }
         if (Sampler.class.isAssignableFrom(testBeanClass)) {
-            matches++;
             menuCategories.add(MenuFactory.SAMPLERS);
             bd.setValue(TestElement.GUI_CLASS, AbstractSamplerGui.class.getName());
+            matches++;
         }
         if (Timer.class.isAssignableFrom(testBeanClass)) {
-            matches++;
             menuCategories.add(MenuFactory.TIMERS);
             bd.setValue(TestElement.GUI_CLASS, AbstractTimerGui.class.getName());
+            matches++;
         }
-        if (matches == 0) {
-            log.error("Could not assign GUI class to " + testBeanClass.getName());
-        } else if (matches > 1) {// may be impossible, but no harm in
-                                    // checking ...
-            log.error("More than 1 GUI class found for " + testBeanClass.getName());
-        }
-        return menuCategories;
+        return matches;
     }
 
     private void init() {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1209955&r1=1209954&r2=1209955&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Dec  3 17:20:49 2011
@@ -154,6 +154,7 @@ This behaviour can be changed with prope
 <li>Bug 52217 - ViewResultsFullVisualizer : Synchronization issues on root and treeModel</li>
 <li>Bug 43294 - XPath Extractor namespace problems</li>
 <li>Bug 52224 - TestBeanHelper does not support NOT_UNDEFINED == Boolean.FALSE</li>
+<li>Bug 52279 - Switching to another language loses icons in Tree and logs error Can't
obtain GUI class from ...</li>
 </ul>
 
 <!-- =================== Improvements =================== -->



Mime
View raw message