use of com.codename1.ui.ComponentSelector.$ in project CodenameOne by codenameone.
the class ComponentSelector method setPaddingPercent.
/**
* Sets padding on all components in found set as a percentage of their respective parents' dimensions.
* @param top Top padding as percentage of parent height.
* @param right Right padding as percentage of parent width.
* @param bottom Bottom padding as percentage of parent height.
* @param left Left padding as percentage of parent width.
* @return
*/
public ComponentSelector setPaddingPercent(double top, double right, double bottom, double left) {
for (Component c : this) {
Component parent = c.getParent();
if (parent != null) {
// TODO : Change to currentStyle api... more complex with percents.
Style s = getStyle(c);
s.setPaddingUnit(Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS);
s.setPadding(percentHeight(top, parent), percentHeight(bottom, parent), percentWidth(left, parent), percentWidth(right, parent));
}
}
return this;
}
Aggregations