IDEA-171869 Win10 LaF Table borders fixed and combobox fixed for fractional HiDPI scale factor

This commit is contained in:
Kirill Kirichenko
2017-07-07 18:29:43 +03:00
parent 72868fa5fa
commit d4433bc351
9 changed files with 48 additions and 32 deletions
@@ -26,8 +26,10 @@ import com.intellij.psi.codeStyle.arrangement.match.ArrangementSectionRule;
import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager;
import com.intellij.psi.codeStyle.arrangement.std.StdArrangementRuleAliasToken;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.SideBorder;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ui.GridBag;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -52,6 +54,7 @@ public class ArrangementMatchingRulesPanel extends JPanel implements DataProvide
super(new GridBagLayout());
JBScrollPane scrollPane = new JBScrollPane();
scrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
final JViewport viewport = scrollPane.getViewport();
ArrangementSectionRulesControl.RepresentationCallback callback = new ArrangementSectionRulesControl.RepresentationCallback() {
@Override
@@ -40,10 +40,7 @@ import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.presentation.java.SymbolPresentationUtil;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.ui.DoubleClickListener;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TabbedPaneWrapper;
import com.intellij.ui.TreeSpeedSearch;
import com.intellij.ui.*;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
@@ -188,6 +185,7 @@ public abstract class AbstractTreeClassChooserDialog<T extends PsiNamedElement>
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
scrollPane.setPreferredSize(JBUI.size(500, 300));
scrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT | SideBorder.LEFT | SideBorder.BOTTOM);
myTree.addKeyListener(new KeyAdapter() {
@Override
@@ -20,7 +20,10 @@ import com.intellij.icons.AllIcons;
import com.intellij.ide.util.gotoByName.ChooseByNamePanel;
import com.intellij.ide.util.gotoByName.ChooseByNamePopupComponent;
import com.intellij.ide.util.gotoByName.GotoClassModel2;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
@@ -40,6 +43,7 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SideBorder;
import com.intellij.ui.TabbedPaneWrapper;
import com.intellij.util.ArrayUtil;
import com.intellij.util.PlatformIcons;
@@ -141,6 +145,8 @@ public class DirectoryChooser extends DialogWrapper {
//noinspection HardCodedStringLiteral
int prototypeWidth = component.getFontMetrics(component.getFont()).stringWidth("X:\\1234567890\\1234567890\\com\\company\\system\\subsystem");
jScrollPane.setPreferredSize(new Dimension(Math.max(300, prototypeWidth),300));
jScrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
installEnterAction(component);
panel.add(jScrollPane, BorderLayout.CENTER);
@@ -655,6 +655,7 @@ public abstract class ChooseByNameBase {
myListScrollPane = ScrollPaneFactory.createScrollPane(myList);
myListScrollPane.setViewportBorder(JBUI.Borders.empty());
myListScrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
myTextFieldPanel.setBorder(JBUI.Borders.empty(5));
@@ -44,7 +44,6 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.JTextComponent;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
@@ -1823,11 +1822,15 @@ public class Messages {
}
myField = createTextFieldComponent();
messagePanel.add(myField, BorderLayout.SOUTH);
messagePanel.add(createScrollableTextComponent(), BorderLayout.SOUTH);
return messagePanel;
}
protected JComponent createScrollableTextComponent() {
return myField;
}
protected JComponent createTextComponent() {
JComponent textComponent;
if (BasicHTML.isHTMLString(myMessage)) {
@@ -1880,6 +1883,11 @@ public class Messages {
protected JTextComponent createTextFieldComponent() {
return new JTextArea(7, 50);
}
@Override
protected JComponent createScrollableTextComponent() {
return new JBScrollPane(myField);
}
}
protected static class PasswordInputDialog extends InputDialog {
@@ -1930,7 +1938,7 @@ public class Messages {
}
myField = createTextFieldComponent();
messagePanel.add(myField, BorderLayout.CENTER);
messagePanel.add(createScrollableTextComponent(), BorderLayout.CENTER);
myCheckBox = new JCheckBox();
messagePanel.add(myCheckBox, BorderLayout.SOUTH);
@@ -146,18 +146,14 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
arrowButton.getWidth() - i.right: arrowButton.getWidth() - i.left;
}
int vOffset = JBUI.scale(comboBox.isEditable() ? 0 : 1);
Rectangle rect = (comboBox.getComponentOrientation().isLeftToRight()) ?
new Rectangle(i.left, i.top - JBUI.scale(1),
new Rectangle(i.left, i.top - vOffset,
w - (i.left + i.right + buttonWidth),
h - (i.top + i.bottom)) :
new Rectangle(i.left + buttonWidth, i.top - JBUI.scale(1),
new Rectangle(i.left + buttonWidth, i.top - vOffset,
w - (i.left + i.right + buttonWidth),
h - (i.top + i.bottom));
if (editor instanceof JComponent) {
JBInsets.removeFrom(rect, ((JComponent)editor).getInsets());
}
return rect;
}
@@ -541,7 +537,7 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
}
}
if (editor != null) {
if (comboBox.isEditable() && editor != null) {
Rectangle er = rectangleForCurrentValue();
editor.setBounds(er);
}
@@ -16,6 +16,7 @@
package com.intellij.ide.ui.laf.intellij;
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
import com.intellij.ide.ui.laf.darcula.ui.DarculaEditorTextFieldBorder;
import com.intellij.ide.ui.laf.darcula.ui.DarculaTextFieldUI;
import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.components.panels.Wrapper;
@@ -111,7 +112,8 @@ public class WinIntelliJTextFieldUI extends DarculaTextFieldUI {
@Override public Dimension getPreferredSize(JComponent c) {
Dimension size = super.getPreferredSize(c);
size.height = Math.max(JBUI.scale(24), size.height);
int maxHeight = JBUI.scale(DarculaEditorTextFieldBorder.isComboBoxEditor(c) ? 18 : 24);
size.height = Math.max(maxHeight, size.height);
return size;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.idea.devkit.dom.generator.DomGenPanel">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="443" height="297"/>
@@ -19,11 +19,6 @@
<text value="Namespace:"/>
</properties>
</component>
<vspacer id="e8ccd">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="f5680" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -108,14 +103,6 @@
<text value="Skip schemes:"/>
</properties>
</component>
<component id="f4732" class="javax.swing.JTextArea" binding="mySkipSchemas">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties/>
</component>
<component id="54b59" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -147,6 +134,21 @@
<toolTipText value="Use FQNs in generated code to prevent name conflicts"/>
</properties>
</component>
<scrollpane id="5904e" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="760c3" class="javax.swing.JTextArea" binding="mySkipSchemas">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>
@@ -46,9 +46,9 @@ public class GroovyCodeStyleGenerationConfigurable implements CodeStyleConfigura
public JComponent createComponent() {
JPanel panel = ToolbarDecorator.createDecorator(myMembersOrderList)
.disableAddAction().disableRemoveAction().createPanel();
panel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.order.of.members"), true, new JBInsets(0, 10, 10, 10)));
JPanel wholePanel = new JPanel(new BorderLayout());
wholePanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.order.of.members"), true, new JBInsets(0, 10, 10, 10)));
wholePanel.add(panel, BorderLayout.NORTH);
return wholePanel;
}