GTKStyleFactorypublic class GTKStyleFactory extends SynthStyleFactory GTKStyleFactory extends DefaultSynthStyleFactory providing a mapping that
mirrors the gtk name space. Styles registered for REGION are mapped to
the corresponding gtk class name. Similarly styles registered for
CLASS are mapped to the corresponding gtk class name, including the
corresponding gtk class hierarchy. |
Fields Summary |
---|
public static final int | WIDGETIndicates lookup should be done using the name of the Component.
If the name is null this fallsback to the name of the region. | public static final int | WIDGET_CLASSIndicates lookup should be done using the region name. | public static final int | CLASSIndicates lookup should be done using the class name | private static final Map | GTK_CLASS_MAPMaps from a GTK class name to its super class. | private static final Map | REGION_MAPMaps from Region to gtk class. | private List | _widgetStylesList of StyleAssociations for WIDGET. | private List | _widgetClassStylesList of StyleAssociations for WIDGET_CLASS. | private List | _classStylesList of StyleAssociations for CLASS. | private boolean | _isLabelLabels are special cased. This is set to true when a Style for
a label bearing widget is asked for and triggers massaging of
the path and class name lookup. | private BakedArrayList | _labelStyleListWill hold the label style and label bearing components style. This
is used as the key to mergedStyleMap. | private Map | _mergedStyleMapMaps from a List containing the label style and label bearing components
style to the merged style. | private SynthStyle | _defaultStyleAll lookups will at least get this style. | private GTKStyle | _tooltipStyleDefault style for tooltips. | private GTKStyle | _pbStyleDefault style for progressbars. | private GTKStyle | _menuItemStyleDefault style for menu items. | private Map | _resolvedStylesMaps from List to the resolved DefaultSynthStyle. | private BakedArrayList | _tmpListUsed for Style lookup to avoid garbage. | private StringBuffer | _tmpPathStringBuffer used in building paths. | private int[] | _depthUsed in matching class styles, will contain the class depth of the
matches. |
Constructors Summary |
---|
GTKStyleFactory()
this(null);
| GTKStyleFactory(GTKStyle baseStyle)
_tmpList = new BakedArrayList(5);
_resolvedStyles = new HashMap();
_tmpPath = new StringBuffer();
_mergedStyleMap = new HashMap();
_defaultStyle = (baseStyle == null ? new GTKStyle() : baseStyle);
_labelStyleList = new BakedArrayList(2);
|
Methods Summary |
---|
private void | _getPath(java.lang.StringBuffer path, int type, java.awt.Component c, javax.swing.plaf.synth.Region id)
if (c instanceof JComponent) {
boolean isSubregion = (id != null && id.isSubregion());
if (isSubregion) {
_getPath(path, type, c, null);
}
else {
_getPath(path, type, c.getParent(), id);
}
String key = null;
if (type == WIDGET && !isSubregion) {
key = c.getName();
}
if (key == null) {
if (isSubregion) {
key = getName(c, id);
}
else {
Region region = SynthLookAndFeel.getRegion((JComponent)c);
if (region != null) {
key = getName(c, region);
}
}
}
if (path.length() > 0) {
path.append('.");
}
path.append(key);
}
| private javax.swing.plaf.synth.SynthStyle | _getStyle(javax.swing.JComponent c, javax.swing.plaf.synth.Region id)
BakedArrayList matches = _tmpList;
matches.clear();
getMatchingStyles(matches, c, id);
return getStyle(matches);
| public synchronized void | addStyle(sun.swing.plaf.synth.DefaultSynthStyle style, java.lang.String path, int type)
// GTK only supports * and ?, escape everything else.
int length = path.length();
StringBuffer buffer = new StringBuffer(length * 2);
for (int counter = 0; counter < length; counter++) {
char aChar = path.charAt(counter);
if (aChar == '*") {
buffer.append(".*");
}
else if (aChar == '?") {
buffer.append('.");
}
else if (Character.isLetterOrDigit(aChar)) {
buffer.append(aChar);
}
else {
buffer.append('\\");
buffer.append(aChar);
}
}
path = buffer.toString();
switch (type) {
case WIDGET:
if (_widgetStyles == null) {
_widgetStyles = new ArrayList(1);
}
_widgetStyles.add(StyleAssociation.createStyleAssociation(
path, style));
break;
case WIDGET_CLASS:
if (_widgetClassStyles == null) {
_widgetClassStyles = new ArrayList(1);
}
_widgetClassStyles.add(StyleAssociation.createStyleAssociation(
path, style));
break;
case CLASS:
if (_classStyles == null) {
_classStyles = new ArrayList(1);
}
_classStyles.add(StyleAssociation.createStyleAssociation(
path, style));
break;
default:
throw new IllegalArgumentException("type must be one of " +
"CLASS, WIDGET_CLASS or WIDGET");
}
| private void | cacheStyle(java.util.List styles, javax.swing.plaf.synth.SynthStyle style)Caches the specified style.
BakedArrayList cachedStyles = new BakedArrayList(styles);
_resolvedStyles.put(cachedStyles, style);
| private javax.swing.plaf.synth.SynthStyle | getCachedStyle(java.util.List styles)Returns the cached style from the passed in arguments.
if (styles.size() == 0) {
return null;
}
return (SynthStyle)_resolvedStyles.get(styles);
| protected java.lang.Object | getClass(javax.swing.JComponent c, javax.swing.plaf.synth.Region id)Returns a class identifer for c .
if (_isLabel) {
id = Region.LABEL;
}
else if (id == Region.ROOT_PANE) {
Object name = getRootPaneParentType(c);
if (name != null) {
return name;
}
}
String klass = gtkClassFor(id);
if (klass == "GtkLabel") {
if (c.getName() == "TableHeader.renderer") {
return "GtkButton";
}
}
return klass;
| private void | getClassMatches(java.util.List matches, javax.swing.JComponent c, javax.swing.plaf.synth.Region id)
getClassMatches(matches, getClass(c, id));
| private void | getClassMatches(java.util.List matches, java.lang.Object gtkClassName)
if (_depth == null) {
_depth = new int[4];
}
int[] sDepth = _depth;
int matched = 0;
int startMatchLength = matches.size();
for (int counter = _classStyles.size() - 1; counter >= 0; counter--){
StyleAssociation sa = (StyleAssociation)_classStyles.get(counter);
Object klass = gtkClassName;
while (klass != null) {
if (sa.matches(getClassName(klass))) {
int depth = 0;
while ((klass = getSuperclass(klass)) != null) {
depth++;
}
if (matched == 0) {
sDepth[0] = depth;
matches.add(sa.getStyle());
}
else {
int sCounter = 0;
while (sCounter < matched && depth < sDepth[sCounter]){
sCounter++;
}
matches.add(sCounter + startMatchLength,
sa.getStyle());
if (matched + 1 == sDepth.length) {
int[] newDepth = new int[sDepth.length * 2];
System.arraycopy(sDepth, 0, newDepth, 0,
sDepth.length);
_depth = newDepth;
sDepth = newDepth;
}
if (sCounter < matched) {
System.arraycopy(sDepth, 0, sDepth, 0, sCounter);
System.arraycopy(sDepth, sCounter, sDepth,
sCounter + 1, matched - sCounter);
}
sDepth[sCounter] = depth;
}
matched++;
break;
}
klass = getSuperclass(klass);
}
}
| private java.lang.String | getClassName(java.lang.Object klass)Returns the name of a class returned from getClass .
return (String)klass;
| private void | getMatches(java.lang.CharSequence path, java.util.List styles, java.util.List matches, javax.swing.JComponent c, javax.swing.plaf.synth.Region id)
for (int counter = styles.size() - 1; counter >= 0; counter--){
StyleAssociation sa = (StyleAssociation)styles.get(counter);
if (sa.matches(path) && matches.indexOf(sa.getStyle()) == -1) {
matches.add(sa.getStyle());
}
}
| private void | getMatchingStyles(java.util.List matches, javax.swing.JComponent c, javax.swing.plaf.synth.Region id)Fetches any styles that match the passed into arguments into
matches .
// TableHeaderer.renderer is special cased as it descends from
// DefaultTableCellRenderer which does NOT pass along the property
// change that would trigger the style to be refetched.
if (c != null && (c.getParent() != null ||
c.getName() == "TableHeader.renderer" ||
c.getName() == "Slider.label") ||
c.getName() == "ComboBox.list") {
// First match on WIDGET
if (_widgetStyles != null) {
getMatches(getPath(WIDGET, c, id), _widgetStyles, matches, c,
id);
}
// Then match on WIDGET_CLASS
if (_widgetClassStyles != null) {
getMatches(getPath(WIDGET_CLASS, c, id), _widgetClassStyles,
matches, c, id);
}
// Lastly match on CLASS
if (_classStyles != null) {
getClassMatches(matches, c, id);
}
}
if (id == Region.TOOL_TIP) {
matches.add(getToolTipStyle());
}
else if (id == Region.PROGRESS_BAR && GTKLookAndFeel.is2_2()) {
matches.add(getProgressBarStyle());
}
else if ((id == Region.MENU || id == Region.MENU_ITEM ||
id == Region.POPUP_MENU_SEPARATOR ||
id == Region.CHECK_BOX_MENU_ITEM ||
id == Region.RADIO_BUTTON_MENU_ITEM ||
id == Region.MENU_ITEM_ACCELERATOR) &&
GTKLookAndFeel.is2_2()) {
matches.add(getMenuItemStyle());
}
matches.add(_defaultStyle);
| private com.sun.java.swing.plaf.gtk.GTKStyle | getMenuItemStyle()
if (_menuItemStyle == null) {
Color[] moColors = new Color[GTKColorType.MAX_COUNT];
Color[] selectedColors = new Color[GTKColorType.MAX_COUNT];
moColors[GTKColorType.BACKGROUND.getID()] = new ColorUIResource(
0x9db8d2);
moColors[GTKColorType.FOREGROUND.getID()] = GTKStyle.WHITE_COLOR;
moColors[GTKColorType.TEXT_FOREGROUND.getID()] =
new ColorUIResource(0xFFFFFF);
selectedColors[GTKColorType.TEXT_FOREGROUND.getID()] =
new ColorUIResource(0xFFFFFF);
_menuItemStyle = new GTKStyle(new GTKStyle.GTKStateInfo[]
{
new GTKStyle.GTKStateInfo(SynthConstants.MOUSE_OVER,
null, moColors, null),
new GTKStyle.GTKStateInfo(SynthConstants.SELECTED,
null, selectedColors, null),
}, null, null, GTKStyle.UNDEFINED_THICKNESS,
GTKStyle.UNDEFINED_THICKNESS, null);
}
return _menuItemStyle;
| private javax.swing.plaf.synth.SynthStyle | getMergedStyle(javax.swing.JComponent c, javax.swing.plaf.synth.Region id, javax.swing.plaf.synth.SynthStyle style)
SynthStyle labelStyle;
try {
_isLabel = true;
labelStyle = (GTKStyle)_getStyle(c, id);
} finally {
_isLabel = false;
}
_labelStyleList.clear();
_labelStyleList.add(style);
_labelStyleList.add(labelStyle);
_labelStyleList.cacheHashCode();
GTKStyle mergedStyle = (GTKStyle)_mergedStyleMap.get(_labelStyleList);
if (mergedStyle == null) {
mergedStyle = (GTKStyle)((DefaultSynthStyle)style).clone();
mergedStyle.addLabelProperties((GTKStyle)labelStyle);
_mergedStyleMap.put(_labelStyleList, mergedStyle);
_labelStyleList = new BakedArrayList(2);
}
return mergedStyle;
| private java.lang.String | getName(java.awt.Component c, javax.swing.plaf.synth.Region region)Returns the name of the Region.
if (region == Region.ROOT_PANE && c != null) {
String name = getRootPaneParentType(c);
if (name != null) {
return name;
}
}
return gtkClassFor(region);
| private java.lang.CharSequence | getPath(int type, java.awt.Component c, javax.swing.plaf.synth.Region id)Builds the path returning a CharSequence describing the path. A
temporary StringBuffer is provided that should NOT be cached.
_tmpPath.setLength(0);
if (type == WIDGET && id == Region.TOOL_TIP) {
if (c.getName() == null) {
_tmpPath.append("gtk-tooltips");
}
else {
_tmpPath.append(c.getName());
}
}
else {
_getPath(_tmpPath, type, c, id);
}
if (_isLabel) {
if (_tmpPath.length() > 0) {
_tmpPath.append('.");
}
_tmpPath.append(getName(c, Region.LABEL));
}
return _tmpPath;
| private com.sun.java.swing.plaf.gtk.GTKStyle | getProgressBarStyle()
if (_pbStyle == null) {
Color[] moColors = new Color[GTKColorType.MAX_COUNT];
Color[] normalColors = new Color[GTKColorType.MAX_COUNT];
moColors[GTKColorType.BACKGROUND.getID()] = new ColorUIResource(
0x4B6983);
normalColors[GTKColorType.BACKGROUND.getID()] =
new ColorUIResource(0xBAB5AB);
_pbStyle = new GTKStyle(new GTKStyle.GTKStateInfo[]
{ new GTKStyle.GTKStateInfo(SynthConstants.ENABLED,
null, normalColors, null),
new GTKStyle.GTKStateInfo(SynthConstants.MOUSE_OVER,
null, moColors, null)
}, null, null, GTKStyle.UNDEFINED_THICKNESS,
GTKStyle.UNDEFINED_THICKNESS, null);
}
return _pbStyle;
| private java.lang.String | getRootPaneParentType(java.awt.Component c)
Component parent = c.getParent();
if (parent instanceof Frame) {
return "GtkWindow";
}
else if (parent instanceof Dialog) {
return "GtkDialog";
}
else if (parent instanceof Window) {
return "GtkWindow";
}
else if (parent instanceof JInternalFrame) {
return "GtkFrame";
}
return null;
| private javax.swing.plaf.synth.SynthStyle | getStyle(sun.swing.BakedArrayList matches)
// Use a cached Style if possible, otherwise create a new one.
matches.cacheHashCode();
SynthStyle style = getCachedStyle(matches);
if (style == null) {
style = mergeStyles(matches);
if (style != null) {
cacheStyle(matches, style);
}
}
return style;
| synchronized javax.swing.plaf.synth.SynthStyle | getStyle(java.lang.String gtkWidgetClassName)Returns the SynthStyle to use based on the
class name of a GtkWidget. This will throw an
IllegalArgumentException if
gtkWidgetClassName is not a valid Gtk class name.
if (!GTK_CLASS_MAP.containsKey(gtkWidgetClassName)) {
throw new IllegalArgumentException("Invalid class name: " +
gtkWidgetClassName);
}
BakedArrayList matches = _tmpList;
matches.clear();
if (_classStyles != null) {
getClassMatches(matches, gtkWidgetClassName);
}
matches.add(_defaultStyle);
return getStyle(matches);
| public synchronized javax.swing.plaf.synth.SynthStyle | getStyle(javax.swing.JComponent c, javax.swing.plaf.synth.Region id)Returns the style for the specified Component.
if ((id == Region.FORMATTED_TEXT_FIELD &&
c.getName() == "Spinner.formattedTextField") ||
(id == Region.ARROW_BUTTON &&
(c.getName() == "Spinner.previousButton" ||
c.getName() == "Spinner.nextButton"))){
// Force all the widgets of a spinner to be treated like a spinner
id = Region.SPINNER;
Container parent = c.getParent();
if (parent != null) {
parent = parent.getParent();
if (parent instanceof JSpinner) {
c = (JComponent)parent;
}
}
}
else if (id == Region.LABEL && c.getName() == "ComboBox.renderer") {
id = Region.TEXT_FIELD;
}
SynthStyle style = _getStyle(c, id);
if (isLabelBearing(id)) {
style = getMergedStyle(c, id, style);
}
return style;
| private java.lang.Object | getSuperclass(java.lang.Object klass)Returns the super class of a klass as returned from
getClass , or null if klass has no
super classes.
return gtkSuperclass((String)klass);
| private com.sun.java.swing.plaf.gtk.GTKStyle | getToolTipStyle()
if (_tooltipStyle == null) {
Color[] ttColors = new Color[GTKColorType.MAX_COUNT];
if (GTKLookAndFeel.is2_2()) {
ttColors[GTKColorType.BACKGROUND.getID()] =
new ColorUIResource(0xEEE1B3);
ttColors[GTKColorType.FOREGROUND.getID()] =
new ColorUIResource(0x000000);
}
else {
ttColors[GTKColorType.BACKGROUND.getID()] =
new ColorUIResource(0xFFFFC0);
ttColors[GTKColorType.FOREGROUND.getID()] =
new ColorUIResource(0x000000);
}
_tooltipStyle = new GTKStyle(new GTKStyle.GTKStateInfo[] {
new GTKStyle.GTKStateInfo(SynthConstants.ENABLED,
null, ttColors, null)}, null, null,
GTKStyle.UNDEFINED_THICKNESS, GTKStyle.UNDEFINED_THICKNESS,
null);
}
return _tooltipStyle;
| static java.lang.String | gtkClassFor(javax.swing.plaf.synth.Region region)Returns the gtk class that corresponds to the passed in region.
String name = (String)REGION_MAP.get(region);
if (name == null) {
// There are no GTK equivalents for some GTK classes, force
// a match.
return "XXX";
}
return name;
| static java.lang.String | gtkSuperclass(java.lang.String gtkClass)Returns the super class of the passed in gtk class, or null if
gtkClass is the root class.
return (String)GTK_CLASS_MAP.get(gtkClass);
| static final boolean | isLabelBearing(javax.swing.plaf.synth.Region id)In GTK Button and other widgets that display text are actually
implemented as two separate widgets, one for the text and one for
the button, this method returns true if in GTK the Region would
contain a Label to draw the text.
REGION_MAP = new HashMap();
REGION_MAP.put(Region.ARROW_BUTTON, "GtkButton");
REGION_MAP.put(Region.BUTTON, "GtkButton");
REGION_MAP.put(Region.CHECK_BOX, "GtkCheckButton");
REGION_MAP.put(Region.CHECK_BOX_MENU_ITEM, "GtkCheckMenuItem");
REGION_MAP.put(Region.COLOR_CHOOSER, "GtkColorSelectionDialog");
REGION_MAP.put(Region.COMBO_BOX, "GtkCombo");
REGION_MAP.put(Region.DESKTOP_ICON, "GtkLabel");
REGION_MAP.put(Region.DESKTOP_PANE, "GtkContainer");
REGION_MAP.put(Region.EDITOR_PANE, "GtkTextView");
REGION_MAP.put(Region.FORMATTED_TEXT_FIELD, "GtkEntry");
REGION_MAP.put(GTKRegion.HANDLE_BOX, "GtkHandleBox");
REGION_MAP.put(Region.INTERNAL_FRAME, "GtkFrame");
REGION_MAP.put(Region.INTERNAL_FRAME_TITLE_PANE, "GtkLabel");
REGION_MAP.put(Region.LABEL, "GtkLabel");
REGION_MAP.put(Region.LIST, "GtkTreeView");
// GTK doesn't use menu's as swing does, Swing's menus better
// map to a GTKMenuItem.
REGION_MAP.put(Region.MENU, "GtkMenuItem");
REGION_MAP.put(Region.MENU_BAR, "GtkMenuBar");
REGION_MAP.put(Region.MENU_ITEM, "GtkMenuItem");
REGION_MAP.put(Region.MENU_ITEM_ACCELERATOR, "GtkLabel");
REGION_MAP.put(Region.OPTION_PANE, "GtkMessageDialog");
REGION_MAP.put(Region.PANEL, "GtkContainer");
REGION_MAP.put(Region.PASSWORD_FIELD, "GtkEntry");
// GTK does not have a distinct class for popups.
REGION_MAP.put(Region.POPUP_MENU, "GtkMenu");
REGION_MAP.put(Region.POPUP_MENU_SEPARATOR, "GtkSeparatorMenuItem");
REGION_MAP.put(Region.PROGRESS_BAR, "GtkProgressBar");
REGION_MAP.put(Region.RADIO_BUTTON, "GtkRadioButton");
REGION_MAP.put(Region.RADIO_BUTTON_MENU_ITEM, "GtkRadioMenuItem");
REGION_MAP.put(Region.ROOT_PANE, "GtkContainer");
// GTK has two subclasses for the two directions.
REGION_MAP.put(Region.SCROLL_BAR, "GtkScrollbar");
REGION_MAP.put(Region.SCROLL_BAR_TRACK, "GtkScrollbar");
REGION_MAP.put(Region.SCROLL_BAR_THUMB, "GtkScrollbar");
REGION_MAP.put(Region.SCROLL_PANE, "GtkScrolledWindow");
// GTK has two subclasses of GtkSeparator for the two directions
REGION_MAP.put(Region.SEPARATOR, "GtkSeparator");
// GTK has two subclasses of GtkScale for the two directions
REGION_MAP.put(Region.SLIDER, "GtkScale");
REGION_MAP.put(Region.SLIDER_TRACK, "GtkScale");
REGION_MAP.put(Region.SLIDER_THUMB, "GtkScale");
REGION_MAP.put(Region.SPINNER, "GtkSpinButton");
// GTK has two subclasses of GtkPaned for the two diretions.
REGION_MAP.put(Region.SPLIT_PANE, "GtkPaned");
REGION_MAP.put(Region.SPLIT_PANE_DIVIDER, "GtkPaned");
REGION_MAP.put(Region.TABBED_PANE, "GtkNotebook");
REGION_MAP.put(Region.TABBED_PANE_TAB_AREA, "GtkNotebook");
REGION_MAP.put(Region.TABBED_PANE_CONTENT, "GtkNotebook");
REGION_MAP.put(Region.TABBED_PANE_TAB, "GtkNotebook");
REGION_MAP.put(Region.TABLE, "GtkTreeView");
// It would appear the headers are drawn as buttons.
REGION_MAP.put(Region.TABLE_HEADER, "GtkButton");
REGION_MAP.put(Region.TEXT_AREA, "GtkTextView");
REGION_MAP.put(Region.TEXT_FIELD, "GtkEntry");
REGION_MAP.put(Region.TEXT_PANE, "GtkTextView");
REGION_MAP.put(Region.TOGGLE_BUTTON, "GtkToggleButton");
REGION_MAP.put(Region.TOOL_BAR, "GtkToolbar");
REGION_MAP.put(Region.TOOL_BAR_DRAG_WINDOW, "GtkToolbar");
// GTK does not define a distinct class for the toolbar separator
REGION_MAP.put(Region.TOOL_BAR_SEPARATOR, "GtkSeparator");
REGION_MAP.put(Region.TOOL_TIP, "GtkWindow");
REGION_MAP.put(Region.TREE, "GtkTreeView");
REGION_MAP.put(Region.TREE_CELL, "GtkTreeView");
REGION_MAP.put(Region.VIEWPORT, "GtkViewport");
GTK_CLASS_MAP = new HashMap();
GTK_CLASS_MAP.put("GtkHandleBox", "GtkBin");
GTK_CLASS_MAP.put("GtkFrame", "GtkBin");
GTK_CLASS_MAP.put("GtkProgress", "GtkWidget");
GTK_CLASS_MAP.put("GtkViewport", "GtkBin");
GTK_CLASS_MAP.put("GtkMessageDialog", "GtkDialog");
GTK_CLASS_MAP.put("GtkCombo", "GtkHBox");
GTK_CLASS_MAP.put("GtkHBox", "GtkBox");
GTK_CLASS_MAP.put("GtkBox", "GtkContainer");
GTK_CLASS_MAP.put("GtkTooltips", "GtkObject");
GTK_CLASS_MAP.put("GtkToolbar", "GtkContainer");
GTK_CLASS_MAP.put("GtkLabel", "GtkMisc");
GTK_CLASS_MAP.put("GtkMisc", "GtkWidget");
GTK_CLASS_MAP.put("GtkTreeView", "GtkContainer");
GTK_CLASS_MAP.put("GtkTextView", "GtkContainer");
GTK_CLASS_MAP.put("GtkNotebook", "GtkContainer");
GTK_CLASS_MAP.put("GtkSeparatorMenuItem", "GtkMenuItem");
GTK_CLASS_MAP.put("GtkSpinButton", "GtkEntry");
GTK_CLASS_MAP.put("GtkSeparator", "GtkWidget");
GTK_CLASS_MAP.put("GtkScale", "GtkRange");
GTK_CLASS_MAP.put("GtkRange", "GtkWidget");
GTK_CLASS_MAP.put("GtkPaned", "GtkContainer");
GTK_CLASS_MAP.put("GtkScrolledWindow", "GtkBin");
GTK_CLASS_MAP.put("GtkScrollbar", "GtkRange");
GTK_CLASS_MAP.put("GtkProgressBar", "GtkProgress");
GTK_CLASS_MAP.put("GtkRadioButton", "GtkCheckButton");
GTK_CLASS_MAP.put("GtkRadioMenuItem", "GtkCheckMenuItem");
GTK_CLASS_MAP.put("GtkCheckMenuItem", "GtkMenuItem");
GTK_CLASS_MAP.put("GtkMenuItem", "GtkItem");
GTK_CLASS_MAP.put("GtkItem", "GtkBin");
GTK_CLASS_MAP.put("GtkMenu", "GtkMenuShell");
GTK_CLASS_MAP.put("GtkMenuBar", "GtkMenuShell");
GTK_CLASS_MAP.put("GtkMenuShell", "GtkContainer");
GTK_CLASS_MAP.put("GtkEntry", "GtkWidget");
GTK_CLASS_MAP.put("GtkColorSelectionDialog", "GtkDialog");
GTK_CLASS_MAP.put("GtkDialog", "GtkWindow");
GTK_CLASS_MAP.put("GtkWindow", "GtkBin");
GTK_CLASS_MAP.put("GtkCheckButton", "GtkToggleButton");
GTK_CLASS_MAP.put("GtkToggleButton", "GtkButton");
GTK_CLASS_MAP.put("GtkButton", "GtkBin");
GTK_CLASS_MAP.put("GtkBin", "GtkContainer");
GTK_CLASS_MAP.put("GtkContainer", "GtkWidget");
GTK_CLASS_MAP.put("GtkWidget", "GtkObject");
GTK_CLASS_MAP.put("GtkObject", "GObject");
return (id == Region.BUTTON || id == Region.CHECK_BOX ||
id == Region.CHECK_BOX_MENU_ITEM || id == Region.MENU ||
id == Region.MENU_ITEM || id == Region.RADIO_BUTTON ||
id == Region.RADIO_BUTTON_MENU_ITEM ||
id == Region.TABBED_PANE_TAB ||
id == Region.TOGGLE_BUTTON || id == Region.TOOL_TIP);
| private javax.swing.plaf.synth.SynthStyle | mergeStyles(java.util.List styles)Creates a single Style from the passed in styles. The passed in List
is reverse sorted, that is the most recently added style found to
match will be first.
int size = styles.size();
if (size == 0) {
return null;
}
else if (size == 1) {
return (SynthStyle)((DefaultSynthStyle)styles.get(0)).clone();
}
// NOTE: merging is done backwards as DefaultSynthStyleFactory reverses
// order, that is, the most specific style is first.
DefaultSynthStyle style = (DefaultSynthStyle)styles.get(size - 1);
style = (DefaultSynthStyle)style.clone();
for (int counter = size - 2; counter >= 0; counter--) {
style = ((DefaultSynthStyle)styles.get(counter)).addTo(style);
}
return style;
|
|