Debian Codegraph @

substance-swingx/src/main/java/org/pushingpixels/substance/swingx/SubstanceErrorPaneUI.java

raw symbols SCIP
1 /*
2 * Copyright 2005-2010 Kirill Grouchnikov, based on work by
3 * Sun Microsystems, Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 package org.pushingpixels.substance.swingx;
20
21 import javax.swing.*;
22 import javax.swing.plaf.ComponentUI;
23
24 import org.jdesktop.swingx.JXErrorPane;
25 import org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI;
26 import org.pushingpixels.lafwidget.animation.AnimationConfigurationManager;
27 import org.pushingpixels.lafwidget.animation.AnimationFacet;
28 import org.pushingpixels.substance.internal.animation.IconGlowTracker;
29 import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
30 import org.pushingpixels.substance.internal.utils.icon.GlowingIcon;
31
32 /**
33 * UI delegate for the {@link JXErrorPane} component.
34 *
35 * @author Kirill Grouchnikov
36 */
37 public class SubstanceErrorPaneUI extends BasicErrorPaneUI {
38 protected IconGlowTracker iconGlowTracker;
39
40 static {
41 AnimationConfigurationManager.getInstance().allowAnimations(
42 AnimationFacet.ICON_GLOW, JXErrorPane.class);
43 }
44
45 public static ComponentUI createUI(JComponent comp) {
46 SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
47 return new SubstanceErrorPaneUI();
48 }
49
50 /*
51 * (non-Javadoc)
52 *
53 * @see org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI#installComponents()
54 */
55 @Override
56 protected void installComponents() {
57 super.installComponents();
58
59 this.errorMessage.setBorder(null);
60 this.errorScrollPane.setOpaque(false);
61 this.errorScrollPane.getViewport().setOpaque(false);
62
63 this.iconGlowTracker = new IconGlowTracker(this.iconLabel);
64 }
65
66 /*
67 * (non-Javadoc)
68 *
69 * @see
70 * org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI#getDefaultErrorIcon()
71 */
72 @Override
73 protected Icon getDefaultErrorIcon() {
74 Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon");
75 return new GlowingIcon(errorIcon, this.iconGlowTracker);
76 }
77
78 /*
79 * (non-Javadoc)
80 *
81 * @see
82 * org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI#getDefaultWarningIcon()
83 */
84 @Override
85 protected Icon getDefaultWarningIcon() {
86 Icon errorIcon = UIManager.getIcon("OptionPane.warningIcon");
87 return new GlowingIcon(errorIcon, this.iconGlowTracker);
88 }
89
90 /*
91 * (non-Javadoc)
92 *
93 * @see org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI#reinit()
94 */
95 @Override
96 protected void reinit() {
97 super.reinit();
98
99 if (this.iconLabel.getIcon() != null) {
100 this.iconGlowTracker.play(3);
101 }
102 }
103 }