org.apache.jorphan.gui.JLabeledChoice Java Examples

The following examples show how to use org.apache.jorphan.gui.JLabeledChoice. 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: PubSamplerUI.java    From mqtt-jmeter with Apache License 2.0 6 votes vote down vote up
private JPanel createPubOption() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Pub options"));

	qosChoice = new JLabeledChoice("QoS Level:", new String[] { String.valueOf(QOS_0), String.valueOf(QOS_1), String.valueOf(QOS_2) }, true, false);
	qosChoice.addChangeListener(this);

	JPanel optsPanel = new HorizontalPanel();
	optsPanel.add(qosChoice);
	optsPanel.add(retainedMsg);
	optsPanel.add(topicName);
	topicName.setToolTipText("Name of topic that the message will be sent to.");
	optsPanel.add(timestamp);
	optsPanelCon.add(optsPanel);

	return optsPanelCon;
}
 
Example #2
Source File: PubSamplerUI.java    From mqtt-jmeter with Apache License 2.0 6 votes vote down vote up
private JPanel createPayload() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Payloads"));
	
	JPanel horizon1 = new HorizontalPanel();
	messageTypes = new JLabeledChoice("Message type:", new String[] { MESSAGE_TYPE_STRING, MESSAGE_TYPE_HEX_STRING, MESSAGE_TYPE_RANDOM_STR_WITH_FIX_LEN }, false, false);
	messageTypes.addChangeListener(this);
	messageTypes.setSelectedIndex(0);
	
	horizon1.add(messageTypes, BorderLayout.WEST);
	stringLength.setVisible(false);
	horizon1.add(stringLength);
	
	JPanel horizon2 = new VerticalPanel();
	messagePanel.setVisible(false);
	horizon2.add(messagePanel);
	
	optsPanelCon.add(horizon1);
	optsPanelCon.add(horizon2);
	return optsPanelCon;
}
 
Example #3
Source File: EfficientConnectSamplerUI.java    From mqtt-jmeter with Apache License 2.0 6 votes vote down vote up
private JPanel createSubOption() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Subscription options"));
	
	JPanel optsPanel0 = new HorizontalPanel();
	optsPanel0.add(shouldSub);
	shouldSub.setSelected(false);
	optsPanelCon.add(optsPanel0);
	
	JPanel optsPanel1 = new HorizontalPanel();
	qosChoice = new JLabeledChoice("QoS Level:", new String[] { String.valueOf(QOS_0), String.valueOf(QOS_1), String.valueOf(QOS_2) }, true, false);
	optsPanel1.add(qosChoice);
	optsPanel1.add(topicNames);
	optsPanelCon.add(optsPanel1);
	
	return optsPanelCon;
}
 
Example #4
Source File: SubSamplerUI.java    From mqtt-jmeter with Apache License 2.0 5 votes vote down vote up
private JPanel createSubOption() {
	JPanel optsPanelCon = new VerticalPanel();
	optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Sub options"));

	qosChoice = new JLabeledChoice("QoS Level:", new String[] { String.valueOf(QOS_0), String.valueOf(QOS_1), String.valueOf(QOS_2) }, true, false);
	sampleOnCondition = new JLabeledChoice("Sample on:", new String[] {SAMPLE_ON_CONDITION_OPTION1, SAMPLE_ON_CONDITION_OPTION2});

	JPanel optsPanel1 = new HorizontalPanel();
	optsPanel1.add(qosChoice);
	optsPanel1.add(topicNames);
	topicNames.setToolTipText("A list of topics to be subscribed to, comma-separated.");
	optsPanel1.add(timestamp);
	optsPanelCon.add(optsPanel1);
	
	JPanel optsPanel3 = new HorizontalPanel();
	sampleOnCondition.addChangeListener(this);
	optsPanel3.add(sampleOnCondition);
	optsPanel3.add(sampleConditionValue);
	sampleOnCondition.setToolTipText("When sub sampler should report out.");
	sampleConditionValue.setToolTipText("Please specify an integer value great than 0, other values will be ignored.");
	optsPanelCon.add(optsPanel3);
	
	JPanel optsPanel2 = new HorizontalPanel();
	optsPanel2.add(debugResponse);
	optsPanelCon.add(optsPanel2);

	return optsPanelCon;
}
 
Example #5
Source File: HonoReceiverSamplerUI.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a new UI that provides means to configure
 * the northbound Telemetry & Event API endpoint to connect to
 * for receiving messages.
 */
