Author: sebb
Date: Fri Oct 14 12:18:02 2011
New Revision: 1183325
URL: http://svn.apache.org/viewvc?rev=1183325&view=rev
Log:
Bug 52027 - Allow System or CrossPlatform LAF to be set from options menu
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java?rev=1183325&r1=1183324&r2=1183325&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java
Fri Oct 14 12:18:02 2011
@@ -28,6 +28,7 @@ import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.gui.util.JMeterMenuBar;
import org.apache.jmeter.util.JMeterUtils;
/**
@@ -40,7 +41,7 @@ public class LookAndFeelCommand implemen
private static final Set<String> commands = new HashSet<String>();
static {
- UIManager.LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels();
+ UIManager.LookAndFeelInfo[] lfs = JMeterMenuBar.getAllLAFs();
for (int i = 0; i < lfs.length; i++) {
commands.add(ActionNames.LAF_PREFIX + lfs[i].getClassName());
}
@@ -87,10 +88,10 @@ public class LookAndFeelCommand implemen
// Check if LAF is a built-in one
private static String checkLafName(String laf){
- if ("system".equalsIgnoreCase(laf)){ // $NON-NLS-1$
+ if (JMeterMenuBar.SYSTEM_LAF.equalsIgnoreCase(laf)){
return UIManager.getSystemLookAndFeelClassName();
}
- if ("crossplatform".equalsIgnoreCase(laf)){ // $NON-NLS-1$
+ if (JMeterMenuBar.CROSS_PLATFORM_LAF.equalsIgnoreCase(laf)){
return UIManager.getCrossPlatformLookAndFeelClassName();
}
return laf;
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java?rev=1183325&r1=1183324&r2=1183325&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
Fri Oct 14 12:18:02 2011
@@ -34,6 +34,7 @@ import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.MenuElement;
import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
import org.apache.jmeter.gui.action.ActionNames;
import org.apache.jmeter.gui.action.ActionRouter;
@@ -131,6 +132,10 @@ public class JMeterMenuBar extends JMenu
private JMenu searchMenu;
+ public static final String SYSTEM_LAF = "System"; // $NON-NLS-1$
+
+ public static final String CROSS_PLATFORM_LAF = "CrossPlatform"; //
$NON-NLS-1$
+
public JMeterMenuBar() {
// List for recent files menu items
file_load_recent_files = new LinkedList<JComponent>();
@@ -295,7 +300,7 @@ public class JMeterMenuBar extends JMenu
JMenuItem functionHelper =
makeMenuItemRes("function_dialog_menu_item", 'F', ActionNames.FUNCTIONS,
KeyStrokes.FUNCTIONS); //$NON-NLS-1$
lafMenu = makeMenuRes("appearance",'L'); //$NON-NLS-1$
- UIManager.LookAndFeelInfo lafs[] =
UIManager.getInstalledLookAndFeels();
+ UIManager.LookAndFeelInfo lafs[] = getAllLAFs();
for (int i = 0; i < lafs.length; ++i) {
JMenuItem laf = new JMenuItem(lafs[i].getName());
laf.addActionListener(ActionRouter.getInstance());
@@ -595,6 +600,19 @@ public class JMeterMenuBar extends JMenu
}
/**
+ * Get a list of all installed LAFs plus CrossPlatform and System.
+ */
+ // This is also used by LookAndFeelCommand
+ public static LookAndFeelInfo[] getAllLAFs() {
+ UIManager.LookAndFeelInfo lafs[] =
UIManager.getInstalledLookAndFeels();
+ int i = lafs.length;
+ UIManager.LookAndFeelInfo lafsAll[] = new
UIManager.LookAndFeelInfo[i+2];
+ System.arraycopy(lafs, 0, lafsAll, 0, i);
+ lafsAll[i++]=new
UIManager.LookAndFeelInfo(CROSS_PLATFORM_LAF,UIManager.getCrossPlatformLookAndFeelClassName());
+ lafsAll[i++]=new
UIManager.LookAndFeelInfo(SYSTEM_LAF,UIManager.getSystemLookAndFeelClassName());
+ return lafsAll;
+ }
+ /**
* <p>Refreshes all texts in the menu and all submenus to a new locale.</p>
*
* <p>Assumes that the item name is set to the resource key, so the
resource can be retrieved.
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1183325&r1=1183324&r2=1183325&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Oct 14 12:18:02 2011
@@ -166,8 +166,9 @@ Mirror server now uses default port 8081
<ul>
<li>Bug 51892 - Default mirror port should be different from default proxy
port</li>
<li>Bug 51817 - Moving variables up and down in User Defined Variables
control</li>
-<li>Bug 51876 - Functionnality to search in Samplers TreeView</li>
+<li>Bug 51876 - Functionality to search in Samplers TreeView</li>
<li>Bug 52019 - Add menu option to Start a test ignoring Pause Timers</li>
+<li>Bug 52027 - Allow System or CrossPlatform LAF to be set from options
menu</li>
</ul>
<h2>Non-functional changes</h2>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]