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;
}
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;
}
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;
}
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));
}
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));
}
Aggregations