Debian Codegraph @

substance-swingx/src/main/java/org/pushingpixels/substance/swingx/SubstanceTaskPaneContainerUI.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 java.awt.Graphics;
22 import java.awt.Graphics2D;
23
24 import javax.swing.BorderFactory;
25 import javax.swing.JComponent;
26 import javax.swing.plaf.ComponentUI;
27
28 import org.jdesktop.swingx.JXTaskPaneContainer;
29 import org.jdesktop.swingx.VerticalLayout;
30 import org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI;
31 import org.pushingpixels.substance.api.DecorationAreaType;
32 import org.pushingpixels.substance.api.SubstanceLookAndFeel;
33 import org.pushingpixels.substance.internal.painter.DecorationPainterUtils;
34 import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
35
36 /**
37 * Substance-consistent UI delegate for {@link JXTaskPaneContainer}.
38 *
39 * @author Kirill Grouchnikov
40 */
41 public class SubstanceTaskPaneContainerUI extends BasicTaskPaneContainerUI {
42 /**
43 * Background delegate.
44 */
45 private SubstanceSwingxFillBackgroundDelegate bgDelegate;
46
47 public static ComponentUI createUI(JComponent comp) {
48 SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
49 return new SubstanceTaskPaneContainerUI();
50 }
51
52 /**
53 * Creates a new UI delegate.
54 */
55 public SubstanceTaskPaneContainerUI() {
56 super();
57 this.bgDelegate = new SubstanceSwingxFillBackgroundDelegate();
58 }
59
60 /*
61 * (non-Javadoc)
62 *
63 * @see
64 * org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI#installUI(javax
65 * .swing.JComponent)
66 */
67 @Override
68 public void installUI(JComponent c) {
69 super.installUI(c);
70
71 JXTaskPaneContainer taskPane = (JXTaskPaneContainer) c;
72 taskPane.setLayout(new VerticalLayout(14));
73 taskPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
74 // taskPane.putClientProperty(SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY
75 // ,
76 // Boolean.TRUE);
77 // taskPane.setOpaque(false);
78 }
79
80 /*
81 * (non-Javadoc)
82 *
83 * @see
84 * org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI#installDefaults()
85 */
86 @Override
87 protected void installDefaults() {
88 super.installDefaults();
89 this.taskPane.setBackgroundPainter(null);
90 SubstanceLookAndFeel.setDecorationType(this.taskPane,
91 DecorationAreaType.GENERAL);
92 }
93
94 /*
95 * (non-Javadoc)
96 *
97 * @see
98 * org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI#uninstallDefaults
99 * ()
100 */
101 @Override
102 protected void uninstallDefaults() {
103 DecorationPainterUtils.clearDecorationType(this.taskPane);
104 super.uninstallDefaults();
105 }
106
107 /*
108 * (non-Javadoc)
109 *
110 * @see
111 * org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI#paint(java.awt
112 * .Graphics, javax.swing.JComponent)
113 */
114 @Override
115 public void paint(Graphics g, JComponent c) {
116 this.bgDelegate.paint(c, (Graphics2D) g, false);
117 }
118 }