ui: change south panel layout

* fix case with both "left actions" and "do not ask again" options
* fix case with both "compact" and "do not ask again" options
* better vertical alignment of "do not ask again" checkbox
This commit is contained in:
Aleksey Pivovarov
2016-12-20 13:42:44 +03:00
committed by Aleksey Pivovarov
parent ceaf0d085b
commit 02b2823c22
@@ -568,24 +568,6 @@ public abstract class DialogWrapper {
return false;
}
@NotNull
private static JPanel addDoNotShowCheckBox(@NotNull JComponent southPanel, @NotNull JComponent checkBox, @Nullable JComponent helpButton) {
final JPanel panel = new JPanel(new BorderLayout());
JPanel wrapper = new JPanel(new GridBagLayout());
wrapper.add(checkBox);
panel.add(wrapper, BorderLayout.WEST);
panel.add(southPanel, BorderLayout.EAST);
checkBox.setBorder(JBUI.Borders.emptyRight(20));
if (helpButton != null) {
return JBUI.Panels.simplePanel(panel).addToLeft(helpButton);
}
else {
return panel;
}
}
@NotNull
private List<JButton> createButtons(@NotNull List<Action> actions) {
List<JButton> buttons = new ArrayList<>();
@@ -642,23 +624,31 @@ public abstract class DialogWrapper {
if (hasHelpToMoveToLeftSide) {
if (!(SystemInfo.isWindows && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) && Registry.is("ide.win.frame.decoration"))) {
helpButton = createHelpButton(insets);
panel.add(helpButton, BorderLayout.WEST);
}
}
panel.add(lrButtonsPanel, BorderLayout.CENTER);
if (doNotAsk != null) {
myCheckBoxDoNotShowDialog = new JCheckBox(doNotAsk.getDoNotShowMessage());
myCheckBoxDoNotShowDialog.setVisible(doNotAsk.canBeHidden());
myCheckBoxDoNotShowDialog.setSelected(!doNotAsk.isToBeShown());
DialogUtil.registerMnemonic(myCheckBoxDoNotShowDialog, '&');
}
JComponent doNotAskCheckbox = createDoNotAskCheckbox();
if (doNotAskCheckbox != null) {
panel = addDoNotShowCheckBox(panel, doNotAskCheckbox, helpButton);
if (helpButton != null || doNotAskCheckbox != null) {
JPanel leftPanel = new JPanel(new BorderLayout());
if (helpButton != null) leftPanel.add(helpButton, BorderLayout.WEST);
if (doNotAskCheckbox != null) {
doNotAskCheckbox.setBorder(JBUI.Borders.emptyRight(20));
leftPanel.add(doNotAskCheckbox, BorderLayout.CENTER);
}
panel.add(leftPanel, BorderLayout.WEST);
}
panel.add(lrButtonsPanel, BorderLayout.CENTER);
if (getStyle() == DialogStyle.COMPACT) {
final Color color = UIManager.getColor("DialogWrapper.southPanelDivider");