use of javax.swing.DefaultComboBoxModel in project jmeter by apache.
the class ThroughputControllerGui method init.
private void init() {
// WARNING: called from ctor so must not be overridden (i.e. must be private or final)
setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
setBorder(makeBorder());
add(makeTitlePanel());
DefaultComboBoxModel<String> styleModel = new DefaultComboBoxModel<>();
styleModel.addElement(BYNUMBER_LABEL);
styleModel.addElement(BYPERCENT_LABEL);
styleBox = new JComboBox<>(styleModel);
styleBox.addActionListener(evt -> {
if (((String) styleBox.getSelectedItem()).equals(BYNUMBER_LABEL)) {
style = ThroughputController.BYNUMBER;
} else {
style = ThroughputController.BYPERCENT;
}
});
add(styleBox);
// TYPE FIELD
JPanel tpPanel = new JPanel();
JLabel tpLabel = new JLabel(THROUGHPUT_LABEL);
tpPanel.add(tpLabel);
// TEXT FIELD
throughput = new JTextField(15);
tpPanel.add(throughput);
// $NON-NLS-1$
throughput.setText("1");
tpPanel.add(throughput);
add(tpPanel);
// PERTHREAD FIELD
perthread = new JCheckBox(PERTHREAD_LABEL, isPerThread);
perthread.addItemListener(evt -> {
if (evt.getStateChange() == ItemEvent.SELECTED) {
isPerThread = true;
} else {
isPerThread = false;
}
});
add(CheckBoxPanel.wrap(perthread));
}
use of javax.swing.DefaultComboBoxModel in project jmeter by apache.
the class ProxyControlGui method createHTTPSamplerPanel.
private JPanel createHTTPSamplerPanel() {
DefaultComboBoxModel<String> m = new DefaultComboBoxModel<>();
for (String s : HTTPSamplerFactory.getImplementations()) {
m.addElement(s);
}
m.addElement(USE_DEFAULT_HTTP_IMPL);
samplerTypeName = new JComboBox<>(m);
samplerTypeName.setSelectedItem(USE_DEFAULT_HTTP_IMPL);
samplerTypeName.addItemListener(this);
// $NON-NLS-1$
samplerRedirectAutomatically = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto"));
samplerRedirectAutomatically.setSelected(false);
samplerRedirectAutomatically.addActionListener(this);
samplerRedirectAutomatically.setActionCommand(ENABLE_RESTART);
// $NON-NLS-1$
samplerFollowRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects"));
samplerFollowRedirects.setSelected(true);
samplerFollowRedirects.addActionListener(this);
samplerFollowRedirects.setActionCommand(ENABLE_RESTART);
// $NON-NLS-1$
useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive"));
useKeepAlive.setSelected(true);
useKeepAlive.addActionListener(this);
useKeepAlive.setActionCommand(ENABLE_RESTART);
// $NON-NLS-1$
samplerDownloadImages = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images"));
samplerDownloadImages.setSelected(false);
samplerDownloadImages.addActionListener(this);
samplerDownloadImages.setActionCommand(ENABLE_RESTART);
prefixHTTPSampleName = new JTextField(4);
prefixHTTPSampleName.addKeyListener(this);
prefixHTTPSampleName.setName(PREFIX_HTTP_SAMPLER_NAME);
// TODO Not sure this is needed
prefixHTTPSampleName.setActionCommand(ENABLE_RESTART);
// $NON-NLS-1$
JLabel labelPrefix = new JLabel(JMeterUtils.getResString("proxy_prefix_http_sampler_name"));
labelPrefix.setLabelFor(prefixHTTPSampleName);
// $NON-NLS-1$
JLabel labelSamplerType = new JLabel(JMeterUtils.getResString("proxy_sampler_type"));
labelSamplerType.setLabelFor(samplerTypeName);
GridBagLayout gridBagLayout = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridheight = 1;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1;
gbc.weighty = 1;
JPanel panel = new JPanel(gridBagLayout);
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), // $NON-NLS-1$
JMeterUtils.getResString("proxy_sampler_settings")));
panel.add(labelPrefix, gbc.clone());
gbc.gridx++;
gbc.weightx = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(prefixHTTPSampleName, gbc.clone());
gbc.weightx = 1;
gbc.gridx = 0;
gbc.gridy++;
gbc.fill = GridBagConstraints.VERTICAL;
panel.add(samplerDownloadImages, gbc.clone());
gbc.gridx = 0;
gbc.gridy++;
gbc.fill = GridBagConstraints.VERTICAL;
panel.add(samplerRedirectAutomatically, gbc.clone());
gbc.gridx++;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(samplerFollowRedirects, gbc.clone());
gbc.gridx = 0;
gbc.gridy++;
gbc.fill = GridBagConstraints.VERTICAL;
panel.add(useKeepAlive, gbc.clone());
gbc.gridx = 0;
gbc.gridy++;
gbc.fill = GridBagConstraints.VERTICAL;
panel.add(labelSamplerType, gbc.clone());
gbc.gridx++;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(samplerTypeName, gbc.clone());
return panel;
}
use of javax.swing.DefaultComboBoxModel in project jmeter by apache.
the class ProxyControlGui method createGroupingPanel.
private JPanel createGroupingPanel() {
DefaultComboBoxModel<String> m = new DefaultComboBoxModel<>();
// Note: position of these elements in the menu *must* match the
// corresponding ProxyControl.GROUPING_* values.
// $NON-NLS-1$
m.addElement(JMeterUtils.getResString("grouping_no_groups"));
// $NON-NLS-1$
m.addElement(JMeterUtils.getResString("grouping_add_separators"));
// $NON-NLS-1$
m.addElement(JMeterUtils.getResString("grouping_in_controllers"));
// $NON-NLS-1$
m.addElement(JMeterUtils.getResString("grouping_store_first_only"));
// $NON-NLS-1$
m.addElement(JMeterUtils.getResString("grouping_in_transaction_controllers"));
groupingMode = new JComboBox<>(m);
groupingMode.setPreferredSize(new Dimension(150, 20));
groupingMode.setSelectedIndex(0);
groupingMode.addItemListener(this);
// $NON-NLS-1$
JLabel label2 = new JLabel(JMeterUtils.getResString("grouping_mode"));
label2.setLabelFor(groupingMode);
HorizontalPanel panel = new HorizontalPanel();
panel.add(label2);
panel.add(groupingMode);
return panel;
}
use of javax.swing.DefaultComboBoxModel in project jabref by JabRef.
the class ConnectToSharedDatabaseDialog method initLayout.
/**
* Set up the layout and position the control units in their right place.
*/
private void initLayout() {
setResizable(false);
Insets defautInsets = new Insets(4, 15, 4, 4);
connectionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Connection")));
connectionPanel.setLayout(gridBagLayout);
Set<DBMSType> availableDBMSTypes = DBMSConnection.getAvailableDBMSTypes();
DefaultComboBoxModel<DBMSType> comboBoxModel = new DefaultComboBoxModel<>(availableDBMSTypes.toArray(new DBMSType[availableDBMSTypes.size()]));
dbmsTypeDropDown.setModel(comboBoxModel);
gridBagConstraints.insets = defautInsets;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagLayout.setConstraints(connectionPanel, gridBagConstraints);
//1. column
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
connectionPanel.add(databaseTypeLabel, gridBagConstraints);
gridBagConstraints.gridy = 1;
connectionPanel.add(hostPortLabel, gridBagConstraints);
gridBagConstraints.gridy = 2;
connectionPanel.add(databaseLabel, gridBagConstraints);
gridBagConstraints.gridy = 3;
connectionPanel.add(userLabel, gridBagConstraints);
gridBagConstraints.gridy = 4;
connectionPanel.add(passwordLabel, gridBagConstraints);
// 2. column
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
connectionPanel.add(dbmsTypeDropDown, gridBagConstraints);
gridBagConstraints.gridy = 1;
// the hostField is smaller than the others.
gridBagConstraints.gridwidth = 1;
gridBagConstraints.insets = new Insets(4, 15, 4, 0);
connectionPanel.add(hostField, gridBagConstraints);
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = defautInsets;
connectionPanel.add(databaseField, gridBagConstraints);
gridBagConstraints.gridy = 3;
connectionPanel.add(userField, gridBagConstraints);
gridBagConstraints.gridy = 4;
connectionPanel.add(passwordField, gridBagConstraints);
gridBagConstraints.gridy = 5;
connectionPanel.add(rememberPassword, gridBagConstraints);
// 3. column
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.insets = new Insets(4, 0, 4, 4);
connectionPanel.add(portField, gridBagConstraints);
// help button
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 6;
gridBagConstraints.insets = new Insets(10, 10, 0, 0);
JPanel helpPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
helpPanel.add(helpButton);
// add panel
getContentPane().setLayout(gridBagLayout);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
gridBagLayout.setConstraints(connectionPanel, gridBagConstraints);
getContentPane().add(connectionPanel);
// filePanel
filePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("File")));
filePanel.setLayout(gridBagLayout);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
filePanel.add(autosaveFile, gridBagConstraints);
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 1;
filePanel.add(fileLocationField, gridBagConstraints);
gridBagConstraints.gridx = 2;
filePanel.add(browseButton, gridBagConstraints);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
gridBagLayout.setConstraints(filePanel, gridBagConstraints);
getContentPane().add(filePanel);
// buttonPanel
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonPanel.add(connectButton);
buttonPanel.add(cancelButton);
buttonPanel.add(helpPanel);
gridBagConstraints.gridy = 2;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
gridBagLayout.setConstraints(buttonPanel, gridBagConstraints);
getContentPane().add(buttonPanel);
// Owner window should be disabled while this dialog is opened.
setModal(true);
}
use of javax.swing.DefaultComboBoxModel in project qi4j-sdk by Qi4j.
the class EntityViewer method initUI.
private void initUI() {
propertiesPanel = new PropertiesPanel();
propertiesPanel.initializeQi4J(qi4jspi);
propertiesAreaPane.add(propertiesPanel, BorderLayout.CENTER);
treePanel = new TreePanel();
treePanel.initializeQi4J(qi4jspi, model);
treePanel.reload();
splitPane.setLeftComponent(treePanel);
splitPane.setDividerLocation(200);
DefaultComboBoxModel entityComboModel = new DefaultComboBoxModel();
entitiesCombo.setModel(entityComboModel);
entitiesCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
entitiesComboItemStateChanged(evt);
}
});
treePanel.getTreeComponent().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent evt) {
treePanelValueChanged(evt);
}
});
initEntityCombo(entityComboModel);
}
Aggregations