use of limelight.styles.RichStyle in project limelight by slagyr.
the class StyledTextTest method shouldBuildFont.
@Test
public void shouldBuildFont() throws Exception {
styledText = new StyledText("Blah");
styledText.setupStyles(new HashMap<String, RichStyle>(), new RichStyle(), new MockStyleObserver());
styledText.getStyle().setFontFace("Courier");
styledText.getStyle().setFontStyle("plain");
styledText.getStyle().setFontSize(12);
Font font = styledText.getFont();
assertEquals("Courier", font.getName());
assertEquals(12, font.getSize());
assertEquals(true, font.isPlain());
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class StyledTextTest method shouldNotBuildStylesMoreThanOnce.
@Test
public void shouldNotBuildStylesMoreThanOnce() throws Exception {
makeSampleStyles();
StyleObserver observer = new MockStyleObserver();
styledText = new StyledText("Some Text", "fizz", "bang");
styledText.setupStyles(styles, defaultStyle, observer);
styledText.setupStyles(styles, defaultStyle, observer);
RichStyle style = styledText.getStyle();
assertEquals(3, style.getExtentions().size());
assertEquals(1, style.getObservers().size());
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class StyledTextTest method shouldTeardownStyles.
@Test
public void shouldTeardownStyles() throws Exception {
makeSampleStyles();
styledText = new StyledText("Some Text", "fizz", "bang");
styledText.setupStyles(styles, defaultStyle, new MockStyleObserver());
styledText.teardownStyles();
RichStyle style = styledText.getStyle();
assertEquals(false, style1.hasObserver(style));
assertEquals(false, style2.hasObserver(style));
assertEquals(false, defaultStyle.hasObserver(style));
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class BuiltInStyles method buildDropDownPopupListItemHover.
private static RichStyle buildDropDownPopupListItemHover() {
RichStyle style = new RichStyle();
style.setTextColor("white");
style.setBackgroundColor("#bbd453");
style.setSecondaryBackgroundColor("#9fb454");
style.setGradientAngle(270);
style.setGradient("on");
return style;
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class TextPanel method buildLines.
public synchronized void buildLines() {
consumableArea = panel.getChildConsumableBounds();
lines = new LinkedList<TextLayout>();
if (text != null && text.length() > 0) {
StyledTextParser parser = new StyledTextParser();
textChunks = parser.parse(text);
final Scene root = getRoot();
if (// TODO MDM - It happens.... but how? Ah! Need to acquire tree lock when removing panels.
root != null) {
Map<String, RichStyle> styleMap = root.getStyles();
for (StyledText styledText : textChunks) styledText.setupStyles(styleMap, getStyle(), this);
// TODO MDM StyleObservers may cause a memory leak. Styles keep track of panels that are no longer used?
addLines();
}
}
}
Aggregations