Search in sources :

Example 1 with ButtonList

use of com.codename1.components.ButtonList in project CodeRAD by shannah.

the class ButtonListPropertyView method decorateButtonList.

private static ButtonList decorateButtonList(FieldNode field, ButtonList bl) {
    ButtonListLayoutAttribute att = (ButtonListLayoutAttribute) field.findInheritedAttribute(ButtonListLayoutAttribute.class);
    if (att != null) {
        switch(att.getValue()) {
            case Flow:
                bl.setLayout(new FlowLayout());
                break;
            case Y:
                bl.setLayout(BoxLayout.y());
                break;
            case X:
                bl.setLayout(BoxLayout.x());
                break;
            case Grid:
                Columns cols = (Columns) field.findAttribute(Columns.class);
                int numCols = 2;
                if (cols != null) {
                    numCols = cols.getValue();
                }
                bl.setLayout(new GridLayout(numCols));
                break;
        }
    }
    String uiid = field.getUIID(null);
    if (uiid != null) {
        bl.setUIID(uiid);
        bl.setCellUIID(uiid + "Cell");
    }
    return bl;
}
Also used : GridLayout(com.codename1.ui.layouts.GridLayout) FlowLayout(com.codename1.ui.layouts.FlowLayout) Columns(com.codename1.rad.attributes.Columns)

Aggregations

Columns (com.codename1.rad.attributes.Columns)1 FlowLayout (com.codename1.ui.layouts.FlowLayout)1 GridLayout (com.codename1.ui.layouts.GridLayout)1