Class MailerVisualizer

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, ClearGui, JMeterGUIComponent, UnsharedComponent, Clearable, Printable, Visualizer

public class MailerVisualizer extends AbstractVisualizer implements ActionListener, Clearable, ChangeListener
This class implements a visualizer that mails a message when an error occurs.
See Also:
  • Constructor Details

    • MailerVisualizer

      public MailerVisualizer()
      Constructs the MailerVisualizer and initializes its GUI.
  • Method Details

    • getControlPanel

      public JPanel getControlPanel()
    • clearData

      public void clearData()
      Clears any stored sampling-information.
      Specified by:
      clearData in interface Clearable
    • add

      public void add(SampleResult res)
      Description copied from interface: Visualizer
      This method is called by sampling thread to inform the visualizer about the arrival of a new sample.
      Specified by:
      add in interface Visualizer
      Parameters:
      res - the newly arrived sample
    • toString

      public String toString()
      Overrides:
      toString in class Component
    • getLabelResource

      public String getLabelResource()
      Description copied from interface: JMeterGUIComponent
      Get the component's resource name, which getStaticLabel uses to derive the component's label in the local language. The resource name is fixed, and does not vary with the selected language.

      Normally this method should be overridden in preference to overriding getStaticLabel(). However where the resource name is not available or required, getStaticLabel() may be overridden instead.

      Specified by:
      getLabelResource in interface JMeterGUIComponent
      Returns:
      the resource name
    • getAttributesTitle

      public String getAttributesTitle()
      Returns a String for the title of the attributes-panel as set up in the properties-file using the lookup-constant "mailer_attributes_panel".
      Returns:
      The title of the component.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Reacts on an ActionEvent (like pressing a button).
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - The ActionEvent with information about the event and its source.
    • configure

      public void configure(org.apache.jmeter.testelement.TestElement el)
      Restores MailerVisualizer.
      Specified by:
      configure in interface JMeterGUIComponent
      Overrides:
      configure in class AbstractVisualizer
      Parameters:
      el - the TestElement to configure
    • createTestElement

      public org.apache.jmeter.testelement.TestElement createTestElement()
      Makes MailerVisualizer storable.
      Specified by:
      createTestElement in interface JMeterGUIComponent
      Overrides:
      createTestElement in class AbstractVisualizer
      Returns:
      the Test Element object that the GUI component represents.
    • modifyTestElement

      public void modifyTestElement(org.apache.jmeter.testelement.TestElement c)
      GUI components are responsible for populating TestElements they create with the data currently held in the GUI components. This method should overwrite whatever data is currently in the TestElement as it is called after a user has filled out the form elements in the gui with new information.

      If you override AbstractJMeterGuiComponent, you might want using AbstractJMeterGuiComponent.bindingGroup instead of overriding modifyTestElement.

      The canonical implementation looks like this:

       @Override
       public void modifyTestElement(TestElement element) {
           super.modifyTestElement(element); // clear the element and assign basic fields like name, gui class, test class
           // Using the element setters (preferred):
           // If the field is empty, you probably want to remove the property instead of storing an empty string
           // See Streamline binding of UI elements to TestElement properties
           // for more details
           TestElementXYZ xyz = (TestElementXYZ) element;
           xyz.setState(StringUtils.defaultIfEmpty(guiState.getText(), null));
           xyz.setCode(StringUtils.defaultIfEmpty(guiCode.getText(), null));
           ... other GUI fields ...
           // or directly (do not use unless there is no setter for the field):
           element.setProperty(TestElementXYZ.STATE, StringUtils.defaultIfEmpty(guiState.getText(), null))
           element.setProperty(TestElementXYZ.CODE, StringUtils.defaultIfEmpty(guiCode.getText(), null))
           ... other GUI fields ...
       }
       
      Specified by:
      modifyTestElement in interface JMeterGUIComponent
      Overrides:
      modifyTestElement in class AbstractVisualizer
      Parameters:
      c - the TestElement to modify
    • 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.
      Specified by:
      stateChanged in interface ChangeListener
      Overrides:
      stateChanged in class AbstractVisualizer
      Parameters:
      e - the event that has occurred