splash improvements

This commit is contained in:
Konstantin Bulenkov
2012-07-17 14:04:58 +02:00
parent 61767f2349
commit 3c83b00869
4 changed files with 45 additions and 6 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

@@ -3,7 +3,7 @@
<build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
<install-over minbuild="0" maxbuild="0" version="10.5"/>
<logo url="/idea_community_logo.png" textcolor="ffffff" progressColor="b0f58220" progressY="269"/>
<logo url="/idea_community_logo.png" textcolor="ffffff" progressColor="ffaa16" progressY="265" progressTailIcon="/community_progress_tail.png"/>
<about url="/idea_community_about.png"/>
<icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size32opaque="/icon_CEwhite.png" size12="/toolwindows/toolWindowProject.png"/>
<package code="__PACKAGE_CODE__"/>
@@ -30,7 +30,9 @@ import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.*;
@@ -50,6 +52,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
private String myCompanyUrl = "http://www.jetbrains.com/";
private Color myLogoTextColor = new Color(0, 35, 135); // idea blue
private Color myProgressColor = null;
private Icon myProgressTailIcon = null;
private int myProgressY = 350;
private String myAboutLogoUrl = null;
@NonNls private String myIconUrl = "/icon.png";
@@ -98,6 +102,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private static final String ATTRIBUTE_TEXT_COLOR = "textcolor";
@NonNls private static final String ATTRIBUTE_PROGRESS_COLOR = "progressColor";
@NonNls private static final String ATTRIBUTE_PROGRESS_Y = "progressY";
@NonNls private static final String ATTRIBUTE_PROGRESS_TAIL_ICON = "progressTailIcon";
@NonNls private static final String ELEMENT_ABOUT = "about";
@NonNls private static final String ELEMENT_ICON = "icon";
@NonNls private static final String ATTRIBUTE_SIZE32 = "size32";
@@ -211,6 +216,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
return myProgressY;
}
@Nullable
public Icon getProgressTailIcon() {
return myProgressTailIcon;
}
public String getAboutLogoUrl() {
return myAboutLogoUrl;
}
@@ -399,6 +409,12 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
if (v != null) {
myProgressColor = parseColor(v);
}
v = logoElement.getAttributeValue(ATTRIBUTE_PROGRESS_TAIL_ICON);
if (v != null) {
myProgressTailIcon = IconLoader.getIcon(v);
}
v = logoElement.getAttributeValue(ATTRIBUTE_PROGRESS_Y);
if (v != null) {
myProgressY = Integer.parseInt(v);
@@ -37,6 +37,7 @@ import java.util.List;
* <p><code>textColor</code> is HEX representation of text color for user name
* <p><code>progressColor</code> is progress bar color
* <p><code>progressY</code> is Y coordinate of the progress bar
* <p><code>progressTailIcon</code> is a path to flame effect icon
*
* @author Konstantin Bulenkov
*/
@@ -49,6 +50,8 @@ public class Splash extends JDialog implements StartupProgress {
private boolean mySplashIsVisible;
private int myProgressLastPosition = 0;
private final JLabel myLabel;
private Icon myProgressTail;
public Splash(String imageName, final Color textColor) {
@@ -84,6 +87,7 @@ public class Splash extends JDialog implements StartupProgress {
myProgressHeight = 2;
myProgressColor = appInfo.getProgressColor();
myProgressY = appInfo.getProgressY();
myProgressTail = appInfo.getProgressTailIcon();
}
}
@@ -115,14 +119,13 @@ public class Splash extends JDialog implements StartupProgress {
}
final int progressWidth = (int)((myImage.getIconWidth() - 2) * myProgress);
//if (progressWidth > myProgressLastPosition + 1) {
//g.setColor(ColorUtil.withAlpha(color, 0.6));
final int width = progressWidth - myProgressLastPosition;
//g.fillOval(width - 10, getProgressY() - 2, 12, getProgressHeight() + 4);
g.setColor(color);
g.fillRect(myProgressLastPosition + 1, getProgressY(), width, getProgressHeight());
g.fillRect(1, getProgressY(), width, getProgressHeight());
if (myProgressTail != null) {
myProgressTail.paintIcon(this, g, width - (myProgressTail.getIconWidth()/2), getProgressY() - (myProgressTail.getIconHeight() - getProgressHeight())/2);
}
myProgressLastPosition = progressWidth;
//}
}
private int getProgressHeight() {
@@ -184,4 +187,24 @@ public class Splash extends JDialog implements StartupProgress {
return myIcon.getIconHeight();
}
}
//public static void main(String[] args) {
// final ImageIcon icon = new ImageIcon("c:\\IDEA\\ultimate\\ultimate-resources\\src\\progress_tail.png");
//
// final int w = icon.getIconWidth();
// final int h = icon.getIconHeight();
// final BufferedImage image = GraphicsEnvironment.getLocalGraphicsEnvironment()
// .getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(w, h, Color.TRANSLUCENT);
// final Graphics2D g = image.createGraphics();
// icon.paintIcon(null, g, 0, 0);
// g.dispose();
//
// for (int y = 0; y < image.getHeight(); y++) {
// for (int x = 0; x < image.getWidth(); x++) {
// final Color c = new Color(image.getRGB(x, y), true);
// System.out.print(String.format("[%3d,%3d,%3d,%3d] ", c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()));
// }
// System.out.println("");
// }
//}
}