Java Code Examples for org.apache.jmeter.util.JMeterUtils#getResString()

The following examples show how to use org.apache.jmeter.util.JMeterUtils#getResString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpSimpleTableControlGui.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
private JPanel createControls() {
    start = new JButton(JMeterUtils.getResString("start")); 
    start.addActionListener(this);
    start.setActionCommand(ACTION_START);
    start.setEnabled(true);

    stop = new JButton(JMeterUtils.getResString("stop")); 
    stop.addActionListener(this);
    stop.setActionCommand(ACTION_STOP);
    stop.setEnabled(false);

    JPanel panel = new JPanel();
    panel.add(start);
    panel.add(stop);
    return panel;
}
 
Example 2
Source File: HttpSimpleTableControlGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
private JPanel createPortPanel() {
    portField = new JTextField(HttpSimpleTableControl.DEFAULT_PORT_S, 8);
    portField.setName(HttpSimpleTableControl.PORT);

    JLabel label = new JLabel(JMeterUtils.getResString("port")); 
    label.setLabelFor(portField);

    datasetDirectoryField = new JTextField(
            HttpSimpleTableControl.DEFAULT_DATA_DIR, 8);
    datasetDirectoryField.setName(HttpSimpleTableControl.DATA_DIR);

    JLabel ddLabel = new JLabel("Dataset directory:"); 
    ddLabel.setLabelFor(datasetDirectoryField);

    timestampChkBox = new JCheckBox();
    timestampChkBox.setSelected(HttpSimpleTableControl.DEFAULT_TIMESTAMP);
    timestampChkBox.setName(HttpSimpleTableControl.TIMESTAMP);

    JLabel tsLabel = new JLabel("Timestamp:"); 
    tsLabel.setLabelFor(timestampChkBox);

    HorizontalPanel panel = new HorizontalPanel();
    panel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(), "Settings")); 

    panel.add(label);
    panel.add(portField);

    panel.add(ddLabel);
    panel.add(datasetDirectoryField);

    panel.add(tsLabel);
    panel.add(timestampChkBox);

    panel.add(Box.createHorizontalStrut(10));

    return panel;
}
 
Example 3
Source File: SynthesisReportGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 * Get the text for the value as the translation of the resource name.
 *
 * @param value  value for which to get the translation
 * @param column index which column message parameters should be used
 * @param row    not used
 * @return the text
 */
protected String getText(Object value, int row, int column) {
    if (value == null) {
        return "";
    }
    if (columnsMsgParameters != null && columnsMsgParameters[column] != null) {
        return MessageFormat.format(JMeterUtils.getResString(value.toString()), columnsMsgParameters[column]);
    } else {
        return JMeterUtils.getResString(value.toString());
    }
}
 
Example 4
Source File: WebSocketSamplerGui.java    From jmeter-websocket with Apache License 2.0 5 votes vote down vote up
private JPanel getDomainPanel() {
    domain = new JTextField(20);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_domain")); // $NON-NLS-1$
    label.setLabelFor(domain);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(domain, BorderLayout.CENTER);
    return panel;
}
 
Example 5
Source File: WebSocketSamplerGui.java    From jmeter-websocket with Apache License 2.0 5 votes vote down vote up
private JPanel getPortPanel() {
    port = new JTextField(4);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_port")); // $NON-NLS-1$
    label.setLabelFor(port);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(port, BorderLayout.CENTER);

    return panel;
}
 
Example 6
Source File: WebSocketSamplerGui.java    From jmeter-websocket with Apache License 2.0 5 votes vote down vote up
protected Component getProtocolAndPathPanel() {
    // PATH
    path = new JTextField(15);
    JLabel pathLabel = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$
    pathLabel.setLabelFor(path);

    // PROTOCOL
    protocol = new JTextField(4);
    JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$
    protocolLabel.setLabelFor(protocol);

    // CONTENT_ENCODING
    contentEncoding = new JTextField(10);
    JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$
    contentEncodingLabel.setLabelFor(contentEncoding);

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(pathLabel);
    panel.add(path);
    panel.add(Box.createHorizontalStrut(5));

    panel.add(protocolLabel);
    panel.add(protocol);
    panel.add(Box.createHorizontalStrut(5));

    panel.add(contentEncodingLabel);
    panel.add(contentEncoding);
    panel.setMinimumSize(panel.getPreferredSize());

    return panel;
}
 
