setting tips to labels

This commit is contained in:
Evgeny Zakrevsky
2011-08-23 18:56:01 +04:00
parent 36db1cd4be
commit 5ff1127c3a
13 changed files with 113 additions and 80 deletions
@@ -163,11 +163,12 @@
</component>
<component id="b0975" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="7" use-parent-layout="false"/>
</constraints>
<properties>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<horizontalAlignment value="4"/>
<style value="SMALL"/>
<text value="For explicitly invoked completion"/>
</properties>
</component>
@@ -87,7 +87,7 @@ public abstract class DialogWrapper {
/**
* The shared instance of default border for dialog's content pane.
*/
public static final Border ourDefaultBorder = BorderFactory.createEmptyBorder(8, 8, 8, 8);
public static final Border ourDefaultBorder = BorderFactory.createEmptyBorder(5, 8, 5, 5);
private float myHorizontalStretch = 1.0f;
private float myVerticalStretch = 1.0f;
@@ -20,15 +20,17 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
public class JBLabel extends JLabel {
private UIUtil.Style myStyle = UIUtil.Style.REGULAR;
private UIUtil.ComponentStyle myComponentStyle = UIUtil.ComponentStyle.REGULAR;
private UIUtil.FontColor myFontColor = UIUtil.FontColor.NORMAL;
public JBLabel() {
}
public JBLabel(@NotNull UIUtil.Style style) {
setStyle(style);
public JBLabel(@NotNull UIUtil.ComponentStyle componentStyle) {
setComponentStyle(componentStyle);
}
public JBLabel(@Nullable Icon image) {
@@ -39,9 +41,9 @@ public class JBLabel extends JLabel {
super(text);
}
public JBLabel(@NotNull String text, @NotNull UIUtil.Style style) {
public JBLabel(@NotNull String text, @NotNull UIUtil.ComponentStyle componentStyle) {
super(text);
setStyle(style);
setComponentStyle(componentStyle);
}
public JBLabel(@NotNull String text, int horizontalAlignment) {
@@ -56,12 +58,26 @@ public class JBLabel extends JLabel {
super(text, icon, horizontalAlignment);
}
public void setStyle(@NotNull UIUtil.Style style) {
myStyle = style;
UIUtil.applyStyle(style, this);
public void setComponentStyle(@NotNull UIUtil.ComponentStyle componentStyle) {
myComponentStyle = componentStyle;
UIUtil.applyStyle(componentStyle, this);
}
public UIUtil.Style getStyle() {
return myStyle;
public UIUtil.ComponentStyle getComponentStyle() {
return myComponentStyle;
}
public UIUtil.FontColor getFontColor() {
return myFontColor;
}
public void setFontColor(@NotNull UIUtil.FontColor fontColor) {
myFontColor = fontColor;
setForeground(null);
}
@Override
public void setForeground(Color fg) {
super.setForeground(UIUtil.getLabelFontColor(myFontColor));
}
}
@@ -83,10 +83,11 @@
</component>
<component id="557df" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<style value="SMALL"/>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<text value="use ; to separate ignored variables"/>
</properties>
</component>
@@ -253,7 +253,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
new AwtVisitor(myContent) {
@Override
public boolean visit(Component component) {
UIUtil.applyStyle(UIUtil.Style.SMALL, component);
UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, component);
return false;
}
};
@@ -69,15 +69,17 @@ public class UIUtil {
private static final String TABLE_DECORATION_KEY = "TABLE_DECORATION_KEY";
private static final Color DECORATED_ROW_BG_COLOR = new Color(242, 245, 249);
public static void applyStyle(@NotNull Style style, @NotNull Component comp) {
public static void applyStyle(@NotNull ComponentStyle componentStyle, @NotNull Component comp) {
if (!(comp instanceof JComponent)) return;
JComponent c = (JComponent)comp;
if (isUnderAquaLookAndFeel()) {
c.putClientProperty("JComponent.sizeVariant", style == Style.REGULAR ? "regular" : style == Style.SMALL ? "small" : "mini");
c.putClientProperty("JComponent.sizeVariant",
componentStyle == ComponentStyle.REGULAR ? "regular" : componentStyle == ComponentStyle.SMALL ? "small" : "mini");
} else {
c.setFont(getFont(style == Style.REGULAR ? FontSize.NORMAL : style == Style.SMALL ? FontSize.SMALL : FontSize.MINI, c.getFont()));
c.setFont(getFont(
componentStyle == ComponentStyle.REGULAR ? FontSize.NORMAL : componentStyle == ComponentStyle.SMALL ? FontSize.SMALL : FontSize.MINI, c.getFont()));
}
Container p = c.getParent();
if (p != null) {
@@ -86,6 +88,9 @@ public class UIUtil {
}
public enum FontSize { NORMAL, SMALL, MINI }
public enum ComponentStyle {REGULAR, SMALL, MINI}
public enum FontColor {NORMAL, BRIGHTER}
public static final char MNEMONIC = 0x1B;
@NonNls public static final String HTML_MIME = "text/html";
@@ -268,21 +273,28 @@ public class UIUtil {
}
@NotNull
public static Font getBorderFont(@NotNull UIUtil.FontSize size, boolean isBold) {
public static Font getBorderFont(@NotNull FontSize size, boolean isBold) {
Font defFont = getBorderFont();
if (size == UIUtil.FontSize.SMALL) {
if (size == FontSize.SMALL) {
defFont = defFont.deriveFont(defFont.getSize() - 2f);
if (isBold) {
defFont = defFont.deriveFont(Font.BOLD);
}
return defFont;
}
if (size == FontSize.MINI) {
defFont = defFont.deriveFont(defFont.getSize() - 4f);
}
if (isBold) {
return defFont.deriveFont(Font.BOLD);
defFont = defFont.deriveFont(Font.BOLD);
}
return defFont;
}
public static Color getLabelFontColor(FontColor fontColor) {
Color defColor = getLabelForeground();
if (fontColor == FontColor.BRIGHTER) {
return new Color(Math.min(defColor.getRed() + 50, 255), Math.min(defColor.getGreen() + 50, 255), Math.min(defColor.getBlue() + 50, 255));
}
return defColor;
}
public static Font getLabelFont() {
return UIManager.getFont("Label.font");
}
@@ -2368,8 +2380,6 @@ public class UIUtil {
return c instanceof JFrame || c instanceof JDialog || c instanceof JWindow || c instanceof JRootPane;
}
public enum Style {REGULAR, SMALL, MINI}
public static Timer createNamedTimer(@NonNls @NotNull final String name, int delay, @NotNull ActionListener listener) {
return new Timer(delay, listener){
@Override
@@ -68,7 +68,7 @@
</component>
<component id="fda57" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" 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>
<labelFor value="90507"/>
@@ -16,7 +16,7 @@
</component>
<component id="22536" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" 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>
<labelFor value="ec837"/>
@@ -13,20 +13,27 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainWithIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/AndroidBundle" title-key="android.layout.preview.edit.configuration.device.panel.title"/>
<children/>
</grid>
<grid id="aef28" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="4" bottom="4" right="4"/>
<margin top="0" left="0" 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>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainWithIndent"/>
<html.disable class="java.lang.Boolean" value="false"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/AndroidBundle" title-key="android.layout.preview.edit.configuration.configuration.title"/>
<children>
<component id="c5f24" 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="0" 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>
<labelFor value="65aa7"/>
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myPane" layout-manager="GridLayoutManager" row-count="6" 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="500" height="162"/>
<xy x="20" y="20" width="500" height="168"/>
</constraints>
<properties/>
<border type="none"/>
@@ -15,16 +15,13 @@
</grid>
</constraints>
<properties/>
<clientProperties>
<caretAspectRatio class="java.lang.Float" value="0.04"/>
</clientProperties>
</component>
<component id="c0234" class="javax.swing.JLabel">
<constraints>
<grid row="1" 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>
<text value="Login"/>
<text value="Login:"/>
</properties>
</component>
<component id="d7c6c" class="javax.swing.JLabel">
@@ -32,7 +29,7 @@
<grid row="2" 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>
<text value="Password"/>
<text value="Password:"/>
</properties>
</component>
<component id="28ddd" class="javax.swing.JTextPane" binding="mySignupTextField">
@@ -49,7 +46,6 @@
</properties>
<clientProperties>
<JEditorPane.honorDisplayProperties class="java.lang.Boolean" value="true"/>
<caretAspectRatio class="java.lang.Float" value="0.04"/>
</clientProperties>
</component>
<component id="9edbd" class="javax.swing.JPasswordField" binding="myPasswordField">
@@ -59,9 +55,6 @@
</grid>
</constraints>
<properties/>
<clientProperties>
<caretAspectRatio class="java.lang.Float" value="0.04"/>
</clientProperties>
</component>
<vspacer id="9b306">
<constraints>
@@ -73,7 +66,7 @@
<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>
<text value="Host"/>
<text value="Host:"/>
</properties>
</component>
<component id="f5630" class="javax.swing.JTextField" binding="myHostTextField">
@@ -83,16 +76,12 @@
</grid>
</constraints>
<properties/>
<clientProperties>
<caretAspectRatio class="java.lang.Float" value="0.04"/>
</clientProperties>
</component>
<component id="f4fda" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<style value="SMALL"/>
<text value="Please ensure you have registered ssh keys for your github account."/>
</properties>
</component>
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myPane" layout-manager="GridLayoutManager" row-count="6" column-count="4" 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="500" height="400"/>
<xy x="20" y="20" width="563" height="400"/>
</constraints>
<properties/>
<border type="none"/>
@@ -21,7 +21,7 @@
<grid row="1" 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>
<text value="Login"/>
<text value="Login:"/>
</properties>
</component>
<component id="d7c6c" class="javax.swing.JLabel">
@@ -29,7 +29,7 @@
<grid row="2" 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>
<text value="Password"/>
<text value="Password:"/>
</properties>
</component>
<component id="28ddd" class="javax.swing.JTextPane" binding="mySignupTextField">
@@ -73,7 +73,7 @@
<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>
<text value="Host"/>
<text value="Host:"/>
</properties>
</component>
<component id="3352a" class="javax.swing.JTextField" binding="myHostTextField">
@@ -89,7 +89,6 @@
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<style value="SMALL"/>
<text value=" Please ensure that you have registered ssh key for your github account."/>
</properties>
</component>
@@ -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.maven.project.MavenEnvironmentForm">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="4" 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="523" height="237"/>
@@ -8,20 +8,9 @@
<properties/>
<border type="none"/>
<children>
<component id="bde1e" class="com.intellij.openapi.ui.LabeledComponent" binding="mavenHomeComponent">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="190" height="16"/>
<text value="Maven &amp;home directory"/>
</properties>
</component>
<component id="7c064" class="com.intellij.openapi.ui.LabeledComponent" binding="settingsFileComponent">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
@@ -32,7 +21,7 @@
</component>
<component id="3d84d" class="javax.swing.JCheckBox" binding="settingsOverrideCheckBox">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Override"/>
@@ -48,12 +37,12 @@
</component>
<vspacer id="9e56d">
<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="fa492" class="com.intellij.openapi.ui.LabeledComponent" binding="localRepositoryComponent">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
@@ -64,23 +53,45 @@
</component>
<component id="d8828" class="javax.swing.JCheckBox" binding="localRepositoryOverrideCheckBox">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Override"/>
</properties>
</component>
<component id="4becc" class="com.intellij.ui.components.JBLabel">
<grid id="d6902" 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="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="1" fill="1" indent="1" use-parent-layout="false"/>
<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"/>
</constraints>
<properties>
<horizontalTextPosition value="10"/>
<style value="SMALL"/>
<text value="M2_HOME is used by default"/>
<verticalTextPosition value="1"/>
</properties>
</component>
<properties/>
<border type="none"/>
<children>
<component id="bde1e" class="com.intellij.openapi.ui.LabeledComponent" binding="mavenHomeComponent">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="190" height="16"/>
<text value="Maven &amp;home directory"/>
</properties>
</component>
<component id="4becc" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="9" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<componentStyle value="SMALL"/>
<fontColor value="BRIGHTER"/>
<horizontalTextPosition value="10"/>
<text value="M2_HOME is used by default"/>
<verticalTextPosition value="1"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="13" column-count="4" 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="550" height="460"/>
<xy x="20" y="20" width="550" height="466"/>
</constraints>
<properties/>
<border type="none"/>
@@ -110,7 +110,6 @@
</constraints>
<properties>
<font/>
<style value="SMALL"/>
<text value="&lt;html&gt;IDEA needs to execute one of the listed phases in order to discover all source folders&lt;br&gt;that are configured via Maven plugins.&lt;br&gt;&lt;b&gt;Note&lt;/b&gt; that all test-* phases firstly generate and compile production sources.&lt;/html&gt;"/>
</properties>
</component>