BlueprintStylepublic class BlueprintStyle extends GTKStyle implements GTKConstantsBlueprintStyle extends GTKStyle adding support for a set of Info s. |
Fields Summary |
---|
private static final GTKEngine | BLUEPRINT_ENGINEThere should only ever be one blueprint engine. | private static final BlueprintGraphicsUtils | BLUEPRINT_GRAPHICS | private Info[] | infoSet of Infos used to determine what to paint. | private boolean | iconColorizeComes from the top level icon_colorize setting in rc files. | private String[] | iconAncestorTypesComes from the top level icon_colorize_ancestor_type setting
in rec files. These Strings will all be interned by the parser. | private Color | colorizeColorComes from the top level colorize_color setting in rc files. |
Constructors Summary |
---|
public BlueprintStyle(DefaultSynthStyle style)Creates a duplicate of the passed in style.
super(style);
if (style instanceof BlueprintStyle) {
BlueprintStyle bpStyle = (BlueprintStyle)style;
this.info = bpStyle.info;
this.iconColorize = bpStyle.iconColorize;
this.iconAncestorTypes = bpStyle.iconAncestorTypes;
this.colorizeColor = bpStyle.colorizeColor;
}
| public BlueprintStyle(StateInfo[] states, CircularIdentityList classSpecificValues, Font font, int xThickness, int yThickness, GTKStockIconInfo[] icons, Info[] info, boolean iconColorize, String[] iconAncestorTypes, Color colorizeColor)Creates a BlueprintStyle from the passed in arguments.
super(states, classSpecificValues, font, xThickness, yThickness, icons);
this.info = info;
this.iconColorize = iconColorize;
this.iconAncestorTypes = iconAncestorTypes;
this.colorizeColor = colorizeColor;
|
Methods Summary |
---|
public sun.swing.plaf.synth.DefaultSynthStyle | addTo(sun.swing.plaf.synth.DefaultSynthStyle s)Adds the state of this BlueprintStyle to that of s
returning a combined SynthStyle.
if (!(s instanceof BlueprintStyle)) {
s = new BlueprintStyle(s);
}
BlueprintStyle style = (BlueprintStyle)super.addTo(s);
if (info != null) {
if (style.info == null) {
style.info = info;
}
else {
// Place the more specific first.
Info[] merged = new Info[style.info.length + info.length];
System.arraycopy(info, 0, merged, 0, info.length);
System.arraycopy(style.info, 0, merged, info.length,
style.info.length);
style.info = merged;
}
}
// like the real blueprint, we only overwrite when iconColorize is true
if (iconColorize) {
style.iconColorize = true;
style.colorizeColor = colorizeColor;
}
// like the real blueprint, we always overwrite
style.iconAncestorTypes = iconAncestorTypes;
return style;
| public java.lang.Object | clone()Creates a copy of the reciever and returns it.
BlueprintStyle style = (BlueprintStyle)super.clone();
// These fields are immutable, no need to clone them
style.info = this.info;
style.iconAncestorTypes = this.iconAncestorTypes;
style.colorizeColor = this.colorizeColor;
return style;
| private static java.lang.String | getColorStringWithAlpha(java.awt.Color c)
if (c == null) {
return "null";
}
StringBuffer buf = new StringBuffer();
buf.append('{");
buf.append(c.getRed()).append(", ");
buf.append(c.getGreen()).append(", ");
buf.append(c.getBlue()).append(", ");
buf.append(c.getAlpha()).append("}");
return buf.toString();
| public com.sun.java.swing.plaf.gtk.GTKEngine | getEngine(javax.swing.plaf.synth.SynthContext context)Returns a GTKEngine to use for rendering.
return BLUEPRINT_ENGINE;
| public javax.swing.plaf.synth.SynthGraphicsUtils | getGraphicsUtils(javax.swing.plaf.synth.SynthContext context)
return BLUEPRINT_GRAPHICS;
| public com.sun.java.swing.plaf.gtk.BlueprintStyle$Info | getInfo(java.lang.String function, java.lang.String detail, int componentState, int shadow, int orientation, int gapSide, int arrowDirection, java.lang.String parentType)Returns the first instance of Info that matches the past in args, may
return null if nothing matches.
if (info != null) {
for (int counter = 0, max = info.length; counter < max;counter++) {
if (info[counter].getFunction() == function && info[counter].
getMatchCount(detail, componentState, shadow,
orientation, gapSide, arrowDirection,
parentType) != -1) {
return info[counter];
}
}
}
return null;
| private int | getMaxMatchCount(int componentState, int shadow, int orientation, int gapSide, int arrowDirection, java.lang.String detail)Returns the number of non-null arugments and arguments that are
!= UNDEFINED.
int count = 0;
if (detail != null) {
count++;
}
if (componentState != UNDEFINED) {
count++;
}
if (shadow != UNDEFINED) {
count++;
}
if (orientation != UNDEFINED) {
count++;
}
if (gapSide != UNDEFINED) {
count++;
}
if (arrowDirection != UNDEFINED) {
count++;
}
return count;
| public java.lang.String | toString()
StringBuffer buf = new StringBuffer(super.toString());
if (buf.length() > 0) {
buf.append('\n");
}
buf.append("*** Blueprint Engine Info ***\n");
buf.append("icon_colorize = " + iconColorize + '\n");
buf.append("icon_colorize_ancestor_type = ");
if (iconAncestorTypes == null) {
buf.append("null\n");
} else {
buf.append('{");
for (int i = 0; i < iconAncestorTypes.length; i++) {
buf.append(iconAncestorTypes[i] + ", ");
}
buf.deleteCharAt(buf.length() - 1);
buf.deleteCharAt(buf.length() - 1);
buf.append("}\n");
}
buf.append("colorize_color = ");
buf.append(getColorStringWithAlpha(colorizeColor));
buf.append('\n");
if (info != null) {
for (int i = 0; i < info.length; i++) {
buf.append(info[i].toString()).append('\n");
}
}
// remove last newline
buf.deleteCharAt(buf.length() - 1);
return buf.toString();
|
|