2
* Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of Substance Kirill Grouchnikov nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
package org.pushingpixels.substance.api;
34
import javax.swing.JCheckBox;
35
import javax.swing.JTabbedPane;
38
* Allows associating different color schemes to different visual parts of UI
39
* components. For example, the {@link JCheckBox} has three different visual
42
* <li>Border - assciated with {@link #BORDER}</li>
43
* <li>Fill - associated with {@link #FILL}</li>
44
* <li>Check mark - associated with {@link #MARK}</li>
47
* Applications can create custom instances of this class to further refine the
48
* control over the painting. In this case, the custom UI delegates must be
49
* created to use these new association kinds.
51
* @author Kirill Grouchnikov
54
public class ColorSchemeAssociationKind {
56
* All known association kind values.
58
private static Set<ColorSchemeAssociationKind> values = new HashSet<ColorSchemeAssociationKind>();
61
* Name for this association kind.
66
* Fallback for this association kind. This is used when no color scheme is
67
* associated with this kind. For example, {@link #TAB_BORDER} specifies
68
* that its fallback is {@link #BORDER}. When the {@link JTabbedPane} UI
69
* delegate is painting the tabs, it will try to use the color scheme
70
* associated with {@link #TAB_BORDER}. If none was registered, it will fall
71
* back to use the color scheme associated with {@link #BORDER}, and if that
72
* is not registered as well, will use the color scheme associated with
75
private ColorSchemeAssociationKind fallback;
78
* Creates a new association kind.
81
* Association kind name.
83
* Fallback association kind. This is used when no color scheme
84
* is associated with this kind. For example, {@link #TAB_BORDER}
85
* specifies that its fallback is {@link #BORDER}. When the
86
* {@link JTabbedPane} UI delegate is painting the tabs, it will
87
* try to use the color scheme associated with
88
* {@link #TAB_BORDER}. If none was registered, it will fall back
89
* to use the color scheme associated with {@link #BORDER}, and
90
* if that is not registered as well, will use the color scheme
91
* associated with {@link #FILL}.
93
public ColorSchemeAssociationKind(String name,
94
ColorSchemeAssociationKind fallback) {
96
this.fallback = fallback;
101
public String toString() {
106
* The default visual area that is used for the inner part of most controls.
108
public static final ColorSchemeAssociationKind FILL = new ColorSchemeAssociationKind(
112
* Visual area of separators.
114
public static final ColorSchemeAssociationKind SEPARATOR = new ColorSchemeAssociationKind(
118
* Fill visual area of the tabs.
120
public static final ColorSchemeAssociationKind TAB = new ColorSchemeAssociationKind(
124
* Border visual area of non-tab controls.
126
public static final ColorSchemeAssociationKind BORDER = new ColorSchemeAssociationKind(
130
* Visual area of marks. Used for painting check marks of checkboxes and
131
* radio buttons, as well as arrow icons of combo boxes, spinners and more.
133
public static final ColorSchemeAssociationKind MARK = new ColorSchemeAssociationKind(
137
* Border visual area of the tabs.
139
public static final ColorSchemeAssociationKind TAB_BORDER = new ColorSchemeAssociationKind(
140
"tabBorder", BORDER);
143
* Highlight visual areas for lists, tables, trees and menus.
145
public static final ColorSchemeAssociationKind HIGHLIGHT = new ColorSchemeAssociationKind(
149
* Highlight visual areas for text components.
151
public static final ColorSchemeAssociationKind TEXT_HIGHLIGHT = new ColorSchemeAssociationKind(
152
"textHighlight", HIGHLIGHT);
155
* Border visual areas for highlighted regions of lists, tables, trees and
158
public static final ColorSchemeAssociationKind HIGHLIGHT_BORDER = new ColorSchemeAssociationKind(
159
"highlightBorder", BORDER);
162
* Visual area of marks in highlighted regions of lists, tables, trees and
165
public static final ColorSchemeAssociationKind HIGHLIGHT_MARK = new ColorSchemeAssociationKind(
166
"highlightMark", MARK);
169
* Returns all available association kinds.
171
* @return All available association kinds.
173
public static Set<ColorSchemeAssociationKind> values() {
174
return Collections.unmodifiableSet(values);
178
* Returns the fallback for this association kind.
180
* @return The fallback for this association kind.
182
public ColorSchemeAssociationKind getFallback() {
b'\\ No newline at end of file'