| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public class SubstanceTaskPaneContainerUI extends BasicTaskPaneContainerUI { |
| 42 |
|
| 43 |
|
| 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 |
|
| 54 |
|
| 55 |
public SubstanceTaskPaneContainerUI() { |
| 56 |
super(); |
| 57 |
this.bgDelegate = new SubstanceSwingxFillBackgroundDelegate(); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 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 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 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 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
@Override |
| 102 |
protected void uninstallDefaults() { |
| 103 |
DecorationPainterUtils.clearDecorationType(this.taskPane); |
| 104 |
super.uninstallDefaults(); |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
@Override |
| 115 |
public void paint(Graphics g, JComponent c) { |
| 116 |
this.bgDelegate.paint(c, (Graphics2D) g, false); |
| 117 |
} |
| 118 |
} |