use of io.jmix.ui.component.VBoxLayout in project jmix by jmix-framework.
the class AppWorkAreaLoader method createComponent.
@Override
public void createComponent() {
resultComponent = createComponentInternal();
loadId(resultComponent, element);
Element initialLayoutElement = element.element("initialLayout");
initialLayoutLoader = getLayoutLoader().getLoader(initialLayoutElement, VBoxLayout.NAME);
initialLayoutLoader.createComponent();
VBoxLayout initialLayout = (VBoxLayout) initialLayoutLoader.getResultComponent();
resultComponent.setInitialLayout(initialLayout);
}
use of io.jmix.ui.component.VBoxLayout in project jmix by jmix-framework.
the class TestProgrammaticCommentaryPanel method createComponent.
protected void createComponent() {
VBoxLayout rootPanel = uiComponents.create(VBoxLayout.class);
rootPanel.setId("rootPanel");
rootPanel.setMargin(true);
rootPanel.setSpacing(true);
rootPanel.setStyleName("commentary-panel card");
rootPanel.setWidthFull();
DataGrid<CommentObject> commentsDataGrid = uiComponents.create(DataGrid.of(CommentObject.class));
commentsDataGrid.setId("commentsDataGrid");
commentsDataGrid.setBodyRowHeight(100);
commentsDataGrid.setColumnReorderingAllowed(false);
commentsDataGrid.setColumnsCollapsingAllowed(false);
commentsDataGrid.setHeaderVisible(false);
commentsDataGrid.setSelectionMode(DataGrid.SelectionMode.NONE);
commentsDataGrid.setWidthFull();
CssLayout sendMessageBox = uiComponents.create(CssLayout.class);
sendMessageBox.setId("sendMessageBox");
sendMessageBox.setStyleName("v-component-group message-box");
sendMessageBox.setWidthFull();
TextField<String> messageField = uiComponents.create(TextField.TYPE_STRING);
messageField.setId("messageField");
messageField.setInputPrompt("Enter your message");
messageField.setWidthFull();
Button sendBtn = uiComponents.create(Button.class);
sendBtn.setId("sendBtn");
sendBtn.setCaption("Send");
sendMessageBox.add(messageField, sendBtn);
rootPanel.add(commentsDataGrid, sendMessageBox);
rootPanel.expand(commentsDataGrid);
setComposition(rootPanel);
}
use of io.jmix.ui.component.VBoxLayout in project jmix by jmix-framework.
the class CanvasUiComponentsFactory method createCanvasWidgetLayout.
@Override
public CanvasWidgetLayout createCanvasWidgetLayout(CanvasFragment canvasFragment, WidgetLayout widgetLayout) {
Widget widget = widgetLayout.getWidget();
Optional<WidgetTypeInfo> widgetTypeOpt = widgetRepository.getWidgetTypesInfo().stream().filter(widgetType -> StringUtils.equals(widget.getFragmentId(), widgetType.getFragmentId())).findFirst();
if (!widgetTypeOpt.isPresent()) {
CanvasWidgetLayout layout = components.create(CanvasWidgetLayout.class).init(widgetLayout);
Label<String> label = components.create(Label.class);
String message = messages.formatMessage(CanvasUiComponentsFactory.class, "widgetNotFound", widget.getCaption(), widget.getName());
label.setValue(message);
layout.addComponent(label);
log.error(message);
return layout;
}
widget.setDashboard(canvasFragment.getDashboardModel());
String fragmentId = widgetTypeOpt.get().getFragmentId();
Map<String, Object> params = new HashMap<>(ParamsMap.of(WIDGET, widget, DASHBOARD_MODEL, canvasFragment.getDashboardModel(), DASHBOARD, canvasFragment.getDashboard()));
params.putAll(widgetRepository.getWidgetParams(widget));
ScreenFragment screenFragment = AppUI.getCurrent().getFragments().create(canvasFragment, fragmentId, new MapScreenOptions(params)).init();
Fragment fragment = screenFragment.getFragment();
fragment.setSizeFull();
Component widgetComponent = fragment;
if (BooleanUtils.isTrue(widget.getShowWidgetCaption())) {
VBoxLayout vBoxLayout = components.create(VBoxLayout.class);
vBoxLayout.setSpacing(true);
vBoxLayout.setMargin(true);
vBoxLayout.setSizeFull();
Label<String> label = components.create(Label.class);
label.setValue(widget.getCaption());
label.setStyleName("h2");
vBoxLayout.add(label);
vBoxLayout.add(fragment);
vBoxLayout.expand(fragment);
widgetComponent = vBoxLayout;
} else {
fragment.setMargin(true);
}
CanvasWidgetLayout layout = components.create(CanvasWidgetLayout.class).init(widgetLayout);
layout.setUuid(UUID.randomUUID());
layout.addComponent(widgetComponent);
layout.setWidgetComponent(screenFragment);
layout.setInnerLayout(widgetComponent);
layout.setWidget(widget);
layout.getDelegate().expand(widgetComponent);
layout.setSizeFull();
return layout;
}
Aggregations