Search in sources :

Example 6 with GridBag

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

the class ConsoleConfigurable method createComponent.

@Override
public JComponent createComponent() {
    if (myMainComponent == null) {
        myMainComponent = new JPanel(new BorderLayout());
        myCbUseSoftWrapsAtConsole = new JCheckBox(ApplicationBundle.message("checkbox.use.soft.wraps.at.console"), false);
        myCommandsHistoryLimitField = new JTextField(3);
        myCbOverrideConsoleCycleBufferSize = new JCheckBox(ApplicationBundle.message("checkbox.override.console.cycle.buffer.size", String.valueOf(ConsoleBuffer.getLegacyCycleBufferSize() / 1024)), false);
        myCbOverrideConsoleCycleBufferSize.addChangeListener(e -> myConsoleCycleBufferSizeField.setEnabled(myCbOverrideConsoleCycleBufferSize.isSelected()));
        myConsoleCycleBufferSizeField = new JTextField(3);
        JPanel northPanel = new JPanel(new GridBagLayout());
        GridBag gridBag = new GridBag();
        gridBag.anchor(GridBagConstraints.WEST).setDefaultAnchor(GridBagConstraints.WEST);
        northPanel.add(myCbUseSoftWrapsAtConsole, gridBag.nextLine().next());
        northPanel.add(Box.createHorizontalGlue(), gridBag.next().coverLine());
        northPanel.add(new JLabel(ApplicationBundle.message("editbox.console.history.limit")), gridBag.nextLine().next());
        northPanel.add(myCommandsHistoryLimitField, gridBag.next());
        if (ConsoleBuffer.useCycleBuffer()) {
            northPanel.add(myCbOverrideConsoleCycleBufferSize, gridBag.nextLine().next());
            northPanel.add(myConsoleCycleBufferSizeField, gridBag.next());
            northPanel.add(new JLabel(" KB"), gridBag.next());
        }
        if (!editFoldingsOnly()) {
            JPanel wrapper = new JPanel(new BorderLayout());
            wrapper.add(northPanel, BorderLayout.WEST);
            myMainComponent.add(wrapper, BorderLayout.NORTH);
        }
        Splitter splitter = new Splitter(true);
        myMainComponent.add(splitter, BorderLayout.CENTER);
        myPositivePanel = new MyAddDeleteListPanel("Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:");
        myNegativePanel = new MyAddDeleteListPanel("Exceptions", "Enter a substring of a console line you don't want to fold:");
        splitter.setFirstComponent(myPositivePanel);
        splitter.setSecondComponent(myNegativePanel);
        myPositivePanel.getEmptyText().setText("Fold nothing");
        myNegativePanel.getEmptyText().setText("No exceptions");
    }
    return myMainComponent;
}
Also used : Splitter(com.intellij.openapi.ui.Splitter) GridBag(com.intellij.util.ui.GridBag)

Example 7 with GridBag

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

the class ArrangementMatchingRuleEditor method addRowIfNecessary.

@NotNull
private MultiRowFlowPanel addRowIfNecessary(@NotNull MultiRowFlowPanel panel) {
    if (panel.getComponentCount() <= 0) {
        return panel;
    }
    add(panel, new GridBag().anchor(GridBagConstraints.WEST).weightx(1).fillCellHorizontally().coverLine());
    myRows.add(panel);
    return new MultiRowFlowPanel(FlowLayout.LEFT, ArrangementConstants.HORIZONTAL_GAP, ArrangementConstants.VERTICAL_GAP);
}
Also used : MultiRowFlowPanel(com.intellij.util.ui.MultiRowFlowPanel) GridBag(com.intellij.util.ui.GridBag) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with GridBag

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

the class ArrangementGroupingComponent method init.

private void init() {
    setLayout(new GridBagLayout());
    add(myRowIndexControl, new GridBag().anchor(GridBagConstraints.CENTER).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, ArrangementConstants.HORIZONTAL_GAP * 2));
    add(myGroupingTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST).insets(0, 0, 0, 2));
    if (myOrderTypeToken != null) {
        add(myOrderTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST));
    }
    add(new JLabel(" "), new GridBag().weightx(1).fillCellHorizontally());
    setBackground(UIUtil.getListBackground());
    setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
    setOpaque(!UIUtil.isUnderIntelliJLaF() && !UIUtil.isUnderNativeMacLookAndFeel() && !UIUtil.isUnderDarcula());
}
Also used : GridBag(com.intellij.util.ui.GridBag)

Example 9 with GridBag

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

the class ExternalSystemTaskSettingsControl method fillUi.

