mstover1 2003/01/06 15:30:10
Modified: src/core/org/apache/jmeter/gui
AbstractJMeterGuiComponent.java GuiPackage.java
JMeterComponentModel.java JMeterGUIComponent.java
Log:
Writing Javadocs
Revision Changes Path
1.4 +83 -43
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractJMeterGuiComponent.java 31 Dec 2002 18:05:54 -0000 1.3
+++ AbstractJMeterGuiComponent.java 6 Jan 2003 23:30:10 -0000 1.4
@@ -52,92 +52,132 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
package org.apache.jmeter.gui;
-
import java.util.Collection;
-
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
-
/**
+ * This abstract class takes care of the most basic functions necessary to create a
viable
+ * JMeter GUI component. It extends JPanel and implements JMeterGUIComponent. This
+ * abstract is, in turn, extended by several other abstract classes that create
different
+ * classes of GUI components for JMeter (ie Visualizers, Timers, Samplers,
Modifiers, Controllers, etc).
+ *
* @author mstover
*
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
+ * @see JMeterGuiComponent
+ * @see org.apache.jmeter.config.gui.AbstractConfigGui
+ * @see org.apache.jmeter.config.gui.AbstractModifierGui
+ * @see org.apache.jmeter.config.gui.AbstractResponseBasedModifierGui
+ * @see org.apache.jmeter.assertions.gui.AbstractAssertionGui
+ * @see org.apache.jmeter.control.gui.AbstractControllerGui
+ * @see org.apache.jmeter.timers.gui.AbstractTimerGui
+ * @see org.apache.jmeter.visualizers.gui.AbstractVisualizer
+ * @see org.apache.jmeter.samplers.gui.AbstractSamplerGui
*/
public abstract class AbstractJMeterGuiComponent
extends JPanel
- implements JMeterGUIComponent {
-
- private boolean enabled = true;
- private JMeterTreeNode node;
-
-
- public AbstractJMeterGuiComponent() {
+ implements JMeterGUIComponent
+{
+ private boolean enabled = true;
+ private JMeterTreeNode node;
+
+
+ /**
+ * When constructing a new component, this takes care of basic tasks like
+ * setting up the Name Panel and assigning the class's static label as
+ * the name to start.
* @see java.lang.Object#Object()
*/
+ public AbstractJMeterGuiComponent()
+ {
namePanel = new NamePanel();
setName(getStaticLabel());
}
-
+
/**
* @see JMeterGUIComponent#setName(String)
*/
- public void setName(String name) {
+ public void setName(String name)
+ {
namePanel.setName(name);
}
-
+
+ /**
+ * @see java.awt.Component#isEnabled()
+ */
public boolean isEnabled()
{
return enabled;
}
-
+
+ /**
+ * @see java.awt.Component#setEnabled(boolean)
+ */
public void setEnabled(boolean e)
{
enabled = e;
}
-
+
/**
* @see JMeterGUIComponent#getName()
*/
- public String getName() {
+ public String getName()
+ {
return getNamePanel().getName();
}
-
- protected NamePanel getNamePanel() {
+
+ /**
+ * Provides the Name Panel for extending classes. Extending classes are free
to
+ * place it as desired within the component, or not at all.
+ *
* @return NamePanel
*/
+ protected NamePanel getNamePanel()
+ {
return namePanel;
}
-
+
protected NamePanel namePanel;
+
- /****************************************
- * !ToDo (Method description)
- *
- *@param element !ToDo (Parameter description)
- ***************************************/
+ /**
+ * This method should be overriden, but the extending class should also still
call it, as
+ * it does the work necessary to configure the name of the component from the
+ * given Test Element. Otherwise, the component can do this itself.
+ *
+ * @see
org.apache.jmeter.gui.JMeterGUIComponent#configure(org.apache.jmeter.testelement.TestElement)
+ */
public void configure(TestElement element)
{
- setName((String)element.getProperty(TestElement.NAME));
+ setName((String) element.getProperty(TestElement.NAME));
}
-
- protected void configureTestElement(TestElement mc)
+
+ /**
+ * This provides a convenience for extenders when they implement the
createTestElement()
+ * method. This method will set the name, gui class, and test class for the
created
+ * Test Element. It should be called by every extending class when creating
Test
+ * Elements, as that will best assure consistent behavior.
+ * @param The Test Element being created.
+ */
+ protected void configureTestElement(TestElement mc)
{
mc.setProperty(TestElement.NAME, getName());
mc.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
mc.setProperty(TestElement.TEST_CLASS, mc.getClass().getName());
}
-
-
- public void setNode(JMeterTreeNode node)
- {
- this.node = node;
- getNamePanel().setNode(node);
- }
-
-
- protected JMeterTreeNode getNode()
- {
- return node;
- }
+
+ /**
+ * @see
org.apache.jmeter.gui.JMeterGUIComponent#setNode(org.apache.jmeter.gui.tree.JMeterTreeNode)
+ */
+ public void setNode(JMeterTreeNode node)
+ {
+ this.node = node;
+ getNamePanel().setNode(node);
+ }
+ /**
+ * Method getNode.
+ * @return JMeterTreeNode
+ */
+ protected JMeterTreeNode getNode()
+ {
+ return node;
+ }
}
1.6 +18 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GuiPackage.java 17 Oct 2002 19:47:16 -0000 1.5
+++ GuiPackage.java 6 Jan 2003 23:30:10 -0000 1.6
@@ -62,6 +62,12 @@
import org.apache.jorphan.collections.HashTree;
/**
+ * GuiPackage is a static class that provides convenient access to information
about the
+ * current state of JMeter's GUI. Any GUI class can grab a handle to GuiPackage by
+ * calling the static method 'getInstance()' and then use it to query the GUI about
+ * it's state. When actions, for instance, need to affect the GUI, they
+ * typically use GuiPackage to get access to different parts of the GUI.
+ *
* Title: JMeter
* Description:
* Copyright: Copyright (c) 2000
@@ -76,6 +82,8 @@
private static GuiPackage guiPack;
private boolean dirty = false;
+ /**
+ * GuiPackage is a Singleton class.
* @see java.lang.Object#Object()
*/
private GuiPackage()
{
}
@@ -84,6 +92,9 @@
private org.apache.jmeter.gui.MainFrame mainFrame;
private org.apache.jmeter.gui.tree.JMeterTreeListener treeListener;
+ /**
+ * When GuiPackage is requested for the first time, it should be given handles
to
+ * JMeter's Tree Listener and TreeModel.
* @param listener The
TreeListener for JMeter's test tree.
* @param treeModel The model for JMeter's
test tree.
* @return GuiPackage
*/
public static GuiPackage getInstance(JMeterTreeListener listener,
JMeterTreeModel treeModel)
{
@@ -96,11 +107,18 @@
return guiPack;
}
+ /**
+ * The dirty property is a flag that indicates whether there are parts of
JMeter's test tree
+ * that the user has not saved since last modification. Various (@link
Command actions) set
+ * this property when components are modified/created/saved.
* @param d
*/
public void setDirty(boolean d)
{
dirty = d;
}
+ /**
+ * Retrieves the state of the 'dirty' property, a flag that indicates if there
are test
+ * tree components that have been modified since they were last saved.
*
@return boolean
*/
public boolean isDirty()
{
return dirty;
1.2 +2 -4
jakarta-jmeter/src/core/org/apache/jmeter/gui/JMeterComponentModel.java
Index: JMeterComponentModel.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/JMeterComponentModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JMeterComponentModel.java 11 Aug 2002 19:24:43 -0000 1.1
+++ JMeterComponentModel.java 6 Jan 2003 23:30:10 -0000 1.2
@@ -57,12 +57,10 @@
import java.util.*;
/**
- * Title: JMeter
- * Description:
- * Copyright: Copyright (c) 2000
- * Company: Apache
+ * This class is obsolete.
* @author Michael Stover
* @version 1.0
+ *
*/
public interface JMeterComponentModel
1.4 +52 -25
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JMeterGUIComponent.java 31 Dec 2002 18:05:54 -0000 1.3
+++ JMeterGUIComponent.java 6 Jan 2003 23:30:10 -0000 1.4
@@ -59,71 +59,97 @@
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
/****************************************
- * <p>
- *
- * Title: Jakarta JMeter</p> <p>
- *
- * Description: Load testing software</p> <p>
- *
- * Copyright: Copyright (c) 2002</p> <p>
- *
- * Company: Apache Foundation</p>
- *
+ * Implementing this interface indicates that the class is
+ * a JMeter GUI Component. A JMeter GUI Component is essentially
+ * the GUI display code associated with a JMeter Test Element. The writer of
+ * the component must take care to make the component be consistent with the
+ * rest of JMeter's GUI look and feel and behavior. Use of the provided abstract
+ * classes is highly recommended to make this task easier.
+ *
*@author Michael Stover
*@created $Date$
*@version 1.0
+ *
+ *
+ *
+ * @see AbstractJMeterGuiComponent
+ * @see org.apache.jmeter.config.gui.AbstractConfigGui
+ * @see org.apache.jmeter.config.gui.AbstractModifierGui
+ * @see org.apache.jmeter.config.gui.AbstractResponseBasedModifierGui
+ * @see org.apache.jmeter.assertions.gui.AbstractAssertionGui
+ * @see org.apache.jmeter.control.gui.AbstractControllerGui
+ * @see org.apache.jmeter.timers.gui.AbstractTimerGui
+ * @see org.apache.jmeter.visualizers.gui.AbstractVisualizer
+ * @see org.apache.jmeter.samplers.gui.AbstractSamplerGui
***************************************/
public interface JMeterGUIComponent
{
/****************************************
- * !ToDo (Method description)
+ * Sets the name of the JMeter GUI Component. The name
+ * of the component is used in the Test Tree as the name of the
+ * tree node.
*
- *@param name !ToDo (Parameter description)
+ *@param name )
***************************************/
public void setName(String name);
/****************************************
- * !ToDoo (Method description)
+ * Gets the name of the JMeter GUI component. The name
+ * of the component is used in the Test Tree as the name of the tree node.
*
- *@return !ToDo (Return description)
+ *@return The name of the component)
***************************************/
public String getName();
/****************************************
- * !ToDoo (Method description)
+ * Get the component's label. This label is used in drop down
+ * lists that give the user the option of choosing one type of
+ * component in a list of many. It should therefore be a descriptive
+ * name for the end user to see.
*
- *@return !ToDo (Return description)
+ *@return GUI label for the component.
***************************************/
public String getStaticLabel();
/****************************************
- * !ToDo (Method description)
+ * When a test is started, GUI components are converted into
+ * test elements. This is the method called on each component
+ * to get the test element equivalent.
*
- *@return !ToDo (Return description)
+ *@return The Test Element object that the GUI component
+ * represents.
***************************************/
public TestElement createTestElement();
/**
- * Test GUI elements can be turned disabled, in which case
+ * Test GUI elements can be disabled, in which case
* they do not become part of the test when run.
*/
public boolean isEnabled();
+ /**
+ * Set whether this component is enabled.
* @param enabled true for
enabled, false for disabled.
*/
public void setEnabled(boolean enabled);
/****************************************
- * !ToDo (Method description)
+ * When a user right-clicks on the component in the test tree, or
+ * selects the edit menu when the component is selected, the
+ * component will be asked to return a JPopupMenu that provides
+ * all the options available to the user from this component.
*
- *@return !ToDo (Return description)
+ *@return A JPopupMenu appropriate for the component.
***************************************/
public JPopupMenu createPopupMenu();
/****************************************
- * !ToDo (Method description)
+ * A newly created component can be initialized with the contents of
+ * a Test Element object by calling this method. The component is
+ * responsible for querying the Test Element object for the
+ * relevant information to display in its GUI.
*
- *@param element !ToDo (Parameter description)
+ *@param element
***************************************/
public void configure(TestElement element);
@@ -136,6 +162,7 @@
***************************************/
public Collection getMenuCategories();
-
+ /**
+ *
*@param node
*/
public void setNode(JMeterTreeNode node);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>