use of com.codename1.rad.layouts.FanLayout in project CodeRAD by shannah.
the class ProfileAvatarsTitleComponent method initUI.
private void initUI() {
setLayout(new BorderLayout());
wrapper = new Container(new FanLayout(FanLayout.X_AXIS));
avatarWrapperViewController.setView(wrapper);
$(wrapper).selectAllStyles().setPadding(0).setMargin(0).setBorder(Border.createEmpty());
int len = getEntity().size();
for (int i = len - 1; i >= 0; i--) {
// for (Entity child : getEntity()) {
Entity child = getEntity().get(i);
ProfileAvatarView v = createAvatar(child);
wrapper.add(v);
}
add(CENTER, wrapper);
StringBuilder text = new StringBuilder();
Property nameProp = getEntity().getRowType().findProperty(Thing.name);
if (getEntity().size() > 0) {
if (nameProp != null) {
text.append(getEntity().get(0).getEntity().getText(nameProp));
}
}
if (getEntity().size() == 2) {
if (nameProp != null) {
text.append(" & ").append(getEntity().get(1).getEntity().getText(nameProp));
}
}
if (getEntity().size() > 2) {
if (text.length() == 0) {
text.append(getEntity().size()).append(" People");
} else {
text.append(" and ").append(getEntity().size() - 1).append(" others");
}
}
Label lbl = new Label(text.toString());
lbl.setUIID("AccountAvatarsTitleComponentText");
add(SOUTH, FlowLayout.encloseCenter(lbl));
}