Tabbed panes. Correct background on Mac.

This commit is contained in:
Evgeny Zakrevsky
2011-09-28 19:52:07 +04:00
parent 58e8fb1258
commit 90ea367605
26 changed files with 113 additions and 36 deletions
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NonNls;
@@ -48,7 +49,7 @@ public class PaletteWindow extends JPanel implements DataProvider {
private final PaletteItemProvider[] myProviders;
private final MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
private final Set<PaletteGroup> myGroups = new HashSet<PaletteGroup>();
private final JTabbedPane myTabbedPane = new JTabbedPane();
private final JTabbedPane myTabbedPane = new JBTabbedPane();
private final JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane();
private final MyListSelectionListener myListSelectionListener = new MyListSelectionListener();
private PaletteGroupHeader myLastFocusedGroup;
@@ -31,6 +31,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.IJSwingUtilities;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -212,7 +213,7 @@ public class JavaDocLocalInspection extends BaseLocalInspectionTool {
super(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0),0,0 );
add(createAdditionalJavadocTagsPanel(), gc);
JTabbedPane tabs = new JTabbedPane(SwingConstants.BOTTOM);
JTabbedPane tabs = new JBTabbedPane(SwingConstants.BOTTOM);
@NonNls String[] tags = new String[]{"@author", "@version", "@since", "@param"};
tabs.add(InspectionsBundle.message("inspection.javadoc.option.tab.title"), createOptionsPanel(new String[]{NONE, PUBLIC, PACKAGE_LOCAL},
tags,
@@ -30,6 +30,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -109,7 +110,7 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
if (myTabs == null) {
myPanel = new JPanel();
myPanel.setLayout(new BorderLayout());
myTabbedPane = new JTabbedPane();
myTabbedPane = new JBTabbedPane();
myTabs = new ArrayList<CodeStyleAbstractPanel>();
myPanel.add(myTabbedPane);
initTabs(getSettings());
@@ -35,6 +35,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -211,7 +212,7 @@ public abstract class MultilanguageCodeStyleAbstractPanel extends CodeStyleAbstr
@Override
protected void installPreviewPanel(final JPanel previewPanel) {
if (getSettingsType() != LanguageCodeStyleSettingsProvider.SettingsType.LANGUAGE_SPECIFIC) {
tabbedPane = new JTabbedPane();
tabbedPane = new JBTabbedPane();
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
Language[] langs = LanguageCodeStyleSettingsProvider.getLanguagesWithSharedPreview();
if (langs.length == 0) return;
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.impl.ConfigurationSettingsEditorWrapper">
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="8" bottom="5" right="5"/>
<margin top="5" left="8" bottom="5" right="0"/>
<constraints>
<xy x="124" y="274" width="276" height="150"/>
</constraints>
@@ -63,7 +63,7 @@
<children/>
</xy>
<grid id="bb10e" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="8" bottom="5" right="5"/>
<margin top="5" left="8" bottom="5" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
@@ -16,6 +16,7 @@
package com.intellij.openapi.options;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.components.JBTabbedPane;
import javax.swing.*;
import java.awt.*;
@@ -52,7 +53,7 @@ public class GroupSettingsBuilder<T> implements CompositeSettingsBuilder<T> {
if (editors.size() == 0) return new JPanel();
if (editors.size() == 1) return editors.get(0).getSecond().getComponent();
JTabbedPane tabs = new JTabbedPane();
JTabbedPane tabs = new JBTabbedPane();
for (int i = 0; i < editors.size(); i++) {
Pair<String, SettingsEditor<T>> pair = editors.get(i);
JPanel panel = new JPanel(new BorderLayout());
@@ -0,0 +1,48 @@
package com.intellij.ui.components;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.util.Arrays;
/**
* @author evgeny.zakrevsky
*/
public class JBTabbedPane extends JTabbedPane implements HierarchyListener {
public JBTabbedPane() {
}
public JBTabbedPane(int tabPlacement) {
super(tabPlacement);
}
public JBTabbedPane(int tabPlacement, int tabLayoutPolicy) {
super(tabPlacement, tabLayoutPolicy);
}
@Override
public void setComponentAt(int index, Component component) {
super.setComponentAt(index, component);
component.addHierarchyListener(this);
UIUtil.setNotOpaqueRecursively(component);
}
@Override
public void insertTab(String title, Icon icon, Component component, String tip, int index) {
super.insertTab(title, icon, component, tip, index);
component.addHierarchyListener(this);
UIUtil.setNotOpaqueRecursively(component);
}
@Override
public void hierarchyChanged(HierarchyEvent e) {
UIUtil.setNotOpaqueRecursively(e.getComponent());
}
}
@@ -16,6 +16,7 @@
package com.intellij.ide.dnd;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.ui.treeStructure.Tree;
import org.jetbrains.annotations.Nullable;
@@ -58,7 +59,7 @@ public class DnDDemo implements DnDEvent.DropTargetHighlightingType {
}, source);
JTabbedPane tabs = new JTabbedPane();
JTabbedPane tabs = new JBTabbedPane();
JPanel delegates = new JPanel(new FlowLayout());
final JLabel delegate1Label = new JLabel("Delegate 1");
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
@@ -33,7 +34,7 @@ import java.awt.event.MouseEvent;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class TabbedPaneImpl extends JTabbedPane implements TabbedPane {
public class TabbedPaneImpl extends JBTabbedPane implements TabbedPane {
private static final Logger LOG = Logger.getInstance("#com.intellij.ui.TabbedPaneImpl");
@@ -2458,5 +2458,22 @@ public class UIUtil {
}
}
}
public static void setNotOpaqueRecursively(Component component) {
if (component == null) return;
if (!isUnderAquaLookAndFeel()) return;
if (component.getBackground().equals(getPanelBackground()) || component instanceof JScrollPane || component instanceof JViewport) {
if (component instanceof JComponent) {
((JComponent)component).setOpaque(false);
}
if (component instanceof Container) {
for (Component c : ((Container)component).getComponents()) {
setNotOpaqueRecursively(c);
}
}
}
}
}
@@ -27,6 +27,7 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vcs.versionBrowser.DateFilterComponent;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.AsynchConsumer;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
@@ -127,7 +128,7 @@ public class CompositeCommittedChangesProvider implements CommittedChangesProvid
VcsCommittedViewAuxiliary auxiliary = provider.createActions(manager, location);
if (auxiliary != null) {
if (tabbedPane == null) {
tabbedPane = new JTabbedPane();
tabbedPane = new JBTabbedPane();
actions = new ArrayList<AnAction>();
toolbarActions = new ArrayList<AnAction>();
}
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.ui.OptionsDialog;
import javax.swing.*;
@@ -46,7 +47,7 @@ public abstract class UpdateOrStatusOptionsDialog extends OptionsDialog {
myMainPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
}
else {
myMainPanel = new JTabbedPane();
myMainPanel = new JBTabbedPane();
final ArrayList<AbstractVcs> vcses = new ArrayList<AbstractVcs>(confs.values());
Collections.sort(vcses, new Comparator<AbstractVcs>() {
public int compare(final AbstractVcs o1, final AbstractVcs o2) {
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.containers.ContainerUtil;
import org.intellij.plugins.intelliLang.inject.LanguageInjectionSupport;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +45,7 @@ class SettingsUI {
SettingsUI(@NotNull final Project project, Configuration configuration) {
myTabbedPane = new JTabbedPane(JTabbedPane.TOP);
myTabbedPane = new JBTabbedPane(JTabbedPane.TOP);
myRoot.add(myTabbedPane);
final ArrayList<Configurable> configurables = new ArrayList<Configurable>();
@@ -35,7 +35,7 @@
<text resource-bundle="messages/AndroidBundle" key="android.facet.editor.is.library.checkbox"/>
</properties>
</component>
<tabbedpane id="bec33">
<tabbedpane id="bec33" class="com.intellij.ui.components.JBTabbedPane">
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="200" height="200"/>
@@ -15,7 +15,7 @@
</grid>
</constraints>
</vspacer>
<tabbedpane id="f3a" binding="myTabbedPane">
<tabbedpane id="f3a" class="com.intellij.ui.components.JBTabbedPane">
<constraints>
<grid row="0" column="0" 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="200" height="200"/>
@@ -24,7 +24,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="37ff8" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="37ff8" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="7" left="7" bottom="7" right="7"/>
<constraints>
<tabbedpane title-resource-bundle="messages/AndroidBundle" title-key="android.run.configuration.general.tab.title"/>
@@ -43,7 +43,7 @@
</component>
<vspacer id="ff5d5">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="3" 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="a005a" class="javax.swing.JComboBox" binding="myModulesComboBox">
@@ -68,7 +68,7 @@
<grid id="e9e4a" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="2" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -82,7 +82,7 @@
</properties>
</component>
<grid id="4d07" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="28" bottom="0" right="0"/>
<margin top="0" left="26" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
@@ -57,7 +57,6 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
private JComboBox myNetworkLatencyCombo;
private JCheckBox myDisableBootAnimationCombo;
private JCheckBox myClearLogCheckBox;
private JTabbedPane myTabbedPane;
private JBLabel myModuleJBLabel;
private ComboboxWithBrowseButton myAvdBox;
private RawCommandLineEditor myCommandLineField;
@@ -17,6 +17,7 @@ package org.jetbrains.idea.maven.execution;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -41,7 +42,7 @@ public class CompositeConfigurable implements Configurable {
}
public JComponent createComponent() {
tabbedPane = new JTabbedPane();
tabbedPane = new JBTabbedPane();
for (Configurable configurable : configurables) {
JComponent component = configurable.createComponent();
component.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
@@ -37,7 +37,7 @@
<properties/>
<border type="none"/>
<children>
<tabbedpane id="b70bc" default-binding="true">
<tabbedpane id="b70bc" class="com.intellij.ui.components.JBTabbedPane" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="200" height="200"/>
@@ -93,13 +93,13 @@
<border type="none"/>
<children/>
</grid>
<component id="a371c" class="javax.swing.JLabel">
<component id="9988" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font size="10"/>
<foreground color="-10066330"/>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<text resource-bundle="com/intellij/spellchecker/util/SpellCheckerBundle" key="dictionaries.panel.description"/>
</properties>
</component>
@@ -125,13 +125,13 @@
<border type="none"/>
<children/>
</grid>
<component id="be7e9" class="javax.swing.JLabel">
<component id="114cf" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font size="10"/>
<foreground color="-10066330"/>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<text resource-bundle="com/intellij/spellchecker/util/SpellCheckerBundle" key="add.directory.description"/>
</properties>
</component>
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Ref;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnServerFileManager;
@@ -172,7 +173,7 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati
}
protected JComponent createCenterPanel() {
myTabbedPane = new JTabbedPane();
myTabbedPane = new JBTabbedPane();
myTabbedPane.add(myUserTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.user.file.title"));
myTabbedPane.add(mySystemTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.system.file.title"));
myPanel.add(myTabbedPane, BorderLayout.NORTH);
@@ -144,7 +144,7 @@
</component>
</children>
</grid>
<tabbedpane id="7ce0a" default-binding="true">
<tabbedpane id="7ce0a" class="com.intellij.ui.components.JBTabbedPane" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="200" height="200"/>
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<tabbedpane id="d5ff" binding="myTabbedPane">
<tabbedpane id="d5ff" class="com.intellij.ui.components.JBTabbedPane" binding="myTabbedPane">
<constraints>
<grid row="0" column="0" 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="200" height="200"/>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="BindingTest">
<tabbedpane id="2bb0a" binding="myRootComponent">
<tabbedpane id="2bb0a" class="com.intellij.ui.components.JBTabbedPane" binding="myRootComponent">
<constraints>
<xy x="159" y="99" width="200" height="200"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
@@ -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.intellij.lang.xpath.xslt.run.XsltRunSettingsEditor.Editor">
<tabbedpane id="fb52f" binding="myComponent">
<tabbedpane id="fb52f" class="com.intellij.ui.components.JBTabbedPane" binding="myComponent">
<constraints>
<xy x="115" y="24" width="580" height="497"/>
</constraints>
@@ -11,7 +11,7 @@
</properties>
<border type="none" title-justification="2" title-position="1"/>
<children>
<tabbedpane id="7b4c" binding="viewFileTab">
<tabbedpane id="7b4c" class="com.intellij.ui.components.JBTabbedPane" binding="viewFileTab">
<constraints>
<grid row="0" column="0" 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="200" height="200"/>
@@ -18,6 +18,7 @@ package org.intellij.plugins.relaxNG.convert;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -53,7 +54,7 @@ public class AdvancedOptionsDialog extends DialogWrapper {
protected JComponent createCenterPanel() {
JComponent root;
if (myInputOptions != null && myOutputOptions != null) {
root = new JTabbedPane();
root = new JBTabbedPane();
((JTabbedPane)root).addTab("Input", myInputOptions.getRoot());
((JTabbedPane)root).addTab("Output", myOutputOptions.getRoot());
} else if (myInputOptions != null) {