use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class AbstractSingleFilterComponentLoader method loadValueComponent.
@SuppressWarnings("unchecked")
protected void loadValueComponent(C resultComponent, Element element) {
Component valueComponent;
if (!element.elements().isEmpty()) {
valueComponent = createValueComponent(element.elements());
} else {
valueComponent = generateValueComponent();
}
if (!(valueComponent instanceof HasValue)) {
throw new GuiDevelopmentException("Value component of the PropertyFilter must implement HasValue", getComponentContext().getCurrentFrameId());
}
resultComponent.setValueComponent((HasValue) valueComponent);
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class RelatedEntitiesLoader method loadComponent.
@Override
public void loadComponent() {
assignFrame(resultComponent);
loadCaption(resultComponent, element);
loadIcon(resultComponent, element);
loadWidth(resultComponent, element);
loadStyleName(resultComponent, element);
loadEnable(resultComponent, element);
loadVisible(resultComponent, element);
loadAlign(resultComponent, element);
loadCss(resultComponent, element);
loadOpenMode(resultComponent, element);
loadString(element, "exclude", resultComponent::setExcludePropertiesRegex);
for (Element routeObject : element.elements("property")) {
loadPropertyOption(routeObject);
}
String listComponentId = loadString(element, "for").orElseThrow(() -> new GuiDevelopmentException("'for' attribute of related entities is not specified", context, "componentId", resultComponent.getId()));
getComponentContext().addPostInitTask((context1, window) -> {
if (resultComponent.getListComponent() == null) {
Component bindComponent = resultComponent.getFrame().getComponent(listComponentId);
if (!(bindComponent instanceof ListComponent)) {
throw new GuiDevelopmentException("Specify 'for' attribute: id of table or tree", context1, "componentId", resultComponent.getId());
}
resultComponent.setListComponent((ListComponent) bindComponent);
}
});
loadTabIndex(resultComponent, element);
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class ResponsiveGridLayoutLoader method loadComponent.
protected void loadComponent(Column column, Element element) {
List<Element> elements = element.elements();
if (elements.isEmpty()) {
throw new GuiDevelopmentException("ResponsiveGridLayout column element can't be empty", context);
}
if (elements.size() > 1) {
throw new GuiDevelopmentException("ResponsiveGridLayout column element must contain only one component", context);
}
Element contentElement = elements.get(0);
LayoutLoader loader = getLayoutLoader();
ComponentLoader<?> childComponentLoader = loader.createComponent(contentElement);
childComponentLoader.loadComponent();
Component component = childComponentLoader.getResultComponent();
column.setComponent(component);
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class SideMenuLoader method loadSidePanelToggleButton.
protected void loadSidePanelToggleButton(SideMenu component, Element element) {
String toggleButtonId = element.attributeValue("sidePanelToggleButton");
if (StringUtils.isNotEmpty(toggleButtonId)) {
Component toggleButton = resultComponent.getFrame().getComponent(toggleButtonId);
if (!(toggleButton instanceof Button)) {
throw new GuiDevelopmentException("Unable to find sidePanelToggleButton for SideMenu", context, "sidePanelToggleButton", toggleButtonId);
}
component.setSidePanelToggleButton((Button) toggleButton);
}
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class TabSheetLoader method createComponent.
@Override
public void createComponent() {
resultComponent = createComponentInternal();
loadId(resultComponent, element);
LayoutLoader layoutLoader = getLayoutLoader();
List<Element> tabElements = element.elements("tab");
for (Element tabElement : tabElements) {
final String name = tabElement.attributeValue("id");
boolean lazy = Boolean.parseBoolean(tabElement.attributeValue("lazy"));
ComponentLoader tabComponentLoader = layoutLoader.getLoader(tabElement, TabComponentLoader.class);
TabSheet.Tab tab;
if (lazy) {
tab = resultComponent.addLazyTab(name, tabElement, tabComponentLoader);
} else {
tabComponentLoader.createComponent();
Component tabComponent = tabComponentLoader.getResultComponent();
tab = resultComponent.addTab(name, tabComponent);
pendingLoadComponents.add(tabComponentLoader);
}
pendingLoadTabs.put(tabElement, tab);
}
}
Aggregations