use of com.codename1.rad.ui.EntityEditor.DescriptionStyleAttribute in project CodeRAD by shannah.
the class FieldEditorFormController method onStartController.
protected void onStartController() {
super.onStartController();
Form f = new Form(new BorderLayout());
f.getToolbar().hideToolbar();
Container titleBar = new Container(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
titleBar.setSafeArea(true);
titleBar.setUIID("TitleArea");
if (hasBackCommand()) {
Button back = new Button();
FontImage.setIcon(back, FontImage.MATERIAL_ARROW_BACK_IOS, -1);
titleBar.add(BorderLayout.WEST, back);
back.addActionListener(evt -> {
evt.consume();
ActionSupport.dispatchEvent(new FormController.FormBackEvent(back));
});
}
AppSectionController sectionCtl = getSectionController();
if (sectionCtl != null) {
Button done = new Button("Done");
done.addActionListener(evt -> {
evt.consume();
ActionSupport.dispatchEvent(new AppSectionController.ExitSectionEvent(done));
});
titleBar.add(BorderLayout.EAST, done);
}
Label l = field.getLabel(entity.getEntity().getEntityType());
if (l != null) {
titleBar.add(BorderLayout.CENTER, new com.codename1.ui.Label(l.getValue(entity.getEntity()), "Title"));
}
f.add(BorderLayout.NORTH, titleBar);
field.setAttributes(new LabelStyleAttribute(LabelStyle.None), new DescriptionStyleAttribute(DescriptionStyle.SpanLabel));
UI ui = new UI() {
{
form(columns(1), field, editable(true));
}
};
EntityEditor editor = new EntityEditor(entity, ui);
editor.setScrollableY(true);
f.add(BorderLayout.CENTER, editor);
setView(f);
}
Aggregations