private void initializeFunctionList() { String[] functionNames = CompoundVariable.getFunctionNames(); Arrays.sort(functionNames, String::compareToIgnoreCase); functionList = new JLabeledChoice(JMeterUtils.getResString("choose_function"), functionNames); //$NON-NLS-1$ functionList.addChangeListener(this); }
@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); } } });
/** * Implements JMeterGUIComponent.clearGui */ @Override public void clearGui() { super.clearGui(); tableModel.clearData(); clearEachIteration.setSelected(false); policy.setText(DEFAULT_POLICY); configureButtonsState(); }
/** * Initialises all of the components on this panel. */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) // Register the handler for focus listening. This handler will // only notify the registered when the text changes from when // the focus is gained to when it is lost. choiceList.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { notifyChangeListeners(); } }); // Add the sub components this.add(mLabel); this.add(choiceList); if (withButtons) { add = new JButton("Add"); add.setMargin(new Insets(1, 1, 1, 1)); add.addActionListener(new AddListener()); this.add(add); delete = new JButton("Del"); delete.setMargin(new Insets(1, 1, 1, 1)); delete.addActionListener(new DeleteListener()); this.add(delete); } }
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) templateList.setValues(TemplateManager.getInstance().getTemplateNames()); templateList.addChangeListener(this); reloadTemplateButton.addActionListener(this); reloadTemplateButton.setFont(FONT_SMALL); this.getContentPane().setLayout(new BorderLayout(10, 0)); JPanel templateBar = new JPanel(new BorderLayout()); templateBar.add(templateList, BorderLayout.CENTER); JPanel reloadBtnBar = new JPanel(); reloadBtnBar.add(reloadTemplateButton); templateBar.add(reloadBtnBar, BorderLayout.EAST); this.getContentPane().add(templateBar, BorderLayout.NORTH); helpDoc.setContentType("text/html"); //$NON-NLS-1$ helpDoc.setEditable(false); helpDoc.addHyperlinkListener(this); this.getContentPane().add(scroller, BorderLayout.CENTER); applyTemplateButton.addActionListener(this); cancelButton.addActionListener(this); // Bottom buttons bar JPanel actionBtnBar = new JPanel(new FlowLayout()); actionBtnBar.add(applyTemplateButton); actionBtnBar.add(cancelButton); this.getContentPane().add(actionBtnBar, BorderLayout.SOUTH); this.pack(); this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT)); ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size populateTemplatePage(); }
fileEncoding = new JLabeledChoice(JMeterUtils.getResString("content_encoding") + nonBreakingSpace + nonBreakingSpace, // $NON-NLS-1$ PublisherSampler.getSupportedEncodings(), true, false); fileEncoding.setLayout(new BoxLayout(fileEncoding, BoxLayout.X_AXIS)); fileEncoding.add(Box.createHorizontalGlue()); mainPanel.add(fileEncoding);
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");
@Override public void clearGui() { super.clearGui(); this.displayName = true; this.warningLabel.setVisible(false); argsPanel.clearGui(); classNameLabeledChoice.setSelectedIndex(0); } }
cssJqueryActionPanel.add(cssJqueryField, c); cssJqueryLabeledChoice = new JLabeledChoice( JMeterUtils.getResString("cssjquery_impl"), // $NON-NLS-1$ getImplementations());
/** {@inheritDoc} */ @Override public void configure(TestElement config) { super.configure(config); argsPanel.configure((Arguments) config.getProperty(JavaSampler.ARGUMENTS).getObjectValue()); String className = config.getPropertyAsString(JavaSampler.CLASSNAME); if(!checkContainsClassName(classNameLabeledChoice, className)) { classNameLabeledChoice.addValue(className); } warningLabel.setVisible(!classOk(className)); classNameLabeledChoice.setText(className); configureClassName(); }
element.setProperty(LDAPExtSampler.PORT, port.getText()); element.setProperty(LDAPExtSampler.ROOTDN, rootdn.getText()); element.setProperty(LDAPExtSampler.SCOPE,String.valueOf(scope.getSelectedIndex())); element.setProperty(LDAPExtSampler.COUNTLIM, countlim.getText()); element.setProperty(LDAPExtSampler.TIMELIM, timelim.getText());
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>");
port.setText(""); //$NON-NLS-1$ add.setText(""); //$NON-NLS-1$ scope.setSelectedIndex(SCOPE_STRINGS.length - 1); countlim.setText(""); //$NON-NLS-1$ timelim.setText(""); //$NON-NLS-1$
/** * Shows the main cookie configuration panel. */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) tableModel = new PowerTableModel(COLUMN_RESOURCE_NAMES, columnClasses); clearEachIteration = new JCheckBox(JMeterUtils.getResString("clear_cookies_per_iter"), false); //$NON-NLS-1$ policy = new JLabeledChoice( JMeterUtils.getResString("cookie_manager_policy"), //$NON-NLS-1$ new HC4CookieHandler().getPolicies()); setLayout(new BorderLayout()); setBorder(makeBorder()); JPanel northPanel = new JPanel(); northPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH)); northPanel.add(makeTitlePanel()); JPanel optionsPane = new JPanel(); optionsPane.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), JMeterUtils.getResString("cookie_options"))); // $NON-NLS-1$ optionsPane.setLayout(new VerticalLayout(5, VerticalLayout.BOTH)); optionsPane.add(clearEachIteration); JPanel policyTypePane = new JPanel(); policyTypePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); policyTypePane.add(policy); optionsPane.add(policyTypePane); northPanel.add(optionsPane); add(northPanel, BorderLayout.NORTH); add(createCookieTablePanel(), BorderLayout.CENTER); }
private void transfer(JMSSampler element) { element.setQueueConnectionFactory(queueConnectionFactory.getText()); element.setSendQueue(sendQueue.getText()); element.setReceiveQueue(receiveQueue.getText()); element.setProperty(JMSSampler.JMS_COMMUNICATION_STYLE, jmsCommunicationStyle.getSelectedIndex()); element.removeProperty(JMSSampler.IS_ONE_WAY); element.setNonPersistent(useNonPersistentDelivery.isSelected()); element.setUseReqMsgIdAsCorrelId(useReqMsgIdAsCorrelId.isSelected()); element.setUseResMsgIdAsCorrelId(useResMsgIdAsCorrelId.isSelected()); element.setTimeout(timeout.getText()); element.setExpiration(expiration.getText()); element.setPriority(priority.getText()); element.setJMSSelector(jmsSelector.getText()); element.setNumberOfSamplesToAggregate(numberOfSamplesToAggregate.getText()); element.setContent(messageContent.getText()); element.setInitialContextFactory(initialContextFactory.getText()); element.setContextProvider(providerUrl.getText()); Arguments jndiArgs = (Arguments) jndiPropertiesPanel.createTestElement(); element.setJNDIProperties(jndiArgs); JMSProperties args = (JMSProperties) jmsPropertiesPanel.createTestElement(); element.setJMSProperties(args); }
@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); } } });
classNameLabeledChoice = new JLabeledChoice( JMeterUtils.getResString("protocol_java_classname"), possibleClasses.toArray(ArrayUtils.EMPTY_STRING_ARRAY), true, false); classNameLabeledChoice.addChangeListener(this);
@Override public void configure(TestElement el) { super.configure(el); CookieManager cookieManager = (CookieManager) el; populateTable(cookieManager); clearEachIteration.setSelected(cookieManager.getClearEachIteration()); // must set policy after setting handler (which may change the policy) policy.setText(cookieManager.getPolicy()); }
@Override public void clearGui() { super.clearGui(); honoServerOptions.clearGui(); endpoint.setSelectedIndex(0); tenant.setText(""); container.setText(""); reconnectAttempts.setText("0"); prefetch.setText("50"); useSenderTime.setSelected(false); senderTimeInProperty.setSelected(true); senderTimeVariableName.setText("timeStamp"); }
private String process(String textToParse) { try { List<String> result = new ArrayList<>(); Extractor extractor = HtmlExtractor.getExtractorImpl(cssJqueryLabeledChoice.getText()); final int nbFound = extractor.extract( cssJqueryField.getText(), attributeField.getText(), -1, textToParse, result, 0, null); // Construct a multi-line string with all matches StringBuilder sb = new StringBuilder(); sb.append("Match count: ").append(nbFound).append("\n"); for (int j = 0; j < nbFound; j++) { String mr = result.get(j); sb.append("Match[").append(j+1).append("]=").append(mr).append("\n"); } return sb.toString(); } catch (Exception ex) { StringBuilder sb = new StringBuilder(); String message = MessageFormat.format( JMeterUtils.getResString("cssjquery_tester_error") // $NON-NLS-1$ , new Object[]{cssJqueryField.getText(), ex.getMessage()}); sb.append(message); return sb.toString(); } } /** {@inheritDoc} */