|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jmex.bui.BStyleSheet
public class BStyleSheet
Defines a stylesheet which is used to configure the style (font family, font size, foreground and background color, etc.) of components in the BUI library. The BUI stylesheets syntax is a subset of the Cascading Style Sheet sytnax and follows its semantic conventions as well where possible.
A basic stylesheet enumerating most usable values is as follows:
style_class {* // foreground and background properties
color: 0 0 0;
background: solid #00000088; // note the 50% alpha
background: image monkey.png XX; // XX = centerx|centery|centerxy|
// scalex|scaley|scalexy|
// tilex|tiley|tilexy|
// framex|framey|framexy
background: image monkey.png framexy top right bottom left;
cursor: name;
// text properties
font: Helvetica XX 12; // XX = normal|bold|italic|bolditalic
text-align: XX; // XX = left|center|right
vertical-align: XX; // XX = top|center|bottom
text-effect: XX; // XX = none|outline|shadow|glow
line-spacing: -2; // XX = amount of space to add/remove between lines
// box properties
padding: top; // right=top, bottom=top, left=top
padding: top, right; // bottom=top, left=right
padding: top, right, bottom, left;
border: 1 solid #FFCC99;
border: 1 blank;
size: 250 100; // overrrides component preferred size
// explicit inheritance
parent: other_class; // other_class must be defined *before* this one
tooltip: other_class; // used to define the style class for the tool_tip
}*
Each component is identified by its default stylesheet class, which are derived from the
component's Java class name: window, label, textfield, component, popupmenu, etc.
The component's stylesheet class can be overridden with a call to # setStyleClass .
A component's style is resolved in the following manner:
color, font, text-align, vertical-align.
root stylesheet class is checked (for all properties, not just
those for which we climb the interface hierarchy).
This resolution process is followed at the time the component is added to the interface hierarchy and the result is used to configure the component. We tradeoff the relative expense of doing the lookup every time the component is rendered (every frame) with the memory expense of storing the style of every component in memory.
| Field Summary | |
|---|---|
protected ResourceProvider |
_rsrcprov
|
java.util.HashMap<java.lang.String,Rule> |
_rules
|
static java.lang.String |
BOLD
A font style constant. |
static java.lang.String |
BOLD_ITALIC
A font style constant. |
static java.lang.String |
ITALIC
A font style constant. |
static java.lang.String |
PLAIN
A font style constant. |
| Fields inherited from interface com.jmex.bui.BStyleConstants |
|---|
COLON, DOUBLE_QUOTE, END_BRACE, SEMI_COLON, SINGLE_QUOTE, START_BRACE |
| Constructor Summary | |
|---|---|
BStyleSheet(java.io.Reader reader,
ResourceProvider rsrcprov)
Creates a stylesheet from the specified textual source. |
|
| Method Summary | |
|---|---|
java.lang.Object |
createProperty(java.lang.String name,
java.util.ArrayList args)
|
protected java.lang.Object |
findProperty(BComponent component,
java.lang.String pseudoClass,
java.lang.String property,
boolean climb)
|
BBackground |
getBackground(BComponent component,
java.lang.String pseudoClass)
|
BBorder |
getBorder(BComponent component,
java.lang.String pseudoClass)
|
com.jme.renderer.ColorRGBA |
getColor(BComponent component,
java.lang.String pseudoClass)
|
BCursor |
getCursor(BComponent component,
java.lang.String pseudoClass)
|
com.jme.renderer.ColorRGBA |
getEffectColor(BComponent component,
java.lang.String pseudoClass)
|
int |
getEffectSize(BComponent component,
java.lang.String pseudoClass)
|
BIcon |
getIcon(BComponent component,
java.lang.String pseudoClass)
|
Insets |
getInsets(BComponent component,
java.lang.String pseudoClass)
|
BKeyMap |
getKeyMap(BComponent component,
java.lang.String pseudoClass)
|
int |
getLineSpacing(BComponent component,
java.lang.String pseudoClass)
|
protected java.lang.Object |
getProperty(java.lang.String fqClass,
java.lang.String property)
|
Dimension |
getSize(BComponent component,
java.lang.String pseudoClass)
|
HorizontalAlignment |
getTextAlignment(BComponent component,
java.lang.String pseudoClass)
|
TextEffect |
getTextEffect(BComponent component,
java.lang.String pseudoClass)
|
BTextFactory |
getTextFactory(BComponent component,
java.lang.String pseudoClass)
|
java.lang.String |
getTooltipStyle(BComponent component,
java.lang.String pseudoClass)
|
VerticalAlignment |
getVerticalAlignment(BComponent component,
java.lang.String pseudoClass)
|
protected com.jme.renderer.ColorRGBA |
parseColor(java.lang.String hex)
|
protected int |
parseInt(java.lang.Object arg)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PLAIN
public static final java.lang.String BOLD
public static final java.lang.String ITALIC
public static final java.lang.String BOLD_ITALIC
protected ResourceProvider _rsrcprov
public java.util.HashMap<java.lang.String,Rule> _rules
| Constructor Detail |
|---|
public BStyleSheet(java.io.Reader reader,
ResourceProvider rsrcprov)
reader - Readerrsrcprov - ResourceProvider| Method Detail |
|---|
public com.jme.renderer.ColorRGBA getColor(BComponent component,
java.lang.String pseudoClass)
public BBackground getBackground(BComponent component,
java.lang.String pseudoClass)
public BIcon getIcon(BComponent component,
java.lang.String pseudoClass)
public BCursor getCursor(BComponent component,
java.lang.String pseudoClass)
public BTextFactory getTextFactory(BComponent component,
java.lang.String pseudoClass)
public HorizontalAlignment getTextAlignment(BComponent component,
java.lang.String pseudoClass)
public VerticalAlignment getVerticalAlignment(BComponent component,
java.lang.String pseudoClass)
public TextEffect getTextEffect(BComponent component,
java.lang.String pseudoClass)
public int getLineSpacing(BComponent component,
java.lang.String pseudoClass)
public int getEffectSize(BComponent component,
java.lang.String pseudoClass)
public com.jme.renderer.ColorRGBA getEffectColor(BComponent component,
java.lang.String pseudoClass)
public Insets getInsets(BComponent component,
java.lang.String pseudoClass)
public BBorder getBorder(BComponent component,
java.lang.String pseudoClass)
public Dimension getSize(BComponent component,
java.lang.String pseudoClass)
public java.lang.String getTooltipStyle(BComponent component,
java.lang.String pseudoClass)
public BKeyMap getKeyMap(BComponent component,
java.lang.String pseudoClass)
protected java.lang.Object findProperty(BComponent component,
java.lang.String pseudoClass,
java.lang.String property,
boolean climb)
protected java.lang.Object getProperty(java.lang.String fqClass,
java.lang.String property)
public java.lang.Object createProperty(java.lang.String name,
java.util.ArrayList args)
protected com.jme.renderer.ColorRGBA parseColor(java.lang.String hex)
protected int parseInt(java.lang.Object arg)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||