You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2016/03/13 12:31:07 UTC

svn commit: r1734787 - /jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java

Author: sebb
Date: Sun Mar 13 11:31:07 2016
New Revision: 1734787

URL: http://svn.apache.org/viewvc?rev=1734787&view=rev
Log:
Javadoc - add sample implementations

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java?rev=1734787&r1=1734786&r2=1734787&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/JMeterGUIComponent.java Sun Mar 13 11:31:07 2016
@@ -107,6 +107,16 @@ public interface JMeterGUIComponent exte
      * the model class that it knows how to display, and this method is called
      * when new test elements are created.
      *
+     * <p>
+     * The canonical implementation looks like this:
+     * <pre>
+     * public TestElement createTestElement() {
+     *     TestElementXYZ el = new TestElementXYZ();
+     *     modifyTestElement(el);
+     *     return el;
+     * }
+     * </pre>
+     *
      * @return the Test Element object that the GUI component represents.
      */
     TestElement createTestElement();
@@ -118,6 +128,23 @@ public interface JMeterGUIComponent exte
      * after a user has filled out the form elements in the gui with new
      * information.
      *
+     * <p>
+     * The canonical implementation looks like this:
+     * <pre>
+     * public void modifyTestElement(TestElement element) {
+     *     configureTestElement(element);
+     *     // Using the element setters (preferred):
+     *     TestElementXYZ xyz = (TestElementXYZ) element;
+     *     xyz.setState(guiState.getText());
+     *     xyz.setCode(guiCode.getText());
+     *     ... other GUI fields ...
+     *     // or directly (do not use unless there is no setter for the field):
+     *     element.setProperty(TestElementXYZ.STATE, guiState.getText())
+     *     element.setProperty(TestElementXYZ.CODE, guiCode.getText())
+     *     ... other GUI fields ...
+     * }
+     * </pre>
+     *
      * @param element
      *            the TestElement to modify
      */
@@ -155,6 +182,23 @@ public interface JMeterGUIComponent exte
      * all GUI fields to represent those data. This method is called to allow
      * JMeter to show the user the GUI that represents the test element's data.
      *
+     * <p>
+     * The canonical implementation looks like this:
+     * <pre>
+     * public void configure(TestElement element) {
+     *     super.configure(element);
+     *     // Using the element getter (preferred):
+     *     TestElementXYZ xyz = (TestElementXYZ) element;
+     *     guiState.setText(xyz.getState());
+     *     guiCode.setText(xyz.getCode());
+     *     ... other GUI fields ...
+     *     // or using the element property names directly (do not use unless there is no getter for the field)
+     *     guiState.setText(element.getPropertyAsString(TestElementXYZ.STATE));
+     *     guiCode.setText(element.getPropertyAsString(TestElementXYZ.CODE));
+     *     ... other GUI fields ...
+     * }
+     * </pre>
+     *
      * @param element
      *            the TestElement to configure
      */