use of com.intellij.ui.components.JBRadioButton in project intellij-community by JetBrains.
the class PyUniversalTestForm method create.
/**
* @param configuration configuration to configure form on creation
* @param customOptions additional option names this form shall support. Make sure your configuration has appropriate properties.
*/
@NotNull
public static PyUniversalTestForm create(@NotNull final PyUniversalTestConfiguration configuration, @NotNull final CustomOption... customOptions) {
// TODO: DOC
final PyUniversalTestForm form = new PyUniversalTestForm();
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor(PythonFileType.INSTANCE);
form.myTargetText.addBrowseFolderListener("Choose File or Folder", null, configuration.getProject(), descriptor);
for (final TestTargetType testTargetType : TestTargetType.values()) {
final JBRadioButton button = new JBRadioButton(StringUtil.capitalize(testTargetType.name().toLowerCase(Locale.getDefault())));
button.setActionCommand(testTargetType.name());
button.addActionListener(o -> form.configureElementsVisibility());
form.myButtonGroup.add(button);
form.myTargets.add(button);
}
form.myButtonGroup.getElements().nextElement().setSelected(true);
form.myOptionsForm = PyCommonOptionsFormFactory.getInstance().createForm(configuration.getCommonOptionsFormData());
final GridConstraints constraints = new GridConstraints();
constraints.setFill(GridConstraints.FILL_BOTH);
form.myOptionsPanel.add(form.myOptionsForm.getMainPanel(), constraints);
form.myLabel.setText(configuration.getTestFrameworkName());
form.addCustomOptions(ObjectArrays.concat(customOptions, new CustomOption(PyUniversalTestsKt.getAdditionalArgumentsPropertyName(), TestTargetType.values())));
configuration.copyTo(ReflectionUtilsKt.getProperties(form, null, true));
return form;
}
use of com.intellij.ui.components.JBRadioButton in project intellij-community by JetBrains.
the class SSHCredentialsDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints();
// top label.
gb.insets = JBUI.insets(2);
gb.weightx = 1;
gb.weighty = 0;
gb.gridwidth = 3;
gb.gridheight = 1;
gb.gridx = 0;
gb.gridy = 0;
gb.anchor = GridBagConstraints.WEST;
gb.fill = GridBagConstraints.HORIZONTAL;
JLabel label = new JLabel(SvnBundle.message("label.ssh.authentication.realm", myRealm));
panel.add(label, gb);
// user name
gb.gridy += 1;
gb.gridwidth = 1;
gb.weightx = 0;
gb.fill = GridBagConstraints.NONE;
label = new JLabel(SvnBundle.message("label.ssh.user.name"));
panel.add(label, gb);
// user name field
gb.gridx = 1;
gb.gridwidth = 2;
gb.weightx = 1;
gb.fill = GridBagConstraints.HORIZONTAL;
myUserNameText = new JTextField();
panel.add(myUserNameText, gb);
label.setLabelFor(myUserNameText);
if (myUserName != null) {
myUserNameText.setText(myUserName);
}
myUserNameText.selectAll();
myUserNameText.getDocument().addDocumentListener(this);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
// ssh agent type
mySshAgentButton = new JBRadioButton(SvnBundle.message("radio.ssh.authentication.with.agent"));
panel.add(mySshAgentButton, gb);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
// password type
myPasswordButton = new JRadioButton(SvnBundle.message("radio.ssh.authentication.with.password"));
panel.add(myPasswordButton, gb);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPasswordLabel = new JLabel(SvnBundle.message("label.ssh.password"));
panel.add(myPasswordLabel, gb);
// passworde field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myPasswordText = new JPasswordField();
panel.add(myPasswordText, gb);
myPasswordLabel.setLabelFor(myPasswordText);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 3;
myKeyButton = new JRadioButton(SvnBundle.message("radio.ssh.authentication.private.key"));
panel.add(myKeyButton, gb);
// key file.
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myKeyFileLabel = new JLabel(SvnBundle.message("label.ssh.key.file"));
panel.add(myKeyFileLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myKeyFileText = new TextFieldWithBrowseButton(this);
myKeyFileText.setEditable(false);
panel.add(myKeyFileText, gb);
myKeyFileLabel.setLabelFor(myKeyFileText);
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPassphraseLabel = new JLabel(SvnBundle.message("label.ssh.passphrase"));
panel.add(myPassphraseLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 1;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.HORIZONTAL;
myPassphraseText = new JPasswordField(30);
panel.add(myPassphraseText, gb);
myPassphraseText.getDocument().addDocumentListener(this);
myPassphraseText.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
checkKeyFile();
updateOKButton();
}
});
myPassphraseLabel.setLabelFor(myPassphraseText);
// key file.
gb.gridy += 1;
gb.weightx = 0;
gb.gridx = 0;
gb.gridwidth = 1;
gb.fill = GridBagConstraints.NONE;
gb.gridwidth = 1;
myPortLabel = new JLabel(SvnBundle.message("label.ssh.port"));
panel.add(myPortLabel, gb);
// key field
gb.gridx = 1;
gb.weightx = 0;
gb.gridwidth = 2;
gb.fill = GridBagConstraints.NONE;
myPortField = new JTextField();
myPortField.setColumns(6);
panel.add(myPortField, gb);
myPortLabel.setLabelFor(myPortField);
myPortField.setText("22");
myPortField.setMinimumSize(myPortField.getPreferredSize());
myPortField.getDocument().addDocumentListener(this);
ButtonGroup group = new ButtonGroup();
group.add(mySshAgentButton);
group.add(myPasswordButton);
group.add(myKeyButton);
mySshAgentButton.setEnabled(myIsAgentAllowed);
group.setSelected((myIsAgentAllowed ? mySshAgentButton : myPasswordButton).getModel(), true);
gb.gridy += 1;
gb.gridx = 0;
gb.gridwidth = 3;
gb.weightx = 1;
gb.anchor = GridBagConstraints.WEST;
gb.fill = GridBagConstraints.HORIZONTAL;
myAllowSaveCheckBox = new JCheckBox(SvnBundle.message("checkbox.ssh.keep.for.current.session"));
panel.add(myAllowSaveCheckBox, gb);
if (!myAllowSave) {
gb.gridy += 1;
final JLabel cannotSaveLabel = new JLabel(SvnBundle.message("svn.cannot.save.credentials.store-auth-creds"));
cannotSaveLabel.setForeground(UIUtil.getInactiveTextColor());
panel.add(cannotSaveLabel, gb);
}
gb.gridy += 1;
panel.add(new JSeparator(), gb);
gb.gridy += 1;
gb.weighty = 1;
panel.add(new JLabel(), gb);
myAllowSaveCheckBox.setSelected(false);
myAllowSaveCheckBox.setEnabled(myAllowSave);
mySshAgentButton.addActionListener(this);
myKeyButton.addActionListener(this);
myPasswordButton.addActionListener(this);
updateFields();
updateOKButton();
return panel;
}
use of com.intellij.ui.components.JBRadioButton in project intellij-community by JetBrains.
the class PluginConflictDialog method getChooserPanelForPlugin.
@NotNull
private JPanel getChooserPanelForPlugin(@NotNull ButtonGroup buttonGroup, @Nullable PluginId plugin) {
final JPanel panel = new JPanel(new BorderLayout());
if (!myIsConflictWithPlatform) {
assert myRadioButtons != null;
final JBRadioButton radioButton = new JBRadioButton();
myRadioButtons.add(radioButton);
buttonGroup.add(radioButton);
radioButton.addChangeListener(e -> getOKAction().updateText());
panel.add(radioButton, BorderLayout.WEST);
panel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
radioButton.setSelected(true);
}
});
}
final JPanel descriptionPanel;
if (plugin != null) {
descriptionPanel = getPluginDescriptionPanel(plugin, !myIsConflictWithPlatform);
} else {
descriptionPanel = getDisableAllPanel();
}
descriptionPanel.setBorder(new JBEmptyBorder(10, myIsConflictWithPlatform ? 10 : 0, 10, 20));
panel.add(descriptionPanel, BorderLayout.CENTER);
return panel;
}
use of com.intellij.ui.components.JBRadioButton in project intellij-community by JetBrains.
the class GrIntroduceParameterDialog method createFieldPanel.
private JPanel createFieldPanel() {
myDoNotReplaceRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Do n&ot replace"));
myReplaceFieldsInaccessibleInRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Replace fields &inaccessible in usage context"));
myReplaceAllFieldsRadioButton = new JBRadioButton(UIUtil.replaceMnemonicAmpersand("&Replace all fields"));
myDoNotReplaceRadioButton.setFocusable(false);
myReplaceFieldsInaccessibleInRadioButton.setFocusable(false);
myReplaceAllFieldsRadioButton.setFocusable(false);
final ButtonGroup group = new ButtonGroup();
group.add(myDoNotReplaceRadioButton);
group.add(myReplaceFieldsInaccessibleInRadioButton);
group.add(myReplaceAllFieldsRadioButton);
final JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(myDoNotReplaceRadioButton);
panel.add(myReplaceFieldsInaccessibleInRadioButton);
panel.add(myReplaceAllFieldsRadioButton);
panel.setBorder(IdeBorderFactory.createTitledBorder("Replace fields used in expression with their getters", true));
return panel;
}
use of com.intellij.ui.components.JBRadioButton in project intellij-community by JetBrains.
the class GitNewResetDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultInsets(0, UIUtil.DEFAULT_HGAP, UIUtil.LARGE_VGAP, 0);
String description = prepareDescription(myProject, myCommits);
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(description)), gb.nextLine().next().coverLine());
String explanation = "This will reset the current branch head to the selected commit, <br/>" + "and update the working tree and the index according to the selected mode:";
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(explanation), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine());
for (GitResetMode mode : GitResetMode.values()) {
JBRadioButton button = new JBRadioButton(mode.getName());
button.setMnemonic(mode.getName().charAt(0));
myButtonGroup.add(button);
panel.add(button, gb.nextLine().next());
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next());
}
myEnumModel = RadioButtonEnumModel.bindEnum(GitResetMode.class, myButtonGroup);
myEnumModel.setSelected(myDefaultMode);
return panel;
}
Aggregations