Author: sebb Date: Fri Apr 24 15:47:10 2009 New Revision: 768336 URL: http://svn.apache.org/viewvc?rev=768336&view=rev Log: Share code
Modified: jakarta/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/action/ReportLookAndFeelCommand.java Modified: jakarta/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/action/ReportLookAndFeelCommand.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/action/ReportLookAndFeelCommand.java?rev=768336&r1=768335&r2=768336&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/action/ReportLookAndFeelCommand.java (original) +++ jakarta/jmeter/trunk/src/reports/org/apache/jmeter/report/gui/action/ReportLookAndFeelCommand.java Fri Apr 24 15:47:10 2009 @@ -18,54 +18,8 @@ package org.apache.jmeter.report.gui.action; -import java.awt.event.ActionEvent; -import java.util.HashSet; -import java.util.Set; +import org.apache.jmeter.gui.action.LookAndFeelCommand; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -import org.apache.jmeter.gui.action.Command; -import org.apache.jmeter.gui.ReportGuiPackage; -import org.apache.jmeter.util.JMeterUtils; - -public class ReportLookAndFeelCommand implements Command { - - private static final Set commands = new HashSet(); - static { - UIManager.LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); - for (int i = 0; i < lfs.length; i++) { - commands.add("laf:" + lfs[i].getClassName()); - } - - try { - String defaultUI = JMeterUtils.getPropDefault("jmeter.laf", UIManager - .getCrossPlatformLookAndFeelClassName()); - UIManager.setLookAndFeel(defaultUI); - } catch (Exception e) { - } - } - - public ReportLookAndFeelCommand() { - } - - public void doAction(ActionEvent ev) { - try { - String className = ev.getActionCommand().substring(4).replace('/', '.'); - UIManager.setLookAndFeel(className); - SwingUtilities.updateComponentTreeUI(ReportGuiPackage.getInstance().getMainFrame()); - } catch (javax.swing.UnsupportedLookAndFeelException e) { - JMeterUtils.reportErrorToUser("Look and Feel unavailable:" + e.toString()); - } catch (InstantiationException e) { - JMeterUtils.reportErrorToUser("Look and Feel unavailable:" + e.toString()); - } catch (ClassNotFoundException e) { - JMeterUtils.reportErrorToUser("Look and Feel unavailable:" + e.toString()); - } catch (IllegalAccessException e) { - JMeterUtils.reportErrorToUser("Look and Feel unavailable:" + e.toString()); - } - } - - public Set getActionNames() { - return commands; - } +public class ReportLookAndFeelCommand extends LookAndFeelCommand { +// same code as for default JMeter class } --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org