Search in sources :

Example 1 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class GitlabRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myProjectLabel = new JBLabel("Project:", SwingConstants.RIGHT);
    myProjectComboBox = new ComboBox(300);
    myProjectComboBox.setRenderer(new TaskUiUtil.SimpleComboBoxRenderer("Set server URL and token first"));
    myProjectLabel.setLabelFor(myProjectComboBox);
    return new FormBuilder().addLabeledComponent(myProjectLabel, myProjectComboBox).getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) JBLabel(com.intellij.ui.components.JBLabel) ComboBox(com.intellij.openapi.ui.ComboBox) TaskUiUtil(com.intellij.tasks.impl.TaskUiUtil) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project intellij-community by JetBrains.

the class ExtractClassDialog method createNorthPanel.

protected JComponent createNorthPanel() {
    final JPanel checkboxPanel = new JPanel(new BorderLayout());
    checkboxPanel.add(createInner, BorderLayout.WEST);
    checkboxPanel.add(extractAsEnum, BorderLayout.EAST);
    FormBuilder builder = FormBuilder.createFormBuilder().addComponent(JBLabelDecorator.createJBLabelDecorator(RefactorJBundle.message("extract.class.from.label", sourceClass.getQualifiedName())).setBold(true)).addLabeledComponent(RefactorJBundle.message("name.for.new.class.label"), classNameField, UIUtil.LARGE_VGAP).addLabeledComponent(new JLabel(), checkboxPanel).addLabeledComponent(RefactorJBundle.message("package.for.new.class.label"), packageTextField);
    if (JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject).size() > 1) {
        builder.addLabeledComponent(RefactoringBundle.message("target.destination.folder"), myDestinationFolderComboBox);
    }
    return builder.addVerticalGap(5).getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder)

Example 3 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project Perl5-IDEA by Camelcade.

the class TemplateToolkitSettingsConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    FormBuilder builder = FormBuilder.createFormBuilder();
    builder.getPanel().setLayout(new VerticalFlowLayout());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.opentag"), startTagField = new JTextField());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.closetag"), endTagField = new JTextField());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.outlinetag"), outlineTagField = new JTextField());
    builder.addComponent(enableAnycaseCheckBox = new JCheckBox(PerlBundle.message("ttk2.label.enableanycase")));
    // noinspection Since15
    substitutedExtensionsModel = new CollectionListModel<>();
    substitutedExtensionsList = new JBList<>(substitutedExtensionsModel);
    substitutedExtensionsPanel = PerlConfigurationUtil.createSubstituteExtensionPanel(substitutedExtensionsModel, substitutedExtensionsList);
    builder.addLabeledComponent(new JLabel(PerlBundle.message("ttk2.configuration.extension")), substitutedExtensionsPanel);
    return builder.getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project Perl5-IDEA by Camelcade.

the class AbstractMasonSettingsConfigurable method createGlobalsComponent.

public void createGlobalsComponent(FormBuilder builder) {
    globalsModel = new ListTableModel<>(new myVariableNameColumnInfo(), new myVariableTypeColumnInfo());
    globalsTable = new JBTable(globalsModel);
    builder.addLabeledComponent(new JLabel("Components global variables (allow_globals option):"), ToolbarDecorator.createDecorator(globalsTable).setAddAction(anActionButton -> {
        final TableCellEditor cellEditor = globalsTable.getCellEditor();
        if (cellEditor != null) {
            cellEditor.stopCellEditing();
        }
        final TableModel model = globalsTable.getModel();
        int indexToEdit = -1;
        for (VariableDescription variableDescription : globalsModel.getItems()) {
            if (StringUtil.isEmpty(variableDescription.variableName)) {
                indexToEdit = globalsModel.indexOf(variableDescription);
                break;
            }
        }
        if (indexToEdit == -1) {
            globalsModel.addRow(new VariableDescription());
            indexToEdit = model.getRowCount() - 1;
        }
        TableUtil.editCellAt(globalsTable, indexToEdit, 0);
    }).disableDownAction().disableUpAction().setPreferredSize(JBUI.size(0, PerlConfigurationUtil.WIDGET_HEIGHT)).createPanel());
}
Also used : VariableDescription(com.perl5.lang.mason2.idea.configuration.VariableDescription) PerlLexer(com.perl5.lang.perl.lexer.PerlLexer) StringUtil(com.intellij.openapi.util.text.StringUtil) PerlConfigurationUtil(com.perl5.lang.perl.util.PerlConfigurationUtil) Configurable(com.intellij.openapi.options.Configurable) ColumnInfo(com.intellij.util.ui.ColumnInfo) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) JBTable(com.intellij.ui.table.JBTable) Nullable(org.jetbrains.annotations.Nullable) Nls(org.jetbrains.annotations.Nls) TableCellEditor(javax.swing.table.TableCellEditor) JBUI(com.intellij.util.ui.JBUI) TableUtil(com.intellij.ui.TableUtil) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) ListTableModel(com.intellij.util.ui.ListTableModel) Pattern(java.util.regex.Pattern) FormBuilder(com.intellij.util.ui.FormBuilder) PerlBaseLexer(com.perl5.lang.perl.lexer.PerlBaseLexer) javax.swing(javax.swing) TableModel(javax.swing.table.TableModel) VariableDescription(com.perl5.lang.mason2.idea.configuration.VariableDescription) TableCellEditor(javax.swing.table.TableCellEditor) JBTable(com.intellij.ui.table.JBTable) ListTableModel(com.intellij.util.ui.ListTableModel) TableModel(javax.swing.table.TableModel)

Example 5 with FormBuilder

use of com.intellij.util.ui.FormBuilder in project ballerina by ballerina-lang.

the class BallerinaAutoImportConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    FormBuilder builder = FormBuilder.createFormBuilder();
    myCbShowImportPopup = new JCheckBox(ApplicationBundle.message("checkbox.show.import.popup"));
    myCbAddUnambiguousImports = new JCheckBox(ApplicationBundle.message("checkbox.add.unambiguous.imports.on.the.fly"));
    builder.addComponent(myCbShowImportPopup);
    builder.addComponent(myCbAddUnambiguousImports);
    JPanel result = new JPanel(new BorderLayout());
    result.add(builder.getPanel(), BorderLayout.NORTH);
    if (myIsDialog) {
        result.setPreferredSize(new Dimension(300, -1));
    }
    return result;
}
Also used : JCheckBox(javax.swing.JCheckBox) FormBuilder(com.intellij.util.ui.FormBuilder) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FormBuilder (com.intellij.util.ui.FormBuilder)19 Nullable (org.jetbrains.annotations.Nullable)10 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)4 JBLabel (com.intellij.ui.components.JBLabel)3 JBList (com.intellij.ui.components.JBList)3 NotNull (org.jetbrains.annotations.NotNull)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 Project (com.intellij.openapi.project.Project)2 ComboBox (com.intellij.openapi.ui.ComboBox)2 Messages (com.intellij.openapi.ui.Messages)2 StringUtil (com.intellij.openapi.util.text.StringUtil)2 TableUtil (com.intellij.ui.TableUtil)2 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 JBTextField (com.intellij.ui.components.JBTextField)2 JBTable (com.intellij.ui.table.JBTable)2 ColumnInfo (com.intellij.util.ui.ColumnInfo)2 JBUI (com.intellij.util.ui.JBUI)2 ListTableModel (com.intellij.util.ui.ListTableModel)2 VariableDescription (com.perl5.lang.mason2.idea.configuration.VariableDescription)2