@Override
public void fillUi(@NotNull final PaintAwarePanel canvas, int indentLevel) {
    myProjectPathLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.project", myExternalSystemId.getReadableName()));
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
    FileChooserDescriptor projectPathChooserDescriptor = null;
    if (manager instanceof ExternalSystemUiAware) {
        projectPathChooserDescriptor = ((ExternalSystemUiAware) manager).getExternalProjectConfigDescriptor();
    }
    if (projectPathChooserDescriptor == null) {
        projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
    }
    String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName());
    myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) {

        @Override
        public Dimension getPreferredSize() {
            return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize();
        }
    };
    canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0));
    myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks"));
    myTasksTextField = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
    canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0);
    c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8;
    canvas.add(myTasksTextField, c);
    new TaskCompletionProvider(myProject, myExternalSystemId, myProjectPathField).apply(myTasksTextField);
    myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
    myVmOptionsEditor = new RawCommandLineEditor();
    myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
    canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
    myArgumentsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
    myArgumentsEditor = new RawCommandLineEditor();
    myArgumentsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
    canvas.add(myArgumentsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myArgumentsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
}
Also used : ExternalProjectPathField(com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField) JBLabel(com.intellij.ui.components.JBLabel) EditorTextField(com.intellij.ui.EditorTextField) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor) GridBag(com.intellij.util.ui.GridBag) ExternalSystemUiAware(com.intellij.openapi.externalSystem.ExternalSystemUiAware)

Example 10 with GridBag

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

the class GithubRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myHostLabel = new JBLabel("Host:", SwingConstants.RIGHT);
    JPanel myHostPanel = new JPanel(new BorderLayout(5, 0));
    myHostPanel.add(myURLText, BorderLayout.CENTER);
    myHostPanel.add(myShareUrlCheckBox, BorderLayout.EAST);
    myRepositoryLabel = new JBLabel("Repository:", SwingConstants.RIGHT);
    myRepoAuthor = new MyTextField("Repository Owner");
    myRepoName = new MyTextField("Repository Name");
    myRepoAuthor.setPreferredSize("SomelongNickname");
    myRepoName.setPreferredSize("SomelongReponame-with-suffixes");
    JPanel myRepoPanel = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag().setDefaultWeightX(1).setDefaultFill(GridBagConstraints.HORIZONTAL);
    myRepoPanel.add(myRepoAuthor, bag.nextLine().next());
    myRepoPanel.add(new JLabel("/"), bag.next().fillCellNone().insets(0, 5, 0, 5).weightx(0));
    myRepoPanel.add(myRepoName, bag.next());
    myTokenLabel = new JBLabel("API Token:", SwingConstants.RIGHT);
    myToken = new MyTextField("OAuth2 token");
    myTokenButton = new JButton("Create API token");
    myTokenButton.addActionListener(e -> {
        generateToken();
        doApply();
    });
    JPanel myTokenPanel = new JPanel();
    myTokenPanel.setLayout(new BorderLayout(5, 5));
    myTokenPanel.add(myToken, BorderLayout.CENTER);
    myTokenPanel.add(myTokenButton, BorderLayout.EAST);
    myShowNotAssignedIssues = new JBCheckBox("Include issues not assigned to me");
    installListener(myRepoAuthor);
    installListener(myRepoName);
    installListener(myToken);
    installListener(myShowNotAssignedIssues);
    return FormBuilder.createFormBuilder().setAlignLabelOnRight(true).addLabeledComponent(myHostLabel, myHostPanel).addLabeledComponent(myRepositoryLabel, myRepoPanel).addLabeledComponent(myTokenLabel, myTokenPanel).addComponentToRightColumn(myShowNotAssignedIssues).getPanel();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) GridBag(com.intellij.util.ui.GridBag) JBCheckBox(com.intellij.ui.components.JBCheckBox) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

GridBag (com.intellij.util.ui.GridBag)22 JBLabel (com.intellij.ui.components.JBLabel)7 JBCheckBox (com.intellij.ui.components.JBCheckBox)4 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)3 MultiRowFlowPanel (com.intellij.util.ui.MultiRowFlowPanel)2 GradleEditorEntityGroup (com.android.tools.idea.gradle.editor.entity.GradleEditorEntityGroup)1 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)1 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)1 ExternalSystemUiAware (com.intellij.openapi.externalSystem.ExternalSystemUiAware)1 ExternalProjectPathField (com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 Splitter (com.intellij.openapi.ui.Splitter)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 EditorTextField (com.intellij.ui.EditorTextField)1 RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)1 JBPanel (com.intellij.ui.components.JBPanel)1 JBRadioButton (com.intellij.ui.components.JBRadioButton)1 JBTextField (com.intellij.ui.components.JBTextField)1 CheckBox (com.intellij.util.ui.CheckBox)1