Search in sources :

Example 1 with GridBag

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

the class HgBookmarkDialog method createCenterPanel.

@Override
@NotNull
protected JComponent createCenterPanel() {
    JPanel contentPanel = new JPanel(new GridBagLayout());
    GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
    JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
    myBookmarkName = new JBTextField(13);
    myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent e) {
            validateFields();
        }
    });
    JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
    bookmarkLabel.setLabelFor(myBookmarkName);
    myActiveCheckbox = new JBCheckBox("Inactive", false);
    contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
    contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
    contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
    contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
    return contentPanel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) DocumentAdapter(com.intellij.ui.DocumentAdapter) JBTextField(com.intellij.ui.components.JBTextField) GridBag(com.intellij.util.ui.GridBag) DocumentEvent(javax.swing.event.DocumentEvent) JBCheckBox(com.intellij.ui.components.JBCheckBox) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with GridBag

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

the class GroovyIntroduceVariableDialog method createNamePanel.

private JPanel createNamePanel() {
    final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 1, 1, 1);
    final JPanel namePanel = new JPanel(new GridBagLayout());
    final JLabel typeLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Type:"));
    c.nextLine().next().weightx(0).fillCellNone();
    namePanel.add(typeLabel, c);
    myTypeComboBox = GrTypeComboBox.createTypeComboBoxFromExpression(myExpression, GroovyApplicationSettings.getInstance().INTRODUCE_LOCAL_SELECT_DEF);
    c.next().weightx(1).fillCellHorizontally();
    namePanel.add(myTypeComboBox, c);
    typeLabel.setLabelFor(myTypeComboBox);
    final JLabel nameLabel = new JLabel(UIUtil.replaceMnemonicAmpersand("&Name:"));
    c.nextLine().next().weightx(0).fillCellNone();
    namePanel.add(nameLabel, c);
    myNameField = setUpNameComboBox();
    c.next().weightx(1).fillCellHorizontally();
    namePanel.add(myNameField, c);
    nameLabel.setLabelFor(myNameField);
    GrTypeComboBox.registerUpDownHint(myNameField, myTypeComboBox);
    return namePanel;
}
Also used : GridBag(com.intellij.util.ui.GridBag)

Example 3 with GridBag

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

the class CopyOptionsDialog method createBrowserPartWrapper.

private JPanel createBrowserPartWrapper() {
    final JPanel wrapper = new JPanel(new GridBagLayout());
    final GridBag gridBag = new GridBag().setDefaultAnchor(GridBagConstraints.NORTHWEST).setDefaultFill(GridBagConstraints.NONE).setDefaultInsets(JBUI.insets(1)).setDefaultWeightX(1).setDefaultWeightY(0);
    gridBag.nextLine().next();
    gridBag.weightx(0);
    wrapper.add(new JLabel("Source URL:"), gridBag);
    gridBag.next();
    gridBag.fillCellHorizontally();
    myURLLabel = new JLabel();
    myURLLabel.setFont(myURLLabel.getFont().deriveFont(Font.BOLD));
    wrapper.add(myURLLabel, gridBag);
    gridBag.nextLine().next();
    gridBag.weightx(0);
    gridBag.pady(4);
    wrapper.add(new JLabel("Target Location:"), gridBag);
    gridBag.nextLine().next();
    gridBag.fillCell();
    gridBag.weighty(1);
    gridBag.coverLine(2);
    wrapper.add(myBrowser, gridBag);
    gridBag.nextLine().next();
    gridBag.weightx(0);
    gridBag.pady(4);
    wrapper.add(new JLabel("Target Name:"), gridBag);
    gridBag.next();
    gridBag.fillCellHorizontally();
    myNameField = new JTextField();
    wrapper.add(myNameField, gridBag);
    gridBag.nextLine().next();
    gridBag.weightx(0);
    gridBag.pady(2);
    wrapper.add(new JLabel("Target URL:"), gridBag);
    gridBag.next();
    gridBag.fillCellHorizontally();
    myTargetURL = new JLabel();
    myTargetURL.setFont(myTargetURL.getFont().deriveFont(Font.BOLD));
    wrapper.add(myTargetURL, gridBag);
    return wrapper;
}
Also used : GridBag(com.intellij.util.ui.GridBag)

Example 4 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 5 with GridBag

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

the class GradleEditorComponent method setData.

/**
   * Configures current control to represent given groups (discarding all previously shown information).
   *
   * @param groups  groups to show
   */
public void setData(@NotNull List<GradleEditorEntityGroup> groups) {
    // Most likely use-case is that just table's data should be updated.
    boolean sameTables = groups.size() == myTablesByGroupName.size();
    for (GradleEditorEntityGroup group : groups) {
        GradleEditorEntityTable table = myTablesByGroupName.get(group.getName());
        if (table == null) {
            sameTables = false;
        } else {
            if (table.isEditing()) {
                table.getCellEditor().stopCellEditing();
            }
            table.getModel().setData(group.getEntities());
        }
    }
    if (sameTables) {
        return;
    }
    myCanvas.removeAll();
    Map<String, GradleEditorEntityTable> tablesByGroupName = Maps.newHashMap(myTablesByGroupName);
    myTablesByGroupName.clear();
    Map<String, JBPanel> panelsByGroupName = Maps.newHashMap(myPanelsByGroupName);
    myPanelsByGroupName.clear();
    for (GradleEditorEntityGroup group : groups) {
        JBPanel panel = panelsByGroupName.get(group.getName());
        GradleEditorEntityTable table = tablesByGroupName.get(group.getName());
        if (panel != null && table != null) {
            addUiForGroup(group.getName(), panel, table);
        } else {
            addUiForGroup(group);
        }
    }
    myCanvas.add(new JLabel(" "), new GridBag().weighty(1));
}
Also used : GradleEditorEntityGroup(com.android.tools.idea.gradle.editor.entity.GradleEditorEntityGroup) GridBag(com.intellij.util.ui.GridBag) JBPanel(com.intellij.ui.components.JBPanel)

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