Example 7
Source File: CommonConnUI.java    From mqtt-jmeter with Apache License 2.0 4 votes vote down vote up
public JPanel createProtocolPanel() {
		JPanel protocolPanel = new VerticalPanel();
		protocolPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Protocols"));
		
		JPanel pPanel = new JPanel();
		pPanel.setLayout(new BorderLayout());
		//pPanel.setLayout(new GridLayout(1, 2));

		JPanel pCenter = new JPanel(new FlowLayout(FlowLayout.LEFT));
//		clientNames = new JLabeledChoice("Clients:", clientNamesList.toArray(new String[] {}), true, false);
//		clientNames.addChangeListener(this);
//		pCenter.add(clientNames);

		protocols = new JLabeledChoice("Protocols:", false);
		//JComboBox<String> component = (JComboBox) protocols.getComponentList().get(1);
		//component.setSize(new Dimension(40, component.getHeight()));
		protocols.addChangeListener(this);
		pCenter.add(protocols);

		wsPath.setFont(null);
		wsPath.setVisible(false);
		pCenter.add(wsPath);

		pPanel.add(pCenter, BorderLayout.CENTER);

		dualAuth.setSelected(false);
		dualAuth.setFont(null);
		dualAuth.setVisible(false);
		dualAuth.addChangeListener(this);
		pPanel.add(dualAuth, BorderLayout.SOUTH);

		JPanel panel = new JPanel(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		c.anchor = GridBagConstraints.SOUTHWEST;
		
//		c.gridx = 0; c.gridy = 0; c.gridwidth = 2;
//		tksFilePath.setVisible(false);
//		panel.add(tksFilePath, c);
//
//		c.gridx = 2; c.gridy = 0; c.gridwidth = 1;
//		tksBrowseButton = new JButton(JMeterUtils.getResString("browse"));
//		tksBrowseButton.setActionCommand(TKS_BROWSE);
//		tksBrowseButton.addActionListener(this);
//		tksBrowseButton.setVisible(false);
//		panel.add(tksBrowseButton, c);
//		
//		c.gridx = 3; c.gridy = 0; c.gridwidth = 2;
//		tksPassword.setVisible(false);
//		panel.add(tksPassword, c);

		//c.weightx = 0.0;
		c.gridx = 0; c.gridy = 1; c.gridwidth = 2;
		ccFilePath.setVisible(false);
		panel.add(ccFilePath, c);

		c.gridx = 2; c.gridy = 1; c.gridwidth = 1;
		ccBrowseButton = new JButton(JMeterUtils.getResString("browse"));
		ccBrowseButton.setActionCommand(CC_BROWSE);
		ccBrowseButton.addActionListener(this);
		ccBrowseButton.setVisible(false);
		panel.add(ccBrowseButton, c);
		
		c.gridx = 3; c.gridy = 1; c.gridwidth = 2;
		ccPassword.setVisible(false);
		panel.add(ccPassword, c);
		
		protocolPanel.add(pPanel);
		protocolPanel.add(panel);
		
		return protocolPanel;
	}
 
Example 8
Source File: MergeResultsGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(),
            WIKIPAGE));

    JPanel containerPanel = new VerticalPanel();

    JButton saveConfigButton = new JButton(
            JMeterUtils.getResString("config_save_settings")); 
    saveConfigButton.addActionListener(this);
    saveConfigButton.setActionCommand(ACTION_SAVE_CONFIG);

    mergeAndWritePanel = new FilePanel(
            "Merge and write results to output file", EXTS); 
    mergeAndWritePanel.addChangeListener(this);
    mergeAndWritePanel.add(saveConfigButton);

    mergeButton = new JButton("Merge");
    mergeButton.addActionListener(this);
    mergeButton.setActionCommand(ACTION_MERGE);

    JPanel controlPanel = new JPanel();
    controlPanel.add(mergeButton);

    containerPanel.add(createParamsPanel());
    containerPanel.add(getMergeAndWritePanel());
    containerPanel.add(controlPanel);

    add(mainPanel, BorderLayout.NORTH);
    add(containerPanel, BorderLayout.CENTER);

    hideFilePanel();
    enableMaximize(false);
}
 
Example 9
Source File: SetVariablesActionGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private JPanel createVariablePanel() {
    argsPanel = new ArgumentsPanel(JMeterUtils.getResString("user_defined_variables"), null, true, true);
    return argsPanel;
}
 
Example 10
Source File: ParameterizedControllerGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private JPanel createVariablePanel() {
    argsPanel = new ArgumentsPanel(JMeterUtils.getResString("user_defined_variables"), null, true, true);
    return argsPanel;
}
 
Example 11
Source File: OAuthSamplerGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private JPanel getResourceConfigPanel() {
    consumerKey = new JLabeledTextField("Consumer Key", 25);
    consumerSecret = new JLabeledTextField("Consumer Secret", 25);
    automaticRedirect = new JCheckBox(JMeterUtils.getResString("follow_redirects"));
    httpMethods = new JLabeledChoice("Method", new String[]{"GET", "POST", "PUT", "DELETE", "PATCH"});
    httpMethods.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            JLabeledChoice c = (JLabeledChoice) e.getSource();
            String text = c.getText();
            if ("PUT".equals(text) || "POST".equals(text) || "PATCH".equals(text)) {
                automaticRedirect.setSelected(false);
                automaticRedirect.setEnabled(false);
            } else {
                automaticRedirect.setEnabled(true);
            }
        }
    });
    useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive"));
    hostBaseUrl = new JLabeledTextField("Base Url", 25);
    resource = new JLabeledTextField("Resource", 20);
    port = new JLabeledTextField("Port", 10);
    VerticalPanel resourceConfigPanel = new VerticalPanel();
    HorizontalPanel oAuthPanel = new HorizontalPanel();
    oAuthPanel.add(consumerKey);
    oAuthPanel.add(consumerSecret);
    HorizontalPanel panel1 = new HorizontalPanel();
    panel1.add(httpMethods);
    panel1.add(useKeepAlive);
    panel1.add(automaticRedirect);
    HorizontalPanel panel2 = new HorizontalPanel();
    panel2.add(hostBaseUrl);
    panel2.add(port);
    HorizontalPanel panel3 = new HorizontalPanel();
    panel3.add(resource);
    resourceConfigPanel.add(panel1);
    resourceConfigPanel.add(oAuthPanel);
    resourceConfigPanel.add(panel2);
    resourceConfigPanel.add(panel3);
    return resourceConfigPanel;
}