You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by wo...@apache.org on 2005/10/05 21:38:50 UTC

cvs commit: jakarta-jmeter/src/core/org/apache/jmeter/gui/action ActionRouter.java

woolfel     2005/10/05 12:38:50

  Modified:    src/core/org/apache/jmeter/config/gui Tag: rel-2-1
                        ArgumentsPanel.java
               src/core/org/apache/jmeter/gui Tag: rel-2-1 NamePanel.java
                        AbstractJMeterGuiComponent.java
                        JMeterGUIComponent.java
               src/core/org/apache/jmeter Tag: rel-2-1 NewDriver.java
               src/core/org/apache/jmeter/gui/action Tag: rel-2-1
                        ActionRouter.java
  Log:
  updating more core classes with changs for the reporting tool.
  peter
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.28.2.1  +30 -2     jakarta-jmeter/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
  
  Index: ArgumentsPanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java,v
  retrieving revision 1.28
  retrieving revision 1.28.2.1
  diff -u -r1.28 -r1.28.2.1
  --- ArgumentsPanel.java	12 Jul 2005 20:50:59 -0000	1.28
  +++ ArgumentsPanel.java	5 Oct 2005 19:38:49 -0000	1.28.2.1
  @@ -18,6 +18,7 @@
   
   package org.apache.jmeter.config.gui;
   
  +import java.awt.Color;
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.FlowLayout;
  @@ -69,6 +70,11 @@
   	/** A button for removing arguments from the table. */
   	private JButton delete;
   
  +    /**
  +     * Added background support for reporting tool
  +     */
  +    private Color background;
  +    
   	/**
   	 * Boolean indicating whether this component is a standalong component or it
   	 * is intended to be used as a subpanel for another component.
  @@ -110,6 +116,19 @@
   		init();
   	}
   
  +    /**
  +     * Create a new ArgumentsPanel with a border and color background
  +     * @param label
  +     * @param borderHeight
  +     * @param borderWidth
  +     */
  +    public ArgumentsPanel(String label, Color bkg) {
  +        tableLabel = new JLabel(label);
  +        this.background = bkg;
  +        standalone = false;
  +        init();
  +    }
  +    
   	/**
   	 * This is the list of menu categories this gui component will be available
   	 * under.
  @@ -348,6 +367,9 @@
   		initializeTableModel();
   		table = new JTable(tableModel);
   		table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  +        if (this.background != null) {
  +            table.setBackground(this.background);
  +        }
   		return makeScrollPane(table);
   	}
   
  @@ -359,6 +381,9 @@
   	protected Component makeLabelPanel() {
   		JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
   		labelPanel.add(tableLabel);
  +        if (this.background != null) {
  +            labelPanel.setBackground(this.background);
  +        }
   		return labelPanel;
   	}
   
  @@ -379,6 +404,9 @@
   
   		JPanel buttonPanel = new JPanel();
   		buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
  +        if (this.background != null) {
  +            buttonPanel.setBackground(this.background);
  +        }
   		add.addActionListener(this);
   		delete.addActionListener(this);
   		buttonPanel.add(add);
  
  
  
  No                   revision
  No                   revision
  1.17.2.1  +8 -7      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.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- NamePanel.java	12 Jul 2005 20:50:54 -0000	1.17
  +++ NamePanel.java	5 Oct 2005 19:38:49 -0000	1.17.2.1
  @@ -27,8 +27,9 @@
   import javax.swing.JTextField;
   import javax.swing.event.DocumentEvent;
   import javax.swing.event.DocumentListener;
  +import javax.swing.tree.TreeNode;
   
  -import org.apache.jmeter.gui.tree.JMeterTreeNode;
  +import org.apache.jmeter.gui.tree.NamedTreeNode;
   import org.apache.jmeter.testelement.TestElement;
   import org.apache.jmeter.testelement.WorkBench;
   import org.apache.jmeter.testelement.property.StringProperty;
  @@ -48,7 +49,7 @@
   	private JLabel nameLabel;
   
   	/** The node which this component is providing the name for. */
  -	private JMeterTreeNode node;
  +	private TreeNode node;
   
   	/**
   	 * Create a new NamePanel with the default name.
  @@ -118,7 +119,7 @@
   	 * 
   	 * @return the tree node corresponding to this component
   	 */
  -	protected JMeterTreeNode getNode() {
  +	protected TreeNode getNode() {
   		return node;
   	}
   
  @@ -128,7 +129,7 @@
   	 * @param node
   	 *            the tree node corresponding to this component
   	 */
  -	public void setNode(JMeterTreeNode node) {
  +	public void setNode(TreeNode node) {
   		this.node = node;
   	}
   
  @@ -184,7 +185,7 @@
   	 */
   	private void updateName(String newValue) {
   		if (getNode() != null) {
  -			getNode().nameChanged();
  +            ((NamedTreeNode)getNode()).nameChanged();
   		}
   	}
   
  
  
  
  1.34.2.1  +7 -7      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.34
  retrieving revision 1.34.2.1
  diff -u -r1.34 -r1.34.2.1
  --- AbstractJMeterGuiComponent.java	12 Jul 2005 20:50:54 -0000	1.34
  +++ AbstractJMeterGuiComponent.java	5 Oct 2005 19:38:49 -0000	1.34.2.1
  @@ -28,8 +28,8 @@
   import javax.swing.JPanel;
   import javax.swing.JScrollPane;
   import javax.swing.border.Border;
  +import javax.swing.tree.TreeNode;
   
  -import org.apache.jmeter.gui.tree.JMeterTreeNode;
   import org.apache.jmeter.gui.util.VerticalPanel;
   import org.apache.jmeter.testelement.TestElement;
   import org.apache.jmeter.testelement.property.BooleanProperty;
  @@ -65,10 +65,10 @@
   	private boolean enabled = true;
   
   	/** The tree node which this component is associated with. */
  -	private JMeterTreeNode node;
  +	private TreeNode node;
   
   	/** A GUI panel containing the name of this component. */
  -	private NamePanel namePanel;
  +	protected NamePanel namePanel;
   
   	/**
   	 * When constructing a new component, this takes care of basic tasks like
  @@ -206,7 +206,7 @@
   	 * Provides a default implementation for the node property. It is unlikely
   	 * developers would need to override this method.
   	 */
  -	public void setNode(JMeterTreeNode node) {
  +	public void setNode(TreeNode node) {
   		this.node = node;
   		getNamePanel().setNode(node);
   	}
  @@ -215,7 +215,7 @@
   	 * Provides a default implementation for the node property. It is unlikely
   	 * developers would need to override this method.
   	 */
  -	protected JMeterTreeNode getNode() {
  +	protected TreeNode getNode() {
   		return node;
   	}
   
  
  
  
  1.15.2.1  +5 -5      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.15
  retrieving revision 1.15.2.1
  diff -u -r1.15 -r1.15.2.1
  --- JMeterGUIComponent.java	12 Jul 2005 20:50:54 -0000	1.15
  +++ JMeterGUIComponent.java	5 Oct 2005 19:38:49 -0000	1.15.2.1
  @@ -22,7 +22,7 @@
   
   import javax.swing.JPopupMenu;
   
  -import org.apache.jmeter.gui.tree.JMeterTreeNode;
  +import javax.swing.tree.TreeNode;
   import org.apache.jmeter.testelement.TestElement;
   
   /**
  @@ -177,8 +177,8 @@
   	 * @param node
   	 *            the tree node corresponding to this component
   	 */
  -	void setNode(JMeterTreeNode node);
  -
  +	void setNode(TreeNode node);
  +    
   	/**
   	 * Clear the gui and return it to initial default values. This is necessary
   	 * because most gui classes are instantiated just once and re-used for
  
  
  
  No                   revision
  No                   revision
  1.8.2.4   +23 -11    jakarta-jmeter/src/core/org/apache/jmeter/NewDriver.java
  
  Index: NewDriver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/NewDriver.java,v
  retrieving revision 1.8.2.3
  retrieving revision 1.8.2.4
  diff -u -r1.8.2.3 -r1.8.2.4
  --- NewDriver.java	22 Sep 2005 23:02:12 -0000	1.8.2.3
  +++ NewDriver.java	5 Oct 2005 19:38:49 -0000	1.8.2.4
  @@ -144,14 +144,26 @@
   			System.setProperty("log4j.configuration", "file:" + conf);
   		}
   
  -		try {
  -			Class JMeter = loader.loadClass("org.apache.jmeter.JMeter");
  -			Object instance = JMeter.newInstance();
  -			Method startup = JMeter.getMethod("start", new Class[] { (new String[0]).getClass() });
  -			startup.invoke(instance, new Object[] { args });
  +        if (args != null && args.length > 0 && args[0].equals("report")) {
  +            try {
  +                Class JMeterReport = loader.loadClass("org.apache.jmeter.JMeterReport");
  +                Object instance = JMeterReport.newInstance();
  +                Method startup = JMeterReport.getMethod("start", new Class[] { (new String[0]).getClass() });
  +                startup.invoke(instance, new Object[] { args });
   
  -		} catch (Exception e) {
  -			e.printStackTrace();
  -		}
  +            } catch (Exception e) {
  +                e.printStackTrace();
  +            }
  +        } else {
  +            try {
  +                Class JMeter = loader.loadClass("org.apache.jmeter.JMeter");
  +                Object instance = JMeter.newInstance();
  +                Method startup = JMeter.getMethod("start", new Class[] { (new String[0]).getClass() });
  +                startup.invoke(instance, new Object[] { args });
  +
  +            } catch (Exception e) {
  +                e.printStackTrace();
  +            }
  +        }
   	}
   }
  
  
  
  No                   revision
  No                   revision
  1.23.2.1  +18 -16    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.23
  retrieving revision 1.23.2.1
  diff -u -r1.23 -r1.23.2.1
  --- ActionRouter.java	12 Jul 2005 20:50:26 -0000	1.23
  +++ ActionRouter.java	5 Oct 2005 19:38:49 -0000	1.23.2.1
  @@ -266,20 +266,22 @@
   			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);
  -					}
  -				}
  +                if (strClassName.startsWith("org.apache.jmeter.gui")) {
  +                    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) {
   			if ("java.awt.HeadlessException".equals(e.getClass().getName())) // JDK1.4:
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org