use of limelight.styles.Style in project limelight by slagyr.
the class PropPanelLayout method layoutRows.
// protected void doPreliminaryLayoutOnChildren(PropPanel panel, Map<Panel, Layout> panelsToLayout)
// {
// for(Panel child : panel.getChildren())
// {
// if(panelsToLayout != null && panelsToLayout.containsKey(child))
// {
// if(!(child instanceof PropPanel) || child.getStyle().getCompiledWidth() instanceof AutoDimensionValue)
// {
// child.getDefaultLayout().doLayout(child, panelsToLayout, true);
// }
// else
// {
// ((PropPanel) child).greediness.setSize(0, 0);
// snapToSize((PropPanel) child);
// }
// }
// }
// }
//
// protected void doPostLayoutOnChildren(PropPanel panel, Map<Panel, Layout> panelsToLayout)
// {
// for(Panel child : panel.getChildren())
// {
// if(panelsToLayout != null && panelsToLayout.containsKey(child))
// {
// final Layout layout = child.getDefaultLayout();
// layout.doLayout(child, panelsToLayout, false);
// }
// }
// } 1
public void layoutRows(PropPanel panel, Dimension consumedDimension, LinkedList<Row> rows) {
Style style = panel.getStyle();
int y = style.getCompiledVerticalAlignment().getY(consumedDimension.height, panel.getChildConsumableBounds());
if (panel.getVerticalScrollbar() != null) {
y = Math.max(0, y);
y -= panel.getVerticalScrollbar().getValue();
}
for (Row row : rows) {
int x = style.getCompiledHorizontalAlignment().getX(row.width, panel.getChildConsumableBounds());
if (panel.getHorizontalScrollbar() != null) {
x = Math.max(0, x);
x -= panel.getHorizontalScrollbar().getValue();
}
row.layoutComponents(x, y, style.getCompiledVerticalAlignment());
y += row.height;
}
}
use of limelight.styles.Style in project limelight by slagyr.
the class BuiltInStylesTest method hasDropDownPopupList.
@Test
public void hasDropDownPopupList() throws Exception {
Style popup = styles.get("limelight_builtin_drop_down_popup_list");
assertNotNull(popup);
assertEquals("on", popup.getFloat());
}
use of limelight.styles.Style in project limelight by slagyr.
the class BuiltInStylesTest method hasDropDownListItem.
@Test
public void hasDropDownListItem() throws Exception {
Style popup = styles.get("limelight_builtin_drop_down_popup_list_item");
assertNotNull(popup);
assertEquals("10", popup.getLeftPadding());
Style hover = styles.get("limelight_builtin_drop_down_popup_list_item_selected");
assertEquals(Colors.toString(Colors.resolve("white")), hover.getTextColor());
}
use of limelight.styles.Style in project limelight by slagyr.
the class GradientPainter method paint.
public void paint(Graphics2D graphics, PaintablePanel panel) {
Style style = panel.getStyle();
Box r = panel.getBorderedBounds();
Color color1 = style.getCompiledBackgroundColor().getColor();
Color color2 = style.getCompiledSecondaryBackgroundColor().getColor();
int angle = style.getCompiledGradientAngle().getDegrees();
double penetration = style.getCompiledGradientPenetration().getPercentage();
boolean cyclic = style.getCompiledCyclicGradient().isOn();
int x1, y1, x2, y2;
if (angle == 90) {
x1 = x2 = r.width / 2;
y1 = r.height;
y2 = 0;
} else if (angle == 270) {
x1 = x2 = r.width / 2;
y1 = 0;
y2 = r.height;
} else if (angle == 0) {
y1 = y2 = r.height / 2;
x1 = 0;
x2 = r.width;
} else if (angle == 180) {
y1 = y2 = r.height / 2;
x1 = r.width;
x2 = 0;
} else {
double radians = Math.toRadians(angle);
double x = Math.cos(radians);
double y = Math.sin(radians);
double a = y / x;
double dx = Math.abs(r.height / a);
double dy = Math.abs(r.width * a);
if (x > 0) {
x1 = (int) (r.width / 2 - dx / 2);
x1 = Math.max(x1, 0);
x2 = (int) (r.width / 2 + dx / 2);
x2 = Math.min(x2, r.width);
} else {
x2 = (int) (r.width / 2 - dx / 2);
x2 = Math.max(x2, 0);
x1 = (int) (r.width / 2 + dx / 2);
x1 = Math.min(x1, r.width);
}
if (y >= 0) {
y1 = (int) (r.height / 2 + dy / 2);
y1 = Math.min(r.height, y1);
y2 = (int) (r.height / 2 - dy / 2);
y2 = Math.max(0, y2);
} else {
y2 = (int) (r.height / 2 + dy / 2);
y2 = Math.min(r.height, y2);
y1 = (int) (r.height / 2 - dy / 2);
y1 = Math.max(0, y1);
}
}
int x3 = x1 + (int) ((x2 - x1) * penetration * 0.01);
int y3 = y1 + (int) ((y2 - y1) * penetration * 0.01);
graphics.setPaint(new GradientPaint(x1, y1, color1, x3, y3, color2, cyclic));
Border border = panel.getBorderShaper();
Shape insideBorder = border.getShapeInsideBorder();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.fill(insideBorder);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
Aggregations