You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "vlsi (via GitHub)" <gi...@apache.org> on 2023/05/08 14:07:20 UTC

[GitHub] [jmeter] vlsi commented on issue #5895: Split JMeterGUIComponent into metadata and UI parts

vlsi commented on issue #5895:
URL: https://github.com/apache/jmeter/issues/5895#issuecomment-1538422010

   Sample diff for "a" for `ArgumentPanel`:
   
   ```diff
   @@ -60,8 +64,19 @@ import org.apache.jorphan.reflect.Functor;
     * for some other component.
     *
     */
   -@TestElementMetadata(labelResource = "user_defined_variables")
    public class ArgumentsPanel extends AbstractConfigGui implements ActionListener {
   +    @AutoService(JMeterGUIComponentMetadata.class)
   +    public static class Metadata implements JMeterGUIComponentMetadata {
   +        @Override
   +        public Class<? extends JMeterGUIComponent> getImplementationClass() {
   +            return ArgumentsPanel.class;
   +        }
   +
   +        @Override
   +        public String getLabelResource() {
   +            return "user_defined_variables";
   +        }
   +    }
   
        private static final long serialVersionUID = 241L;
   
   @@ -251,6 +266,7 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
         */
        public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model,
                boolean disableButtons, Function<String[], Argument> argCreator) {
   +        setGUIComponentMetadata(new Metadata());
            tableLabel = new JLabel(label);
            this.enableUpDown = enableUpDown;
            this.disableButtons = disableButtons;
   @@ -276,11 +292,6 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
            return null;
        }
   
   -    @Override
   -    public String getLabelResource() {
   -        return "user_defined_variables"; // $NON-NLS-1$
   -    }
   -
   ```
   
   `setGUIComponentMetadata(new Metadata());` is needed in the constructor for backward compatibility: users might have created `new ArgumentsPanel()`, and they expect the component to be workable in that case.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org