public HonoReceiverSamplerUI() {

    honoServerOptions = new ServerOptionsPanel("Telemetry & Event Endpoint");
    tenant = new JLabeledTextField("Tenant");
    container = new JLabeledTextField("Name");
    endpoint = new JLabeledChoice("Endpoint",
            Stream.of(HonoSampler.Endpoint.values()).map(HonoSampler.Endpoint::name).toArray(String[]::new));
    endpoint.setToolTipText("<html>The name of the endpoint to send the AMQP message to.</html>");
    useSenderTime = new JCheckBox("Use sender time");
    senderTimeInProperty = new JRadioButton("Sender time in property");
    senderTimeInProperty.setToolTipText("<html>If set, the sending time is retrieved from the message's application property <em>timeStamp</em>.</html>");
    senderTimeInPayload = new JRadioButton("Sender time in JSON payload");
    final ButtonGroup group = new ButtonGroup();
    group.add(senderTimeInProperty);
    group.add(senderTimeInPayload);
    senderTimeInProperty.setSelected(true);
    senderTimeVariableName = new JLabeledTextField("JSON value key");
    senderTimeVariableName.setEnabled(false);
    prefetch = new JLabeledTextField("Prefetch");
    reconnectAttempts = new JLabeledTextField("Max reconnect attempts");

    addOption(honoServerOptions);
    addOption(tenant);
    addOption(container);
    addOption(getWrapperPanelToFixAlignment(endpoint));
    addOption(prefetch);
    addOption(reconnectAttempts);
    addOption(createTimeStampPanel());
}
 
Example #6
Source File: HonoSamplerUI.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Gets a panel wrapping a choice field.
 *
 * @param labeledChoice The choice to wrap.
 * @return The panel.
 */
protected JPanel getWrapperPanelToFixAlignment(final JLabeledChoice labeledChoice) {
    // wrap the JLabeledChoice in extra panel to align it on the right
    final JPanel wrapperPanel = new JPanel(new BorderLayout());
    wrapperPanel.add(labeledChoice, BorderLayout.WEST);
    // fix superfluous outer indents of JLabeledChoice
    labeledChoice.setLayout(new BoxLayout(labeledChoice, BoxLayout.X_AXIS));
    labeledChoice.getComponentList().get(0).setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    return wrapperPanel;
}
 
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: HonoSenderSamplerUI.java    From hono with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Creates a new UI that provides means to configure
 * the southbound Telemetry &amp; Event API endpoint to connect to
 * for sending messages and an (optional) Device Registration service
 * endpoint for retrieving registration assertions.
 */
public HonoSenderSamplerUI() {

    honoServerOptions = new ServerOptionsPanel("Telemetry & Event Endpoint");
    tenant = new JLabeledTextField("Tenant");
    container = new JLabeledTextField("Name");
    endpoint = new JLabeledChoice("Endpoint",
            Stream.of(HonoSampler.Endpoint.values()).map(HonoSampler.Endpoint::name).toArray(String[]::new));
    endpoint.setToolTipText("<html>The name of the endpoint to send the AMQP message to.</html>");
    deviceId = new JLabeledTextField("Device ID");
    deviceId.setToolTipText("<html>The device identifier to put into the <em>device_id</em> application property of the AMQP message to send.</html>");
    contentType = new JLabeledTextField("Content type");
    data = new JLabeledTextArea("Message data");
    waitForDeliveryResult = new JCheckBox("Wait for delivery result");
    waitForDeliveryResult.setToolTipText("<html>Deselecting this option increases sender throughput, especially of <em>event</em> messages, " +
            "at the expense of not finding out about rejected messages. <br>For this, the number of messages at the receiver end has to be checked.</html>");
    setSenderTime = new JCheckBox("Set sender time in property");
    setSenderTime.setToolTipText(new StringBuilder()
            .append("<html>")
            .append("When checked, the messages being sent will contain a timestamp (millis since epoch start) ")
            .append("in the <em>timeStamp</em> application property.")
            .append("</html>")
            .toString());
    waitForReceivers = new JLabeledTextField(
            "Number of receivers to wait for (e.g. from other threads)");
    waitForReceiversTimeout = new JLabeledTextField(
            "Max time (millis) to wait for receivers");
    sampleSendTimeout = new JLabeledTextField("Max time (millis) for sending a message");
    msgCountPerSamplerRun = new JLabeledTextField("Number of messages per sampler run");

    addOption(honoServerOptions);
    addOption(tenant);
    addOption(container);
    addOption(getWrapperPanelToFixAlignment(endpoint));
    addOption(deviceId);
    addOption(contentType);
    addOption(data);
    addOption(waitForDeliveryResult);
    addOption(setSenderTime);
    addOption(waitForReceivers);
    addOption(waitForReceiversTimeout);
    addOption(sampleSendTimeout);
    addOption(msgCountPerSamplerRun);
}
 
Example #9
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;
}