mstover1 2003/05/29 06:33:57 Modified: src/components/org/apache/jmeter/modifiers/gui UserParametersGui.java src/core/org/apache/jmeter/gui AbstractJMeterGuiComponent.java GuiPackage.java JMeterGUIComponent.java NamePanel.java src/core/org/apache/jmeter/gui/action ActionRouter.java src/core/org/apache/jmeter/gui/tree JMeterTreeNode.java src/core/org/apache/jmeter/threads JMeterThread.java Log: no message Revision Changes Path 1.11 +4 -5 jakarta-jmeter/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java Index: UserParametersGui.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- UserParametersGui.java 12 May 2003 15:20:17 -0000 1.10 +++ UserParametersGui.java 29 May 2003 13:33:56 -0000 1.11 @@ -1,7 +1,6 @@ package org.apache.jmeter.modifiers.gui; import java.awt.BorderLayout; -import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -132,11 +131,11 @@ new JLabel(JMeterUtils.getResString("user_parameters_table")); initTableModel(); paramTable = new JTable(tableModel); - paramTable.setRowSelectionAllowed(true); - paramTable.setColumnSelectionAllowed(true); + //paramTable.setRowSelectionAllowed(true); + //paramTable.setColumnSelectionAllowed(true); paramTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - paramTable.setCellSelectionEnabled(true); - paramTable.setPreferredScrollableViewportSize(new Dimension(100, 70)); + //paramTable.setCellSelectionEnabled(true); + //paramTable.setPreferredScrollableViewportSize(new Dimension(100, 70)); JPanel paramPanel = new JPanel(new BorderLayout()); paramPanel.add(tableLabel, BorderLayout.NORTH); 1.21 +7 -1 jakarta-jmeter/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java Index: AbstractJMeterGuiComponent.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- AbstractJMeterGuiComponent.java 8 May 2003 22:04:16 -0000 1.20 +++ AbstractJMeterGuiComponent.java 29 May 2003 13:33:56 -0000 1.21 @@ -203,6 +203,12 @@ enabled = element.getPropertyAsBoolean(TestElement.ENABLED); } } + + public void clear() + { + setName(getStaticLabel()); + enabled = true; + } /** * This provides a convenience for extenders when they implement the 1.14 +2 -1 jakarta-jmeter/src/core/org/apache/jmeter/gui/GuiPackage.java Index: GuiPackage.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/GuiPackage.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- GuiPackage.java 12 May 2003 21:31:06 -0000 1.13 +++ GuiPackage.java 29 May 2003 13:33:56 -0000 1.14 @@ -272,6 +272,7 @@ try { JMeterGUIComponent comp = getGuiFromCache(guiClass); + comp.clear(); TestElement node = comp.createTestElement(); nodesToGui.put(node, comp); return node; 1.9 +7 -1 jakarta-jmeter/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java Index: JMeterGUIComponent.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JMeterGUIComponent.java 8 May 2003 22:04:16 -0000 1.8 +++ JMeterGUIComponent.java 29 May 2003 13:33:56 -0000 1.9 @@ -178,4 +178,10 @@ * Sets the tree node which this component is associated with. * * @param node the tree node corresponding to this component */ void setNode(JMeterTreeNode node); + + /** + * Clear the gui and return it to initial default values. + * TODO: implement this in all gui classes. + */ + public void clear(); } 1.11 +6 -1 jakarta-jmeter/src/core/org/apache/jmeter/gui/NamePanel.java Index: NamePanel.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/NamePanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- NamePanel.java 12 May 2003 21:31:06 -0000 1.10 +++ NamePanel.java 29 May 2003 13:33:56 -0000 1.11 @@ -129,6 +129,11 @@ add(nameLabel, BorderLayout.WEST); add(nameField, BorderLayout.CENTER); } + + public void clear() + { + setName(getStaticLabel()); + } /** 1.12 +269 -259 jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ActionRouter.java Index: ActionRouter.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/ActionRouter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ActionRouter.java 7 Apr 2003 20:00:48 -0000 1.11 +++ ActionRouter.java 29 May 2003 13:33:56 -0000 1.12 @@ -64,6 +64,8 @@ import java.util.Map; import java.util.Set; +import javax.swing.SwingUtilities; + import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.util.JMeterUtils; import org.apache.jorphan.reflect.ClassFinder; @@ -80,263 +82,271 @@ public class ActionRouter implements ActionListener { - private Map commands = new HashMap(); - private static ActionRouter router; - private static AddToTree add = new AddToTree(); - transient private static Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor( - "jmeter.gui"); - private Map preActionListeners = new HashMap(); - private Map postActionListeners = new HashMap(); - - - private ActionRouter() - { - } - - /** - * Description of the Method - * - [EMAIL PROTECTED] e Description of Parameter - */ - public void actionPerformed(ActionEvent e) - { - try - { - GuiPackage.getInstance().updateCurrentNode(); - Set commandObjects = (Set)commands.get(e.getActionCommand()); - Iterator iter = commandObjects.iterator(); - while(iter.hasNext()) - { - try - { - Command c = (Command)iter.next(); - preActionPerformed(c.getClass(), e); - c.doAction(e); - postActionPerformed(c.getClass(), e); - } - catch(Exception err) - { - log.error("",err); - } - } - } - catch (NullPointerException er) - { - log.error("",er); - JMeterUtils.reportErrorToUser("Sorry, this feature (" + e.getActionCommand() + - ") not yet implemented"); - } - } - - public Set getAction(String actionName) - { - Set set = new HashSet(); - Set commandObjects = (Set)commands.get(actionName); - Iterator iter = commandObjects.iterator(); - while(iter.hasNext()) - { - try - { - set.add(iter.next()); - } - catch(Exception err) - { - log.error("",err); - } - } - return set; - } - - public Command getAction(String actionName,String className) - { - Set commandObjects = (Set)commands.get(actionName); - Iterator iter = commandObjects.iterator(); - while(iter.hasNext()) - { - try - { - Command com = (Command)iter.next(); - if(com.getClass().getName().equals(className)) - { - return com; - } - } - catch(Exception err) - { - log.error("",err); - } - } - return null; - } - - /** - * Allows an ActionListener to receive notification of a command - * being executed prior to the actual execution of the command. - * - * @param action The Class of the command for which the listener will - * notifications for. Class must extend org.apache.jmeter.gui.action.Command - * @param listener The ActionListener to receive the notifications - */ - public void addPreActionListener(Class action, ActionListener listener) - { - if ( action != null ) { - HashSet set = (HashSet)preActionListeners.get(action.getName()); - if ( set == null ) - { - set = new HashSet(); - } - set.add(listener); - preActionListeners.put(action.getName(), set); - } - } - - /** - * Allows an ActionListener to be removed from receiving - * notifications of a command being executed prior to the actual - * execution of the command. - * - * @param action The Class of the command for which the listener will - * notifications for. Class must extend org.apache.jmeter.gui.action.Command - * @param listener The ActionListener to receive the notifications - */ - public void removePreActionListener(Class action, ActionListener listener) - { - if ( action != null ) { - HashSet set = (HashSet)preActionListeners.get(action.getName()); - if ( set != null ) - { - set.remove(listener); - preActionListeners.put(action.getName(), set); - } - } - } - - /** - * Allows an ActionListener to receive notification of a command - * being executed after the command has executed. - * - * @param action The Class of the command for which the listener will - * notifications for. Class must extend org.apache.jmeter.gui.action.Command - * @param listener - */ - public void addPostActionListener(Class action, ActionListener listener) - { - if ( action != null ) { - HashSet set = (HashSet)postActionListeners.get(action.getName()); - if ( set == null ) - { - set = new HashSet(); - } - set.add(listener); - postActionListeners.put(action.getName(), set); - } - } - - /** - * Allows an ActionListener to be removed from receiving - * notifications of a command being executed after the command has executed. - * - * @param action The Class of the command for which the listener will - * notifications for. Class must extend org.apache.jmeter.gui.action.Command - * @param listener - */ - public void removePostActionListener(Class action, ActionListener listener) - { - if ( action != null ) { - HashSet set = (HashSet)postActionListeners.get(action.getName()); - if ( set != null ) - { - set.remove(listener); - postActionListeners.put(action.getName(), set); - } - } - } - - protected void preActionPerformed(Class action, ActionEvent e) - { - if ( action != null ) { - HashSet listenerSet = (HashSet)preActionListeners.get(action.getName()); - if ( listenerSet != null && listenerSet.size() > 0 ) { - Object[] listeners = listenerSet.toArray(); - for ( int i=0; i<listeners.length; i++ ) - { - ((ActionListener)listeners[i]).actionPerformed(e); - } - } - } - } - - protected void postActionPerformed(Class action, ActionEvent e) - { - if ( action != null ) { - HashSet listenerSet = (HashSet)postActionListeners.get(action.getName()); - if ( listenerSet != null && listenerSet.size() > 0 ) { - Object[] listeners = listenerSet.toArray(); - for ( int i=0; i<listeners.length; i++ ) - { - ((ActionListener)listeners[i]).actionPerformed(e); - } - } - } - } - - private void populateCommandMap() - { - List listClasses; - Command command; - Iterator iterClasses; - Class commandClass; - try - { - listClasses = ClassFinder.findClassesThatExtend( - JMeterUtils.getSearchPaths(), - new Class[]{Class.forName("org.apache.jmeter.gui.action.Command")}); - commands = new HashMap(listClasses.size()); - if (listClasses.size() == 0) - { - log.warn("!!!!!Uh-oh, didn't find any action handlers!!!!!"); - } - iterClasses = listClasses.iterator(); - while (iterClasses.hasNext()) - { - String strClassName = (String) iterClasses.next(); - commandClass = Class.forName(strClassName); - if (!Modifier.isAbstract(commandClass.getModifiers())) - { - command = (Command) commandClass.newInstance(); - Iterator iter = command.getActionNames().iterator(); - while (iter.hasNext()) - { - String commandName = (String)iter.next(); - Set commandObjects = (Set)commands.get(commandName); - if(commandObjects == null) - { - commandObjects = new HashSet(); - commands.put(commandName,commandObjects); - } - commandObjects.add(command); - } - } - } - } - catch (Exception e) - { - log.error("exception finding action handlers",e); - } - } - - /** - * Gets the Instance attribute of the ActionRouter class - * - [EMAIL PROTECTED] The Instance value - */ - public static ActionRouter getInstance() - { - if (router == null) - { - router = new ActionRouter(); - router.populateCommandMap(); - } - return router; - } + private Map commands = new HashMap(); + private static ActionRouter router; + private static AddToTree add = new AddToTree(); + transient private static Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("jmeter.gui"); + private Map preActionListeners = new HashMap(); + private Map postActionListeners = new HashMap(); + + private ActionRouter() + {} + + /** + * Description of the Method + * + [EMAIL PROTECTED] e Description of Parameter + */ + public void actionPerformed(final ActionEvent e) + { + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + try + { + GuiPackage.getInstance().updateCurrentNode(); + Set commandObjects = (Set) commands.get(e.getActionCommand()); + Iterator iter = commandObjects.iterator(); + while (iter.hasNext()) + { + try + { + Command c = (Command) iter.next(); + preActionPerformed(c.getClass(), e); + c.doAction(e); + postActionPerformed(c.getClass(), e); + } + catch (Exception err) + { + log.error("", err); + } + } + } + catch (NullPointerException er) + { + log.error("", er); + JMeterUtils.reportErrorToUser("Sorry, this feature (" + e.getActionCommand() + ") not yet implemented"); + } + } + }); + } + + public Set getAction(String actionName) + { + Set set = new HashSet(); + Set commandObjects = (Set) commands.get(actionName); + Iterator iter = commandObjects.iterator(); + while (iter.hasNext()) + { + try + { + set.add(iter.next()); + } + catch (Exception err) + { + log.error("", err); + } + } + return set; + } + + public Command getAction(String actionName, String className) + { + Set commandObjects = (Set) commands.get(actionName); + Iterator iter = commandObjects.iterator(); + while (iter.hasNext()) + { + try + { + Command com = (Command) iter.next(); + if (com.getClass().getName().equals(className)) + { + return com; + } + } + catch (Exception err) + { + log.error("", err); + } + } + return null; + } + + /** + * Allows an ActionListener to receive notification of a command + * being executed prior to the actual execution of the command. + * + * @param action The Class of the command for which the listener will + * notifications for. Class must extend org.apache.jmeter.gui.action.Command + * @param listener The ActionListener to receive the notifications + */ + public void addPreActionListener(Class action, ActionListener listener) + { + if (action != null) + { + HashSet set = (HashSet) preActionListeners.get(action.getName()); + if (set == null) + { + set = new HashSet(); + } + set.add(listener); + preActionListeners.put(action.getName(), set); + } + } + + /** + * Allows an ActionListener to be removed from receiving + * notifications of a command being executed prior to the actual + * execution of the command. + * + * @param action The Class of the command for which the listener will + * notifications for. Class must extend org.apache.jmeter.gui.action.Command + * @param listener The ActionListener to receive the notifications + */ + public void removePreActionListener(Class action, ActionListener listener) + { + if (action != null) + { + HashSet set = (HashSet) preActionListeners.get(action.getName()); + if (set != null) + { + set.remove(listener); + preActionListeners.put(action.getName(), set); + } + } + } + + /** + * Allows an ActionListener to receive notification of a command + * being executed after the command has executed. + * + * @param action The Class of the command for which the listener will + * notifications for. Class must extend org.apache.jmeter.gui.action.Command + * @param listener + */ + public void addPostActionListener(Class action, ActionListener listener) + { + if (action != null) + { + HashSet set = (HashSet) postActionListeners.get(action.getName()); + if (set == null) + { + set = new HashSet(); + } + set.add(listener); + postActionListeners.put(action.getName(), set); + } + } + + /** + * Allows an ActionListener to be removed from receiving + * notifications of a command being executed after the command has executed. + * + * @param action The Class of the command for which the listener will + * notifications for. Class must extend org.apache.jmeter.gui.action.Command + * @param listener + */ + public void removePostActionListener(Class action, ActionListener listener) + { + if (action != null) + { + HashSet set = (HashSet) postActionListeners.get(action.getName()); + if (set != null) + { + set.remove(listener); + postActionListeners.put(action.getName(), set); + } + } + } + + protected void preActionPerformed(Class action, ActionEvent e) + { + if (action != null) + { + HashSet listenerSet = (HashSet) preActionListeners.get(action.getName()); + if (listenerSet != null && listenerSet.size() > 0) + { + Object[] listeners = listenerSet.toArray(); + for (int i = 0; i < listeners.length; i++) + { + ((ActionListener) listeners[i]).actionPerformed(e); + } + } + } + } + + protected void postActionPerformed(Class action, ActionEvent e) + { + if (action != null) + { + HashSet listenerSet = (HashSet) postActionListeners.get(action.getName()); + if (listenerSet != null && listenerSet.size() > 0) + { + Object[] listeners = listenerSet.toArray(); + for (int i = 0; i < listeners.length; i++) + { + ((ActionListener) listeners[i]).actionPerformed(e); + } + } + } + } + + private void populateCommandMap() + { + List listClasses; + Command command; + Iterator iterClasses; + Class commandClass; + try + { + listClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { Class.forName("org.apache.jmeter.gui.action.Command")}); + commands = new HashMap(listClasses.size()); + if (listClasses.size() == 0) + { + log.warn("!!!!!Uh-oh, didn't find any action handlers!!!!!"); + } + iterClasses = listClasses.iterator(); + while (iterClasses.hasNext()) + { + String strClassName = (String) iterClasses.next(); + commandClass = Class.forName(strClassName); + if (!Modifier.isAbstract(commandClass.getModifiers())) + { + command = (Command) commandClass.newInstance(); + Iterator iter = command.getActionNames().iterator(); + while (iter.hasNext()) + { + String commandName = (String) iter.next(); + Set commandObjects = (Set) commands.get(commandName); + if (commandObjects == null) + { + commandObjects = new HashSet(); + commands.put(commandName, commandObjects); + } + commandObjects.add(command); + } + } + } + } + catch (Exception e) + { + log.error("exception finding action handlers", e); + } + } + + /** + * Gets the Instance attribute of the ActionRouter class + * + [EMAIL PROTECTED] The Instance value + */ + public static ActionRouter getInstance() + { + if (router == null) + { + router = new ActionRouter(); + router.populateCommandMap(); + } + return router; + } } 1.10 +5 -1 jakarta-jmeter/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java Index: JMeterTreeNode.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JMeterTreeNode.java 7 Apr 2003 14:35:22 -0000 1.9 +++ JMeterTreeNode.java 29 May 2003 13:33:56 -0000 1.10 @@ -102,6 +102,10 @@ { createTestElement().setProperty(new BooleanProperty(TestElement.ENABLED,enabled)); } + + public void clear() + { + } public ImageIcon getIcon() { 1.29 +3 -3 jakarta-jmeter/src/core/org/apache/jmeter/threads/JMeterThread.java Index: JMeterThread.java =================================================================== RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/JMeterThread.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- JMeterThread.java 20 May 2003 14:17:05 -0000 1.28 +++ JMeterThread.java 29 May 2003 13:33:57 -0000 1.29 @@ -161,8 +161,8 @@ result.setThreadName(threadName); result.setTimeStamp(System.currentTimeMillis()); threadContext.setPreviousResult(result); - checkAssertions(pack.getAssertions(), result); runPostProcessors(pack.getPostProcessors()); + checkAssertions(pack.getAssertions(), result); notifyListeners(pack.getSampleListeners(), result); compiler.done(pack); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]