use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class AbstractDataGridLoader method loadDataGridData.
protected void loadDataGridData() {
DataGridDataHolder holder = initDataGridDataHolder();
if (!holder.isContainerLoaded() && holder.getMetaClass() == null) {
throw new GuiDevelopmentException("DataGrid doesn't have data binding", context, "DataGrid ID", element.attributeValue("id"));
}
Element columnsElement = element.element("columns");
if (columnsElement != null) {
FetchPlan fetchPlan = holder.getFetchPlan();
if (fetchPlan == null) {
fetchPlan = getViewRepository().getFetchPlan(holder.getMetaClass(), FetchPlan.LOCAL);
}
loadColumns(resultComponent, columnsElement, holder.getMetaClass(), fetchPlan);
}
setupDataContainer(holder);
if (resultComponent.getItems() == null) {
// noinspection unchecked
resultComponent.setItems(createEmptyDataGridItems(holder.getMetaClass()));
}
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class AbstractDataGridLoader method initDataGridDataHolder.
protected DataGridDataHolder initDataGridDataHolder() {
DataGridDataHolder holder = new DataGridDataHolder();
String containerId = element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
loadMetaClass(element, holder::setMetaClass);
return holder;
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
CollectionContainer collectionContainer;
if (container instanceof CollectionContainer) {
collectionContainer = (CollectionContainer) container;
} else {
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context);
}
if (collectionContainer instanceof CollectionPropertyContainer) {
initMasterDataLoaderListener((CollectionPropertyContainer) collectionContainer);
}
if (collectionContainer instanceof HasLoader) {
holder.setDataLoader(((HasLoader) collectionContainer).getLoader());
}
holder.setMetaClass(collectionContainer.getEntityMetaClass());
holder.setContainer(collectionContainer);
holder.setFetchPlan(collectionContainer.getFetchPlan());
return holder;
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class RelatedEntitiesLoader method loadPropertyOption.
protected void loadPropertyOption(Element routeElement) {
String property = loadString(routeElement, "name").orElseThrow(() -> new GuiDevelopmentException("Name attribute for related entities property is not specified", context, "componentId", resultComponent.getId()));
String caption = loadResourceString(routeElement.attributeValue("caption"));
String configurationName = loadResourceString(routeElement.attributeValue("configurationName"));
String screen = routeElement.attributeValue("screen");
if (StringUtils.isNotEmpty(screen)) {
if (getWindowConfig().findWindowInfo(screen) == null) {
throw new GuiDevelopmentException("Screen for custom route in related entities not found", context, "componentId", resultComponent.getId());
}
}
resultComponent.addPropertyOption(new PropertyOption(property, caption, configurationName, screen));
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class SideMenuLoader method loadSidePanel.
protected void loadSidePanel(SideMenu component, Element element) {
String sidePanelId = element.attributeValue("sidePanel");
if (StringUtils.isNotEmpty(sidePanelId)) {
Component sidePanel = resultComponent.getFrame().getComponent(sidePanelId);
if (sidePanel == null) {
throw new GuiDevelopmentException("Unable to find sidePanel component for SideMenu", context, "sidePanel", sidePanelId);
}
component.setSidePanel(sidePanel);
}
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class JavaScriptComponentLoader method loadDependencies.
protected void loadDependencies(JavaScriptComponent component, Element element) {
Element dependenciesElement = element.element("dependencies");
if (dependenciesElement == null) {
return;
}
List<JavaScriptComponent.ClientDependency> dependencies = new ArrayList<>();
for (Element dependency : dependenciesElement.elements("dependency")) {
String path = dependency.attributeValue("path");
if (Strings.isNullOrEmpty(path)) {
throw new GuiDevelopmentException("No path provided for a JavaScriptComponent dependency", context);
}
String type = dependency.attributeValue("type");
JavaScriptComponent.DependencyType dependencyType = !Strings.isNullOrEmpty(type) ? JavaScriptComponent.DependencyType.valueOf(type) : null;
dependencies.add(new JavaScriptComponent.ClientDependency(path, dependencyType));
}
component.setDependencies(dependencies);
}
Aggregations