org.apache.jmeter.visualizers.gui
Class AbstractVisualizer
- ChangeListener, Clearable, JMeterGUIComponent, Printable, UnsharedComponent, Visualizer
public abstract class AbstractVisualizer
This is the base class for JMeter GUI components which can display test
results in some way. It provides the following conveniences to developers:
Provides convenience methods to help you make a JMeter-compatible GUI:
makeTitlePanel()
. Returns a panel that includes the name of
the component, and a FilePanel that allows users to control what file samples
are logged to.getModel()
and setModel(ResultCollector)
methods for
setting and getting the model class that handles the receiving and logging of
sample results.
For most developers, making a new visualizer is primarly for the purpose of
either calculating new statistics on the sample results that other
visualizers don't calculate, or displaying the results visually in a new and
interesting way. Making a new visualizer for either of these purposes is easy -
just extend this class and implement the
add(SampleResult)
method and display the results as you see fit. This AbstractVisualizer and
the default
ResultCollector
handle
logging and registering to receive SampleEvents for you - all you need to do
is include the JPanel created by makeTitlePanel somewhere in your gui to
allow users set the log file.
If you are doing more than that, you may need to extend
ResultCollector
as well
and modify the
configure(TestElement)
,
modifyTestElement(TestElement)
, and
createTestElement()
methods to create and modify your alternate ResultCollector. For an example
of this, see the
MailerVisualizer
.
clearGui , configure , configureTestElement , createTitleLabel , getComment , getDocAnchor , getName , getNamePanel , getNode , getPrintableComponent , getStaticLabel , isEnabled , makeBorder , makeScrollPane , makeScrollPane , makeTitlePanel , setComment , setEnabled , setName , setNode |
isStats
protected boolean isStats
AbstractVisualizer
public AbstractVisualizer()
configureTestElement
protected void configureTestElement(AbstractListenerElement mc)
This provides a convenience for extenders when they implement the
JMeterGUIComponent.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.
mc
- the TestElement being created.
getErrorLoggingCheckbox
protected JCheckBox getErrorLoggingCheckbox()
Gets the checkbox which selects whether or not only errors should be
logged. Subclasses don't normally need to worry about this checkbox,
because it is automatically added to the GUI in
makeTitlePanel()
,
and the behavior is handled in this base class.
- the error logging checkbox
getFile
public String getFile()
Gets the filename which has been entered in the FilePanel. Subclasses
don't normally need to call this method, because configuration of the
FilePanel is handled in this base class.
getFilePanel
protected Component getFilePanel()
Gets the file panel which allows the user to save results to a file.
Subclasses don't normally need to worry about this panel, because it is
automatically added to the GUI in
makeTitlePanel()
, and the
behavior is handled in this base class.
- the file panel allowing users to save results
getModel
protected ResultCollector getModel()
Provides access to the ResultCollector model class for extending
implementations. Using this method and setModel(ResultCollector) is only
necessary if your visualizer requires a differently behaving
ResultCollector. Using these methods will allow maximum reuse of the
methods provided by AbstractVisualizer in this event.
makeTitlePanel
protected Container makeTitlePanel()
Create a standard title section for JMeter components. This includes the
title for the component and the Name Panel allowing the user to change
the name for the component. The AbstractVisualizer also adds the
FilePanel allowing the user to save the results, and the error logging
checkbox, allowing the user to choose whether or not only errors should
be logged.
This method is typically added to the top of the component at the
beginning of the component's init method.
- makeTitlePanel in interface AbstractJMeterGuiComponent
- a panel containing the component title, name panel, file panel,
and error logging checkbox
setFile
public void setFile(String filename)
Sets the filename which results will be saved to. This will set the
filename in the FilePanel. Subclasses don't normally need to call this
method, because configuration of the FilePanel is handled in this base
class.
filename
- the new filename
setModel
protected void setModel(ResultCollector collector)
Provides extending classes the opportunity to set the ResultCollector
model for the Visualizer. This is useful to allow maximum reuse of the
methods from AbstractVisualizer.
stateChanged
public void stateChanged(ChangeEvent e)
Invoked when the target of the listener has changed its state. This
implementation assumes that the target is the FilePanel, and will update
the result collector for the new filename.
e
- the event that has occurred
Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.