com.intellij.util.ui.FormBuilder Java Examples
The following examples show how to use
com.intellij.util.ui.FormBuilder.
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: CertificateInfoPanel.java From consulo with Apache License 2.0 | 6 votes |
public CertificateInfoPanel(@Nonnull X509Certificate certificate) { myCertificateWrapper = new CertificateWrapper(certificate); setLayout(new BorderLayout()); FormBuilder builder = FormBuilder.createFormBuilder(); // I'm not using separate panels and form builders to preserve alignment of labels updateBuilderWithTitle(builder, "Issued To"); updateBuilderWithPrincipalData(builder, myCertificateWrapper.getSubjectFields()); updateBuilderWithTitle(builder, "Issued By"); updateBuilderWithPrincipalData(builder, myCertificateWrapper.getIssuerFields()); updateBuilderWithTitle(builder, "Validity Period"); String notBefore = DATE_FORMAT.format(myCertificateWrapper.getNotBefore()); String notAfter = DATE_FORMAT.format(myCertificateWrapper.getNotAfter()); builder = builder .setIndent(IdeBorderFactory.TITLED_BORDER_INDENT) .addLabeledComponent("Valid from:", createColoredComponent(notBefore, "not yet valid", myCertificateWrapper.isNotYetValid())) .addLabeledComponent("Valid until:", createColoredComponent(notAfter, "expired", myCertificateWrapper.isExpired())); builder.setIndent(0); updateBuilderWithTitle(builder, "Fingerprints"); builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT); builder.addLabeledComponent("SHA-256:", getTextPane(formatHex(myCertificateWrapper.getSha256Fingerprint()))); builder.addLabeledComponent("SHA-1:", getTextPane(formatHex(myCertificateWrapper.getSha1Fingerprint()))); add(builder.getPanel(), BorderLayout.NORTH); }
Example #2
Source File: ReviewBoardSettings.java From reviewboard-plugin-for-idea with MIT License | 6 votes |
public String getRBSession(String server) { JPasswordField pf = new JPasswordField(); pf.grabFocus(); JTextField username = new JTextField(); JPanel panel = FormBuilder.createFormBuilder() .addLabeledComponent("User Name:", username) .addLabeledComponent("Password:", pf) .getPanel(); int okCxl = JOptionPane.showConfirmDialog(null, panel, "Enter Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (okCxl == JOptionPane.OK_OPTION) { String password = new String(pf.getPassword()); try { String cookie = ReviewBoardClient.login(server, username.getText(), password); if (cookie != null) { getSettings().getState().cookie = cookie; return cookie; } } catch (Exception e1) { JOptionPane.showMessageDialog(null, e1.getMessage()); } } return null; }
Example #3
Source File: QuarkusModuleInfoStep.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
@Override public void _init() { ProgressIndicator indicator = new EmptyProgressIndicator() { @Override public void setText(String text) { SwingUtilities.invokeLater(() -> panel.setLoadingText(text)); } }; try { QuarkusModel model = QuarkusModelRegistry.INSTANCE.load(context.getUserData(QuarkusConstants.WIZARD_ENDPOINT_URL_KEY), indicator); context.putUserData(QuarkusConstants.WIZARD_MODEL_KEY, model); final FormBuilder formBuilder = new FormBuilder(); final CollectionComboBoxModel<ToolDelegate> toolModel = new CollectionComboBoxModel<>(Arrays.asList(ToolDelegate.getDelegates())); toolComboBox = new ComboBox<>(toolModel); toolComboBox.setRenderer(new ColoredListCellRenderer<ToolDelegate>() { @Override protected void customizeCellRenderer(@NotNull JList<? extends ToolDelegate> list, ToolDelegate toolDelegate, int index, boolean selected, boolean hasFocus) { this.append(toolDelegate.getDisplay()); } }); formBuilder.addLabeledComponent("Tool:", toolComboBox); groupIdField = new JBTextField("org.acme"); formBuilder.addLabeledComponent("Group:", groupIdField); artifactIdField = new JBTextField("code-with-quarkus"); formBuilder.addLabeledComponent("Artifact:", artifactIdField); versionField = new JBTextField("1.0.0-SNAPSHOT"); formBuilder.addLabeledComponent("Version:", versionField); classNameField = new JBTextField("org.acme.ExampleResource"); formBuilder.addLabeledComponent("Class name:", classNameField); pathField = new JBTextField("/hello"); formBuilder.addLabeledComponent("Path:", pathField); panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North"); } catch (IOException e) { LOGGER.error(e.getLocalizedMessage(), e); throw new RuntimeException(e); } }
Example #4
Source File: LibraryEditorDialogBase.java From consulo with Apache License 2.0 | 5 votes |
@Override protected JComponent createNorthPanel() { String currentName = myLibraryRootsComponent.getLibraryEditor().getName(); myNameField = new JTextField(currentName); myNameField.selectAll(); FormBuilder formBuilder = FormBuilder.createFormBuilder().addLabeledComponent("&Name:", myNameField); addNorthComponents(formBuilder); return formBuilder.addVerticalGap(10).getPanel(); }
Example #5
Source File: CreatePatchConfigurationPanel.java From consulo with Apache License 2.0 | 5 votes |
private void initMainPanel() { myFileNameField = new TextFieldWithBrowseButton(); myBasePathField = new TextFieldWithBrowseButton(); myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox")); myEncoding = new ComboBox<>(); myWarningLabel = new JLabel(); myMainPanel = FormBuilder.createFormBuilder() .addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField) .addLabeledComponent("&Base path:", myBasePathField) .addComponent(myReversePatchCheckbox) .addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding) .addComponent(myWarningLabel) .getPanel(); }
Example #6
Source File: CertificateInfoPanel.java From consulo with Apache License 2.0 | 5 votes |
private static void updateBuilderWithPrincipalData(FormBuilder builder, Map<String, String> fields) { builder = builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT); for (CommonField field : CommonField.values()) { String value = fields.get(field.getShortName()); if (value == null) { continue; } String label = String.format("<html>%s (<b>%s</b>)</html>", field.getShortName(), field.getLongName()); builder = builder.addLabeledComponent(label, new JBLabel(value)); } builder.setIndent(0); }
Example #7
Source File: LocalToServerSettingsEditor.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override protected JComponent createEditor() { return FormBuilder.createFormBuilder() .addLabeledComponent("Deployment:", mySourceComboBox) .addComponent(myDeploymentSettingsComponent) .getPanel(); }
Example #8
Source File: DeployToServerSettingsEditor.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override protected JComponent createEditor() { return FormBuilder.createFormBuilder() .addLabeledComponent("Server:", myServerComboBox) .addLabeledComponent("Deployment:", mySourceComboBox) .addComponent(myDeploymentSettingsComponent) .getPanel(); }
Example #9
Source File: ReviewBoardSettings.java From reviewboard-plugin-for-idea with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { JPanel panel = FormBuilder.createFormBuilder() .addLabeledComponent("Server URL:", serverField) .addLabeledComponent("Action:", actionButton) .getPanel(); switchButton(); return panel; }
Example #10
Source File: AppSettingsComponent.java From intellij-sdk-docs with Apache License 2.0 | 5 votes |
public AppSettingsComponent() { myMainPanel = FormBuilder.createFormBuilder() .addLabeledComponent(new JBLabel("Enter User Name: "), myUserNameText, 1, false) .addComponent(myIdeaUserStatus, 1) .addComponentFillVertically(new JPanel(), 0) .getPanel(); }
Example #11
Source File: GraphQLConfigVariableAwareEndpoint.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Nullable @Override protected JComponent createCenterPanel() { textField = new JBTextField(); textField.setText(previousVariables.getOrDefault(variableName, "")); myPreferredFocusedComponent = textField; JBLabel hint = new JBLabel("<html><b>Hint</b>: Specify environment variables using <code>-DvarName=varValue</code> on the IDE command line.<div style=\"margin-top: 6\">This dialog stores the entered value until the IDE is restarted.</div></html>"); return FormBuilder.createFormBuilder().addLabeledComponent(variableName, textField).addComponent(hint).getPanel(); }
Example #12
Source File: OCamlBinaryRootEditHandler.java From reasonml-idea-plugin with MIT License | 5 votes |
private ResourceRootPropertiesDialog(@NotNull JComponent parentComponent, @NotNull OCamlBinaryRootProperties properties) { super(parentComponent, true); myProperties = properties; setTitle(ProjectBundle.message("module.paths.edit.properties.title")); myRelativeOutputPathField = new JTextField(); myIsGeneratedCheckBox = new JCheckBox(UIUtil.replaceMnemonicAmpersand("For &generated resources")); myMainPanel = FormBuilder.createFormBuilder() .addLabeledComponent("Relative output &path:", myRelativeOutputPathField) .addComponent(myIsGeneratedCheckBox) .getPanel(); myRelativeOutputPathField.setText(myProperties.getRelativeOutputPath()); myRelativeOutputPathField.setColumns(25); myIsGeneratedCheckBox.setSelected(myProperties.isForGeneratedSources()); init(); }
Example #13
Source File: AppSettingsView.java From litho with Apache License 2.0 | 5 votes |
public AppSettingsView() { mainPanel = FormBuilder.createFormBuilder() .addComponent(resolveRedSymbolsStatus, 1) .addComponentFillVertically(new JPanel(), 0) .getPanel(); }
Example #14
Source File: QuarkusCodeEndpointChooserStep.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
public JComponent getComponent() { ButtonGroup group = new ButtonGroup(); group.add(this.defaultRadioButton); group.add(this.customRadioButton); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { QuarkusCodeEndpointChooserStep.this.updateCustomUrl(); } }; this.defaultRadioButton.addActionListener(listener); this.customRadioButton.addActionListener(listener); FormBuilder builder = new FormBuilder(); builder.addComponent(new JBLabel("Choose Quarkus Code endpoint URL.")); BorderLayoutPanel defaultPanel = JBUI.Panels.simplePanel(10, 0); defaultPanel.addToLeft(this.defaultRadioButton); HyperlinkLabel label = new HyperlinkLabel(QUARKUS_CODE_URL); label.setHyperlinkTarget(QUARKUS_CODE_URL); defaultPanel.addToCenter(label); builder.addComponent(defaultPanel); BorderLayoutPanel customPanel = JBUI.Panels.simplePanel(10, 0); customPanel.addToLeft(this.customRadioButton); this.customUrlWithBrowseButton.setButtonIcon(AllIcons.Actions.ShowViewer); customPanel.addToCenter(this.customUrlWithBrowseButton); builder.addComponent(customPanel); builder.addTooltip("Make sure your network connection is active before continuing."); JPanel panel = new JPanel(new BorderLayout()); panel.add(builder.getPanel(), "North"); return panel; }
Example #15
Source File: DebugPortState.java From intellij with Apache License 2.0 | 4 votes |
@Override public JComponent createComponent() { return FormBuilder.createFormBuilder().addLabeledComponent("&Port:", portField).getPanel(); }
Example #16
Source File: ComponentStructureView.java From litho with Apache License 2.0 | 4 votes |
private static JComponent createView(JComponent top, JComponent bottom) { return FormBuilder.createFormBuilder() .addComponent(top, 1) .addComponentFillVertically(bottom, 0) .getPanel(); }
Example #17
Source File: CertificateInfoPanel.java From consulo with Apache License 2.0 | 4 votes |
private static void updateBuilderWithTitle(FormBuilder builder, String title) { builder.addComponent(new TitledSeparator(title), IdeBorderFactory.TITLED_BORDER_TOP_INSET); }
Example #18
Source File: CustomFileTypeEditor.java From consulo with Apache License 2.0 | 4 votes |
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); JPanel fileTypePanel = new JPanel(new BorderLayout()); JPanel info = FormBuilder.createFormBuilder() .addLabeledComponent(IdeBundle.message("editbox.customfiletype.name"), myFileTypeName) .addLabeledComponent(IdeBundle.message("editbox.customfiletype.description"), myFileTypeDescr).getPanel(); info.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); fileTypePanel.add(info, BorderLayout.NORTH); JPanel highlighterPanel = new JPanel(); highlighterPanel.setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("group.customfiletype.syntax.highlighting"), false)); highlighterPanel.setLayout(new BorderLayout()); JPanel commentsAndNumbersPanel = new JPanel(); commentsAndNumbersPanel.setLayout(new GridBagLayout()); JPanel _panel1 = new JPanel(new BorderLayout()); GridBag gb = new GridBag() .setDefaultFill(GridBagConstraints.HORIZONTAL) .setDefaultAnchor(GridBagConstraints.WEST) .setDefaultInsets(1, 5, 1, 5); commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.line.comment")), gb.nextLine().next()); commentsAndNumbersPanel.add(myLineComment, gb.next()); commentsAndNumbersPanel.add(myCommentAtLineStart, gb.next().coverLine(2)); commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.start")), gb.nextLine().next()); commentsAndNumbersPanel.add(myBlockCommentStart, gb.next()); commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.end")), gb.next()); commentsAndNumbersPanel.add(myBlockCommentEnd, gb.next()); commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.hex.prefix")), gb.nextLine().next()); commentsAndNumbersPanel.add(myHexPrefix, gb.next()); commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.number.postfixes")), gb.next()); commentsAndNumbersPanel.add(myNumPostfixes, gb.next()); commentsAndNumbersPanel.add(mySupportBraces, gb.nextLine().next().coverLine(2)); commentsAndNumbersPanel.add(mySupportBrackets, gb.next().next().coverLine(2)); commentsAndNumbersPanel.add(mySupportParens, gb.nextLine().next().coverLine(2)); commentsAndNumbersPanel.add(mySupportEscapes, gb.next().next().coverLine(2)); _panel1.add(commentsAndNumbersPanel, BorderLayout.WEST); highlighterPanel.add(_panel1, BorderLayout.NORTH); TabbedPaneWrapper tabbedPaneWrapper = new TabbedPaneWrapper(this); tabbedPaneWrapper.getComponent().setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("listbox.customfiletype.keywords"), false)); tabbedPaneWrapper.addTab(" 1 ", createKeywordsPanel(0)); tabbedPaneWrapper.addTab(" 2 ", createKeywordsPanel(1)); tabbedPaneWrapper.addTab(" 3 ", createKeywordsPanel(2)); tabbedPaneWrapper.addTab(" 4 ", createKeywordsPanel(3)); highlighterPanel.add(tabbedPaneWrapper.getComponent(), BorderLayout.CENTER); highlighterPanel.add(myIgnoreCase, BorderLayout.SOUTH); fileTypePanel.add(highlighterPanel, BorderLayout.CENTER); panel.add(fileTypePanel); for (int i = 0; i < myKeywordsLists.length; i++) { final int idx = i; new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { edit(idx); return true; } }.installOn(myKeywordsLists[i]); } return panel; }
Example #19
Source File: CreateNewLibraryDialog.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void addNorthComponents(FormBuilder formBuilder) { formBuilder.addLabeledComponent("&Level:", myLibraryLevelCombobox); }
Example #20
Source File: GodClassUserInputDialog.java From IntelliJDeodorant with MIT License | 4 votes |
private void placeControlsOnPanel() { FormBuilder builder = FormBuilder.createFormBuilder().addLabeledComponent(IntelliJDeodorantBundle.message("god.class.preview.new.class.name"), extractedClassNameField, UIUtil.LARGE_VGAP); mainPanel = builder.addVerticalGap(MAIN_PANEL_VERTICAL_GAP).getPanel(); }
Example #21
Source File: LibraryEditorDialogBase.java From consulo with Apache License 2.0 | 4 votes |
protected void addNorthComponents(FormBuilder formBuilder) { }
Example #22
Source File: MoveFilesOrDirectoriesDialog.java From consulo with Apache License 2.0 | 4 votes |
@Override protected JComponent createNorthPanel() { myNameLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true); myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton(); final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS); if (recentEntries != null) { myTargetDirectoryField.getChildComponent().setHistory(recentEntries); } final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.moved.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT); final JTextField textField = myTargetDirectoryField.getChildComponent().getTextEditor(); FileChooserFactory.getInstance().installFileCompletion(textField, descriptor, true, getDisposable()); textField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { validateOKButton(); } }); myTargetDirectoryField.setTextFieldPreferredWidth(CopyFilesOrDirectoriesDialog.MAX_PATH_LENGTH); Disposer.register(getDisposable(), myTargetDirectoryField); String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION)); myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references")); myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE); myOpenInEditorCb = new NonFocusableCheckBox("Open moved files in editor"); myOpenInEditorCb.setSelected(isOpenInEditor()); return FormBuilder.createFormBuilder().addComponent(myNameLabel) .addLabeledComponent(RefactoringBundle.message("move.files.to.directory.label"), myTargetDirectoryField, UIUtil.LARGE_VGAP) .addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText)) .addComponentToRightColumn(myCbSearchForReferences, UIUtil.LARGE_VGAP) .addComponentToRightColumn(myOpenInEditorCb, UIUtil.LARGE_VGAP) .getPanel(); }
Example #23
Source File: CopyFilesOrDirectoriesDialog.java From consulo with Apache License 2.0 | 4 votes |
@Override protected JComponent createNorthPanel() { myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true); final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap( UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP); DocumentListener documentListener = new DocumentAdapter() { @Override public void textChanged(DocumentEvent event) { validateOKButton(); } }; if (myShowNewNameField) { myNewNameField = new JTextField(); myNewNameField.getDocument().addDocumentListener(documentListener); formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField); } if (myShowDirectoryField) { myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton(); myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH); final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS); if (recentEntries != null) { myTargetDirectoryField.getChildComponent().setHistory(recentEntries); } final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.copied.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT); myTargetDirectoryField.getChildComponent().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { validateOKButton(); } }); formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField); String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION)); formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText)); } final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(myOpenFilesInEditor, BorderLayout.EAST); formBuilder.addComponent(wrapper); return formBuilder.getPanel(); }